CEDAR and the DANalytics engine
One quality-control engine behind every DANalytics product
October 4, 2026
The problem
Small monitoring programs (a tribal water office, a conservation district with one sonde, a volunteer coalition) collect continuous sensor data that drifts, fouls, and gets knocked into the sediment. The tools that handle that properly are built for large agencies; everyone else gets a spreadsheet. And building a separate app for each kind of customer would mean maintaining several codebases that slowly disagree.
The data
- One canonical format: a long, tidy table of about 45 columns, one row per parameter per timestamp, with timestamps stored in UTC and shown in local time. Every layer reads and writes it.
- Two kinds of record in the same table: continuous sensor deployments and discrete field readings, told apart by one field that decides how each stage treats them.
- Connectors to USGS, SNOTEL, NASA POWER, the Water Quality Portal, and EPA’s ATTAINS, so a program’s data can be read against the public record.
What I built
An R package and Shiny platform in three layers: pure functions (schema, corrections, quality control, criteria, connectors), Shiny modules (one per stage), and thin app shells that only wire modules together and set a theme. CEDAR is the professional shell; Project FLOW is the classroom shell. Same modules, different configuration.
Design decisions that carry the product:
- Corrections before quality control. Fouling and drift are corrected first, so the algorithms flag genuine anomalies instead of the sensor slowly going bad. This comes straight from USGS field experience, and the reactive graph enforces the order.
- Flags never delete. Every value keeps its raw reading; every flag records the threshold, the trigger, and who raised it, with the algorithm’s verdict frozen so a human override never erases it.
- Quality control per series. Algorithms run within one site’s unbroken record, which fixed a class of false flags that appeared when two loggers on the same river were sorted together.
- One resolver per configured value. A deployment is a YAML file; each value read from it has exactly one function that reads it, after the same drift bug appeared four times in four different values.
- No single request can freeze a class. After diagnosing a production crash from live logs (a public-data request that hung for three minutes and stalled every session), slow work moved into child processes with timeouts, and memory is logged at each stage.
Tools
- R with Shiny modules,
bslib, andrenv-pinned dependencies. callr,promises, andExtendedTaskfor background work with hard timeouts.testthat, about 1,400 test expectations, run on every pull request by GitHub Actions against the exact lockfile, with the system libraries and Quarto installed.- Quarto for generated reports; shinyapps.io for hosted deployments.
Outcome
- The engine runs Project FLOW’s live deployment at Eagle Valley Middle School; CEDAR and Project FLOW share every module.
- The test suite is green in CI on every change.