{glatar} is an R package that creates a {shiny} app that interfaces with the GLATAR PostgreSQL database which contains energy density, proximate composition, stable isotope, thiamine, fatty acid, mercury and PCB data for fish and aquatic invertebrates throughout the Great Lakes and North America. The app provides a seamless and rich interface to interact with the database.
The app can be accessed at glatar.org and provides the ability to do the following:
- Summarise data in the repository
- Create scatter plots of important relationships among species, waterbodies, and health metrics of interest.
- View your raw data (i.e., if you are a contributing member)
- Search source material within the repository
- View a map of all the studies, species, and data types in the repository
- Search species within the repository
- Upload your data (i.e., if you are a contributing member)
- View documentation
- Register as a contributing member
This project has used LLMs as a tool to assist in development, however, any code that has been generated by LLMs has been meticulously screened, edited, and redeveloped.
The {glatar} package can be installed in R using the following:
pak::pak('benjaminhlina/glatar-app')To run the app use the following:
library(glatar)
glatar_app()To view the overall progress of the package please see news.
This repository contains a shiny app built as a package (i.e, {glatar}) along with Dockerfiles, {renv} files, a shell file, nginx and shiny-server configuration files, and a html file.
The structure of the package is the following:
├── R
│ ├── app_glatar.Rwith app_glatar.R containing glatar_app() which builds the ui, server and runs shiny::shinyApp(ui = ui, server = server).
The ui contains a list of tabs, panels, and sidebars to build given the corresponding
module functions. While server contains the appropriate server functions that map
to a given ui (e.g., "view_summary" tab in ui with the same shiny namespace name being used in the server).
From there, there are mod_*.R andfnct_*.R files.
mod_*.R files contain modules and modals that have ui and server functions that are directly used in either the ui or server within glatar_app().
├── R
│ ├── mod_about_ui.R
│ ├── mod_document_ui.R
│ ├── mod_glatar_diagram.R
│ ├── mod_home_tab.R
│ ├── mod_how_to_use_ui.R
│ ├── mod_login_ui.R
│ ├── mod_raw_sidebar.R
│ ├── mod_register.R
│ ├── mod_scatter_sidebar.R
│ ├── mod_source_sidebar.R
│ ├── mod_summary_sidebar.R
│ ├── mod_taxa_search_ui.R
│ ├── mod_upload_data.R
│ ├── mod_view_data.R
│ ├── mod_view_map.R
│ ├── mod_view_scatter_plot.R
│ ├── mod_view_source.R
│ ├── mod_view_summer_info.RNext, any fnct_*.R files have functions that are to be used in either other functions found in
fnct_*.R files or directly in mod_*.R files.
├── R
│ ├── fnct_add.R
│ ├── fnct_app_version.R
│ ├── fnct_check.R
│ ├── fnct_clean.R
│ ├── fnct_clear.R
...There are a total of 31 fcnt_*.R files with {glatar} having 166 functions in total between fcnt_*.R, mod_*.R, app_glatar.R.
The package and app are deployed using GitHub Actions (GHA). When a push to the main branch of the repository occurs or cron job runs, the first two actions to be triggered are R CMD Check and pkgdown. R CMD check, checks if the package can be built while pkgdown deploys the documentation to a pkgdown website.
Upon the R CMD Check successfully completing, a GHA is triggered that builds a docker container. This container uses rocker's shiny image and installs all of the packages needed to support {glatar} using {renv} and {pak}, it then installs a fresh version of {glatar} and copies the app.R file in the main directory. This file contains the following:
library(glatar)
glatar_app()This will allow the shiny-server to run properly and executes the shiny_entry.sh file. This file contains environmental variables and excutes shiny-server. This docker container is registred on GitHub Container Registery (GHCR).
Once complete, another GHA is triggered which uses docker composer (i.e, docker-compose.yaml) to deploy the container with the shiny app, and an nginx and certbot containers on to a Digital Ocean's Droplet.
Lastly, once that GHA is complete, a GHA checks if the app returns a 200 status and if the logs run to confirm the app has been deployed properly.
If you would like to contribute please feel free to fork the repository, create a branch, implement your changes, and submit a PR for review.
This repository will not be accepting LLM submitted PRs nor PRs that contain directly copy and pasted code from LLMs that has not be vetted and edited.
Issues that are submitted by LLMs and/or copied and pasted from LLMs will be deleted and ignored, as the issuer needs to have the ability to be able to write their own issues.