Skip to content

Repository files navigation

CalCOFI Integrated Application

The app is available online here:

You may be presented with a tour dialog when opening:

tour dialog

The CalCOFI Integrated Application is using the integrated database constructed from the following datasets:

This app is open-source with code found here:

The following key technologies enable this app:

  • R: programming language for statistical computing
  • Shiny: web application framework for R
  • DuckDB: in-process SQL OLAP database management system
  • H3: hexagonal hierarchical geospatial indexing system
  • mapgl: R interface to MapLibre GL JS for interactive maps

URL parameters

parameter what it does
?datasets=a,b opens with those taxa datasets selected — a comma-separated list of release dataset_keys, the same values the Taxa datasets checkbox group carries. The opening map and the filter modal both honour it.
?theme=dark / ?theme=light brand v2 contract, honoured by calcofi4r::cc_theme_init()
?tour=off suppresses the guided tour for this visit, so a screenshot shows the interface

The URL is the source of truth at load only, parsed once on connect; after that the user's own selection is, and it is written back with updateQueryString(mode = "replace") so any view is a link you can send — carrying every other parameter through untouched, because a screenshot URL that loses its ?theme= is a broken screenshot. Keys that name no dataset in this release are dropped, and a list with none left is ignored rather than applied: in this app an empty dataset selection already means all of them, so a stale link must not read as a deliberate empty filter.

Every dataset page on calcofi.io builds one of these links from a dataset_url: template in CalCOFI.github.io/_data/products.yml — the one place a product-to-dataset link is written (UI plan D-6, Decision 10):

https://app.calcofi.io/hex/?datasets=swfsc_ichthyo

The rule itself is parse_datasets_param() in app/functions.R, kept pure so it can be tested without a running app and a release database:

Rscript tests/test_url_datasets.R

This app was developed by:

  • Ivy Li: CalCOFI intern from UCSB (BS in Physics and Statistics & Data Science)
  • Ben Best: CalCOFI contractor, marine data scientist at EcoQuants LLC
  • Erin Satterthwaite: CalCOFI Program Coordinator

Deploy

The app runs on the CalCOFI shiny-server VM: this repo is cloned to /share/github/CalCOFI/db-viz-hex and served (via shiny-server in the rstudio container) from /srv/shiny-server/db-viz-hex, a symlink to its app/ directory — so https://app.calcofi.io/db-viz-hex serves app/.

After pushing UI/server R-code changes to main, pull and reload just this app:

ssh calcofi                                              # → ssh.calcofi.io (key-based)
git -C /share/github/CalCOFI/db-viz-hex pull --ff-only
touch /share/github/CalCOFI/db-viz-hex/app/restart.txt   # reloads on next request

When the release / DB schema changes, also rebuild the local DuckDB before restarting (docker exec -d rstudio bash -lc 'cd /share/github/CalCOFI/db-viz-hex && Rscript prep_db.R'). See CLAUDE.md for details.

About

application for visualization of CalCOFI integrated database

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages