BioDT
Prototype Digital Twins to help protect and restore biodiversity.
https://github.com/biodt/biodt-shiny
Category: Biosphere
Sub Category: Ecological and Environmental Modeling
Last synced: about 5 hours ago
JSON representation
Repository metadata
This repository contains a shiny application which is intended as the simplest way of interacting with BioDT by end-users.
- Host: GitHub
- URL: https://github.com/biodt/biodt-shiny
- Owner: BioDT
- License: other
- Created: 2023-03-08T12:23:27.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2025-12-18T11:13:09.000Z (3 months ago)
- Last Synced: 2026-03-07T21:11:57.542Z (19 days ago)
- Language: R
- Size: 278 MB
- Stars: 9
- Watchers: 4
- Forks: 3
- Open Issues: 17
- Releases: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE
README.md
BioDT Web Application
Overview
This repository contains the codes for the Shiny web application hosted at app.biodt.eu. The Shiny app is intended as the simplest way of interacting with BioDT by end-users. The app uses Shiny framework on top of R language and is built using power of development framework Rhino.
Quick Start with Docker Compose
The easiest way to run the BioDT Shiny app is using Docker Compose:
Prerequisites
Running the app
- Clone the repository:
git clone git@github.com:BioDT/biodt-shiny.git
cd biodt-shiny
-
Setup local data (see section 4 for details on which pDTs require data)
Note: By default, the
docker-compose.ymlexpects data in${PWD}/app/data. If you place your data in a different location, update the left-hand side of the volume mount indocker-compose.yml:volumes: - "/your/custom/path:/app/data" # Change /your/custom/path to your data location -
Start the application:
docker compose up
- Open your browser and navigate to
http://localhost:7860
To stop the application, press Ctrl+C or run:
docker compose down
Note: The Honeybee and Disease Outbreaks pDTs require Docker socket access (/var/run/docker.sock) which is already configured in the docker-compose.yml file.
Getting Started (development set up)
0. Prerequisites
On your local computer there have to be downloaded and installed these binaries and frameworks (ie. R packages):
- Git
- R language
- Shiny framework (see instructions below)
- Rhino development framework (see instructions below)
- You might also want to have Node.js installed due to utilization of the state of the art JavaScript and Sass development tools provided by Rhino
1. Get the code
Clone the repository:
git clone git@github.com:BioDT/biodt-shiny.git
Open the project directory in your preferred IDE, for example (RStudio or (VS Code)[https://code.visualstudio.com/download]).
2. Install required packages
Start by installing renv package.
install.packages("renv")
Then install all the dependencies by calling renv::restore() command. All the dependencies are stored in the renv.lock file.
renv::restore()
3. Setup local development, or production, environment
We utilize a common way for setting up your enviroment. There are two common options depending whether you want to run the app locally for development purposes (dev), or in production environment (prod), ie. for example dockerized app hosted at app.biodt.eu.
In the working directory you need to create your own .Renviron file which is git ignored. You can easily do it by issuing the following command in your Bash (Zsh, etc) terminal
cp .Renviron.example .Renviron
Config env variable
In the file please config what enviroment you want the app run at. For development:
(...)
R_CONFIG_ACTIVE="dev"
(...)
For production delete the line R_CONFIG_ACTIVE="dev" and uncomment this line which results in:
(...)
R_CONFIG_ACTIVE="prod"
(...)
Other environment variables, which aren't secrets (ie. git ignored) and are publicily avaible, can be seen and/or edit in the file config.yml. At the time (May 2024) the file contains dummy variables, serving as an example only.
Config .Rprofile
We prefer to use PPM packages where possible and therefore it is advised to use following lines in the .Rprofile file in the home directory of the project.
source("renv/activate.R")
options(repos = c(PPM = "https://packagemanager.posit.co/cran/latest"))
In case of Windows and MacOS environment You might want to add one more line after these two:
options(pkgType = "binary")
Note! You might probably want to restart (re-open) your R terminal at this moment and restart your R session.
4. Get local data
Not all pDTs require local data, and data is only needed when accessing specific pDT pages. Therefore, you typically don't need to download all data for development.
pDTs that don't require local data:
- Invasive Alien Species (data is embedded)
- Real-time Bird Monitoring (data is fetched automatically)
For pDTs that do require local data:
First, you need to create a folder to hold this data. This folder is ignored by git so you need to create it first. You can do this manually or run in R
dir.create("app/data")
If you need access to data for development, please contact tomas.martinovic@vsb.cz or reach out through LifeWatch ERIC channels.
Each pDT's shiny module has its own folder for local data within this which you can see specified in the config.yml file. The folder names are:
- Crop wild relatives:
app/data/cwr - BEEHAVE:
app/data/honeybee - Cultural ecosystem services:
app/data/ces - Disease outbreaks:
app/data/disease_outbreak - Forest biodiversity:
app/data/forest_bird - Grassland dynamics:
app/data/grassland - Real-time bird monitoring:
app/data/rtbm
5. Launch the app
Now you should be ready to launch the app, which you can do using this command in your R terminal.
shiny::runApp()
Development
Please feel free to create a branch and pull requests for making significant changes to the Shiny app.
Modules
The app is modularized and each pDT have files in its own subfolder. UI files are located mainly in the app/view subfolder, R function mainly in the app/logic subfolder. UI files for each pDT is located:
- BEEHAVE:
app/view/honeybee - Cultural Ecosystem Services:
app/view/ces - Crop wild relatives:
app/view/cwr - Disease outbreaks:
app/view/disease_outbreaks - Forest biodiversity:
app/view/forest - GRASSLAND:
app/view/grassland - Invasive alien species:
app/view/ias - RTBM (Real-time Bird Monitoring):
app/view/rtbm
Technicals
๐จ We use {bslib} in order to use Bootstrap 5 elements (https://rstudio.github.io/bslib/). The theme is a custom BioDT theme. The css, favicons, backgrounds etc. are located in inst/app/www.
โ
Tests are developed using the {testthat} package. Tests are written as .R files in tests/testthat/.
๐ Maps are rendered using {leaflet}: https://rstudio.github.io/leaflet/.
Loading screens with {waiter}
If you have computations that take a long time then use the implemented waiter functionality. This will not make the app load faster but make it feel faster as it induces patience in your users and make the app feel slicker. To set this up in your module you can use waiter_text() function to prepare text message with custom HTML format.
msg <-
waiter_text(message = tags$h3("Computing Beehave simulation...",
style = "color: #414f2f;"
))
Then create a waiter object
w <- Waiter$new(
html = msg[[1]],
color = "rgba(256,256,256,0.9)"
)
You can then use the following lines within your shiny code:
w$show()to show a loading screenw$update()to update message in the middle of computationw$hide()to hide a loading screen
See https://waiter.john-coene.com/ for more info
Owner metadata
- Name: BioDT
- Login: BioDT
- Email:
- Kind: organization
- Description: Horizon EU Biodiversity Digital Twin
- Website: https://biodt.eu
- Location:
- Twitter: BiodiversityDT
- Company:
- Icon url: https://avatars.githubusercontent.com/u/106523593?v=4
- Repositories: 1
- Last ynced at: 2023-05-11T09:29:08.647Z
- Profile URL: https://github.com/BioDT
GitHub Events
Total
- Release event: 3
- Delete event: 29
- Member event: 3
- Pull request event: 82
- Fork event: 2
- Issues event: 50
- Watch event: 5
- Issue comment event: 50
- Push event: 391
- Pull request review event: 3
- Create event: 41
Last Year
- Release event: 3
- Delete event: 21
- Member event: 1
- Pull request event: 35
- Issues event: 16
- Watch event: 3
- Issue comment event: 10
- Push event: 165
- Pull request review event: 2
- Create event: 16
Committers metadata
Last synced: 3 days ago
Total Commits: 994
Total Committers: 10
Avg Commits per committer: 99.4
Development Distribution Score (DDS): 0.64
Commits in past year: 301
Committers in past year: 8
Avg Commits per committer in past year: 37.625
Development Distribution Score (DDS) in past year: 0.691
| Name | Commits | |
|---|---|---|
| Tomas Martinovic | t****c@v****z | 358 |
| Ondลej Salamon | o****n@v****z | 334 |
| Zhenggang Gao | z****a@k****e | 81 |
| Kata Sara-aho | k****o@c****i | 81 |
| Radek Halfar | h****8@v****z | 43 |
| Simon Rolph | s****l@c****k | 37 |
| Souza Allan | a****u@l****i | 21 |
| Tuomas Rossi | t****i@c****i | 17 |
| DylanCarbone | d****r@c****k | 11 |
| julio.paneque | j****e@l****u | 11 |
Committer domains:
- vsb.cz: 3
- ceh.ac.uk: 2
- csc.fi: 2
- lifewatch.eu: 1
- lx2-870-27966.ad.helsinki.fi: 1
- kth.se: 1
Issue and Pull Request metadata
Last synced: 7 days ago
Total issues: 78
Total pull requests: 115
Average time to close issues: about 1 month
Average time to close pull requests: 2 days
Total issue authors: 6
Total pull request authors: 7
Average comments per issue: 0.71
Average comments per pull request: 0.17
Merged pull request: 102
Bot issues: 0
Bot pull requests: 0
Past year issues: 31
Past year pull requests: 78
Past year average time to close issues: 25 days
Past year average time to close pull requests: 2 days
Past year issue authors: 4
Past year pull request authors: 5
Past year average comments per issue: 0.52
Past year average comments per pull request: 0.06
Past year merged pull request: 70
Past year bot issues: 0
Past year bot pull requests: 0
Top Issue Authors
- Nithador (39)
- csckata (18)
- simonrolph (8)
- osalamon (7)
- DylanCarbone (5)
- sharifX (1)
Top Pull Request Authors
- osalamon (48)
- artyinfact (35)
- DylanCarbone (10)
- Nithador (9)
- JulioLP (7)
- trossi (4)
- simonrolph (2)
Top Issue Labels
- Cultural Ecosystem Services (16)
- enhancement (14)
- design (10)
- Grassland (6)
- accessibility (5)
- Honeybee (4)
- bug (4)
- documentation (1)
- invalid (1)
- tests (1)
- honeybee (1)
- Wild Boar Diseases (1)
- priority3 (1)
- feature (1)
Top Pull Request Labels
- Grassland (1)
- feature (1)
Dependencies
- actions/checkout v4 composite
- actions/setup-node v3 composite
- cypress-io/github-action v6 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-renv v2 composite
- rocker/r-ver 4.3.3 build
Score: 5.5606816310155285