Skip to content

About

Which urban streams need action, why, and who should act: OneAquaHealth citizen checks read against lab data. IEEE OneAquaHealth Hackathon, Track 2.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

StreamReport

StreamReport turns OneAquaHealth stream data into a report a city official can act on. It combines citizen stream checks from the OneAquaHealth Citizen Science App with lab health-risk scores and urban land-use data, and shows which urban streams need attention, why, and who should do what. The first screen shows how many streams need action now and which ones (a strip of every need-action station, each a click from its record). Below it come an overview with what changed in the last 90 days, the Act this week cards (risk, confidence, concern, who acts, by when) and a How it works chain; then the page reads as a short data story in five chapters, with one map that travels into the chapter being read and changes with it, and then hands off to the full station record. Every risk level, alert and sentence in the briefing comes from fixed rules and lists the evidence behind it. A second page, "For residents" (also a full section of the home page), gives residents the same findings in plain words: is my stream healthy, can I touch the water, and how did my checks help.

Built for the IEEE OneAquaHealth Global Hackathon, Track 2: Data-to-Insight. Solo project by Celibistrial.

Live: https://streamreport.celibistrial.com Citizen view: https://streamreport.celibistrial.com/citizen.html?site=BN3

Screenshots

Official report: cover with the need-action strip and city map Chapter 2: one stream, one day, with the map on the busiest station
Chapter 3: where lab and volunteers agree Site drawer for C5 Mina Hospital
All alerts, expanded Citizen view of BN3 Ponticelli

The problem

Track 2 states it directly: "Stream data is hard to interpret and does not clearly show patterns, risks, or health impact."

The OneAquaHealth data is detailed but spread across several sources. Citizen checks are categorical answers (water colour, flow, whether pipes/outfalls are present, whether there is discharge into the stream, and the volunteer's overall impression). Lab results are indices scaled 0–1 across sampled sites: a fecal-marker index, a pathogen index, an antibiotic-resistance gene (ARG) index and an overall health-risk index built from them. Urban parameters describe sealed surfaces and distances to hospitals and treatment plants. None of these, on its own, tells an official where to send an inspector this week, and none tells a resident whether their dog should drink from the stream.

How it works

OneAquaHealth API snapshot (data/*.json)
        │
        ▼
parse.js     validate each citizen check against the app's own code lists;
             flag implausible water heights, GPS 1–5 km off, dry-but-coloured, future dates;
             exclude checks logged more than 5 km from their site
        │
        ▼
insights.js  deterministic rules per site:
             risk points (citizen + lab + urban) → High / Medium / Low
             One Health alerts linking what citizens see to lab health signals
             rating trend, pressures, habitat condition, well-being, data quality
             verdict(site): one avoid / care / ok / unknown verdict for both pages
        │
        ├──▶ story.js    story(report, sites, records): every number, name and date in the chapters
        ├──▶ app.js      official report: cover, chapters, map states, full record, site drawer, print
        ├──▶ summary.js  plain-language briefing per city with ordered actions by agency
        └──▶ citizen.js  "For residents": one verdict, dated evidence, how your checks helped

Everything runs in the browser. There is no server code and no LLM. The rules are listed in the app under Methodology; those tables are generated from the same RISK_RULES and ALERT_RULES arrays in src/insights.js that compute the report, so the documentation can't drift from the code.

The rules, in short

All thresholds live in one object, T, at the top of insights.js.

  • Lab bands are percentile ranks. The lab indices are min-max scaled, so a raw 0.6 means nothing on its own. A site's index is high if it is in the top 20% of the 96 sampled sites and moderate in the top 20–50%; the app says "top X% of sampled sites". A scaled 0 is shown as "lowest among sampled sites", not as zero risk.
  • Risk points per site. Latest volunteer overall impression Poor (+2; a subjective rating), volunteer impressions worsening (+1, only with 4 or more visits), discharge into the stream (+2) and pipes/outfalls present (+1), lab overall health-risk index high (+2) or moderate (+1), more than 40% sealed surface within 500 m (+1), sewage treatment plant within 1 km (+1). 4+ points is High, 2–3 is Medium. Discharge and pipes/outfalls use the same evidence rule: at least 2 sightings, or at least 25% of the visits that answered the question. The fecal, pathogen and ARG indices are components of the overall index, so they never add points of their own; they drive the alerts below.
  • One Health alerts. Possible contamination: avoid contact until tested by the local health authority fires when citizens reported discharge at least twice (or once within 12 months of the lab sample) and the lab fecal-marker or pathogen index is high. The wording is "consistent with a 2023 lab sample", never "confirmed", because the lab samples (2023–24) predate most citizen checks (2025–26). Lab evidence more than 12 months older than the latest citizen check is flagged as such. The other alerts are Discharge reported by volunteers: needs a fresh water test, High lab fecal-marker index with no visible source, High antibiotic-resistance gene (ARG) index, Possible chemical pollution or algal bloom, Stagnant or dry stream and High lab index but no citizen monitoring. Each comes with evidence and a recommended action. The three lab-only alerts (high ARG index, high fecal-marker index with no visible source, no citizen monitoring) come from one survey and fire at many sites at once, so the report's alert list groups them into one N streams stand out in the {year} lab survey alert per city (the year, or years joined by a slash, comes from the lab sample dates; on this snapshot every city reads 2023), with the streams and the action for each group listed inside. Each stream keeps its own alerts in its detail panel and in the briefing.
  • Needs action means High risk or a high-severity alert. verdict(site) in insights.js derives the citizen page's verdict from the same rule, so the official count and the citizen page always agree: avoid (contact alert) plus care (any other site needing action) equals the number of streams that need action.
  • Habitat condition (site.habitat) summarises natural bed and banks, vegetation cover on the banks, in-stream habitats, no dams, no water abstraction and no invasive plants as a 0–1 share with notes. It is reported next to risk and adds no risk points.
  • Citizen-only alerts need two sightings, so one misread visit doesn't raise an alarm.

The story on the official page

The report page reads top to bottom as a story, then hands off to the record. Every number, station name, city, date and comparison in it comes from story(report, sites, records) in src/story.js, run on the stations in view, so it changes with the city tabs and with uploaded data. A chapter whose key number is missing is hidden rather than printed as "0 of 0". Chapter numbers follow the chapters that are shown.

Chapter What it shows (all cities, current snapshot) Map
Cover 7 streams need action now; volunteers logged 147 checks at 33 of 106 stations, read against the 2023–24 lab survey. A strip lists the 7 stations. Below it, an overview: stations by risk level (7 High, 26 Medium, 65 Low, 8 no data), priority actions, alerts, and what changed in the last 90 days. City labels with need-action counts
Act this week Every need-action station: risk score, confidence, primary concern, who acts and a suggested timeframe Need-action stations on top
How it works The decision chain with this view's numbers (checks → lab → trends → evidence → risk → confidence → action), why stream health matters for One Health, and what StreamReport adds to a lab survey none
What volunteers logged 33/106 stations have a check; 73 have none; per-city n/N rules Checked filled, never checked hollow
One stream, one day 63 of 147 checks were at BN3 Ponticelli, 51 of them on 23 Sept 2025; one check as logged Flies to the busiest station
Where lab and volunteers agree Of 31 stations with both a lab sample and a check: both point to sewage at 4, lab high with no source seen at 7, volunteers saw a source the lab did not flag at 6 Only those 31; the rest faded
Two clocks Lab samples May 2023 to Aug 2024, checks May 2024 to Oct 2026: 26 months apart, so "consistent with", not proof Checked filled, lab-only hollow
Nobody is looking 73 of 106 stations never checked; at 29 of them a lab index is high Those 29 dashed

The busiest station, the peak day and every count are recomputed per city: in Coimbra the story's busiest station is C3 Vale das Flores (8 of 43 checks); in Ghent and Toulouse the agree/disagree grid is hidden (fewer than 4 stations with both). On a phone the one map moves into the chapter being read. ?record (or having read to the end before) folds chapters 1 to 4 into one line. Print gives the cover, Act this week, the map and the record.

Decision support

  • Confidence is kept apart from risk. It counts five fixed criteria (at least 3 checks, a check in the last year, a lab sample, a lab sample within a year of the latest check, volunteers and lab agree): 4+ is High, 2–3 Medium. It is not a probability. CONFIDENCE_RULES in src/insights.js.
  • Agreement: at each station with both a check and a lab sample, volunteers' sightings (discharge or pipes) are compared with the lab fecal/pathogen band: agree (both or neither) or mismatch (lab only, volunteers only). The story's 2x2 grid and the drawer use the same agreement().
  • What changed: the report is rebuilt from the checks up to 90 days before the latest one and diffed with today's: stations that moved level, newly need action, new alerts, new checks (changes() in src/story.js). On the snapshot: C5 Mina Hospital moved up to High, C3 Vale das Flores moved down, 13 new checks at 8 stations.
  • Station drawer follows the evidence chain: risk and confidence tiles, the recommended action with who acts and when, then citizen observations, lab measurements, trend, agreement, the risk score rule by rule ("How is this calculated?" lists every rule, met or not), and the confidence criteria.
  • Why this rating: at the top of the drawer, the scored rules are grouped by the evidence they read (volunteers, lab, land use, trend; src on each of RISK_RULES), summed to the risk level, then confidence, the rule that fired, and the check date against the lab date ("consistent with", not proof, when they are over a year apart).
  • So what: each story chapter ends with what its number means for a city (for example, the never-checked stations with a high lab index are where to recruit volunteers or send a sampling team first). Methodology has Validation and Limitations sections, with numbers from the loaded data.
  • Alerts filter by severity and each names who acts. There is no status tracking (new/investigated/resolved): that would need a shared backend, which this static app does not have.

Data sources

All data comes from the OneAquaHealth backend (ENORA), snapshotted into data/:

File Endpoint What it is
sites.json GET https://api.enora-oah.eu/api/sites/all 106 research sites in 5 cities (Benevento, Coimbra, Ghent, Oslo, Toulouse) with coordinates
submissions.json GET https://api.enora-oah.eu/api/citizens/submissions 165 citizen stream checks at 40 sites, May 2024 to Oct 2026
health-risks.json GET https://api.enora-oah.eu/api/resilience-map/health-risks One lab sample for each of 96 sites (2023–24): scaled pathogen, fecal and antibiotic-resistance-gene risk plus an overall health-risk score
urban-parameters.json GET https://api.enora-oah.eu/api/resilience-map/urban-parameters Land use and distances (sealed surface within 500 m, nearest hospital, nearest sewage station) for 104 sites
codes/*.json https://api.enora-oah.eu/api/citizens/* code lists Labels for the app's answer codes

Data: OneAquaHealth project (ENORA API).

Field meanings: StreamReport uses the app's own wording. pipes means pipes/outfalls are present, not that they are polluting. waterDischarge means discharge into the stream, which can be sewage or stormwater. overallAssessment is the volunteer's subjective overall impression (Good / Moderate / Poor quality). Lab fields are the fecal-marker index, pathogen index, antibiotic-resistance gene (ARG) index and overall health-risk index.

Lab bands are relative. The lab indices are scaled 0–1 across all sampled OneAquaHealth sites, so StreamReport ranks them: "top 20% of sampled sites" is high. That does not mean a legal or regulatory limit was exceeded.

Data use & privacy

What is done today, before the snapshot is committed: photo and video fields are removed; observer ids are replaced with per-station ids (v1, v2, … restarting at each station), so one person's checks can't be linked across stations; GPS positions are rounded to 3 decimals (about 100 m); timestamps keep the date only. The raw export is git-ignored. Because ids are per station, the report never totals volunteers across stations.

What is not done yet: approval from the OneAquaHealth data steward to republish the volunteer data. Until then the snapshot should be treated as project data under OneAquaHealth terms, not as open data.

What the current snapshot shows

Numbers from running buildReport() on the bundled snapshot:

  • 106 sites, 165 citizen checks, of which 147 are scored. 18 checks were logged more than 5 km from their site (most hundreds of km away, several in Greece: 14 for Benevento sites, 2 for Coimbra, 1 each for Toulouse and Oslo), so they are excluded from scoring and listed under Data quality.
  • 7 high-risk sites, 26 medium, 73 low. The headline reads "7 streams need action now" (Benevento 3, Coimbra 3, Oslo 1, Ghent 0, Toulouse 0). In ranked order: BN3 Ponticelli, C2 Estação Cbr-B, C6 Casa do Sal, BN20 Lenta, C5 Mina Hospital, O16 Alna - Kværnerfossene, BN1 Capodimonte.
  • 11 One Health alerts: 1 high, 9 medium, 1 low. That is 1 contact alert, 4 needs a fresh water test, 1 stagnant or dry stream (BN12) and 5 per-city lab-survey alerts (Toulouse 13 streams, Coimbra 7, Oslo 7, Benevento 5, Ghent 2) that group 37 per-site lab-only alerts (19 high ARG index, 15 high fecal-marker index with no visible source, 3 not monitored). Before grouping the list had 43. The one high alert is at BN3 Ponticelli (Benevento): discharge reported in 3 of 34 visits that checked and pipes/outfalls in 23 of 41, consistent with a 2023 lab sample whose fecal-marker index is in the top 6% of sampled sites.
  • G20 (Ghent) no longer needs action. It has one discharge report (December 2024) and no lab sample, so it is Medium with a needs a fresh water test alert.
  • C6 Casa do Sal has a single discharge report against a 2023 lab sample, so it gets needs a fresh water test, not a contact warning.
  • 36 of 165 checks (22%) have at least one data-quality flag: 18 logged more than 5 km from the site (excluded), 1 logged 1–5 km away (kept), 21 implausible water heights (often typed in cm), 4 water colours given for a dry stream. Apart from the far-off ones, flagged checks still count, and the problem is shown so it can be fixed at the source.

Integration with OneAquaHealth

  • Same data shape. The app reads the JSON exactly as the OneAquaHealth API returns it. Swapping the snapshot for the live API means pointing the four fetch calls at the endpoints above, either through a small server-side proxy or a nightly job that refreshes data/. Keeping the API call server-side keeps load and any credentials off the client.
  • Load your own data. The report page (footer) accepts any JSON file shaped like GET /api/citizens/submissions and rebuilds the report in the browser. Nothing is uploaded.
  • Links both ways. index.html?site=C5 opens a site in the official report; citizen.html?site=BN3 opens the citizen view. The citizen view's Log a check (10 min) button opens the OneAquaHealth app to log a new check.
  • Static hosting. Plain HTML, CSS and ES modules. Leaflet loads from cdnjs; if it fails, the story and record still read without the map. Any static host works (it runs on Caddy here); there is no build step or database.

License

Code: MIT (see LICENSE). Data in data/: OneAquaHealth project (ENORA API), used under OneAquaHealth terms; it is not covered by the MIT license.

Run locally

python3 -m http.server 8000   # then open http://localhost:8000
npm test                      # node --test, no dependencies to install

Tests need Node 20 or later (Array.prototype.toSorted). The page needs to be served over HTTP, not opened as a file, because it fetches data/*.json.

Project structure

index.html            official report
citizen.html          "For residents" page
src/parse.js          parse + validate citizen submissions
src/insights.js       risk rules, One Health alert rules, per-site and per-city report
src/summary.js        rule-based plain-language briefing
src/story.js          story(): every slot in the official page's chapters, per city / upload
src/app.js            report UI: cover, chapters, map states, full record, drawer, upload, print
src/citizen.js        citizen view
src/style.css, src/citizen.css
data/                 OneAquaHealth API snapshot (anonymized) + code lists
test/                 node:test suites for parse, insights, summary, story and threshold sensitivity; golden values pinned to the snapshot are grouped under `snapshot`

Limitations

  • One lab sample per site, taken in 2023–24. Lab risk can't show change over time, and it may be out of date for some sites.
  • Lab and citizen evidence are years apart. Lab samples are from 2023–24, while most citizen checks are from 2025–26; 30 of the 31 visited, lab-sampled sites have a lab sample more than a year older than their latest check. StreamReport says "consistent with a 2023 lab sample" and flags the gap; it never treats the lab as confirming what citizens saw.
  • Citizen data is sparse outside BN3. 63 of the 147 scored checks are at BN3 Ponticelli. 73 of 106 sites have no scored citizen check, so trends (which need 4 visits) exist for only a handful of sites. The report says when a site has no checks rather than calling it healthy.
  • Lab bands are relative, not regulatory. A "low" site can still exceed a legal limit, and a "high" one might not.
  • The thresholds are judgement calls: top 20% / 50% lab bands, 2 sightings or 25% of visits for discharge and pipes/outfalls, 12 months for lab-to-sighting distance, 4 visits for a trend, 40% sealed surface, 1 km to a treatment plant, 4 points for High, 5 km to exclude a check. They live in T in insights.js (and EXCLUDE_DISTANCE_M in parse.js) and should be tuned with OneAquaHealth scientists.
  • Sensitivity. node --test test/sensitivity.test.js moves each threshold ±20% and prints how many of the 7 High sites stay High. Moving any single lab, discharge, distance or urban threshold keeps 6 or 7 of them. The points cut-off is the fragile one: at 4.8 points (+20%) only 3 of 7 stay High. All thresholds −20% together keeps 6 of 7.
  • The overall impression is subjective. A Poor rating is one volunteer's impression of the whole stream, not a measurement.
  • No LLM, by design. The briefing is template text. It reads a little stiffly, but every claim traces to a rule and a data point. For officials that matters more than fluent prose.
  • Snapshot, not live. The bundled data is a point-in-time copy of the API.

Roadmap

  1. Nightly refresh from the live API through a server-side proxy.
  2. Tune thresholds with OneAquaHealth partners; add regulatory limits (e.g. EU Bathing Water Directive) where real chemistry or E. coli counts exist.
  3. Use repeat lab sampling, when it exists, for lab trends next to citizen trends.
  4. Email or RSS alerts to city contacts when a site moves to High or a new contact alert fires.
  5. Translations (Italian, Portuguese, Dutch, Norwegian, French) for the citizen view.
  6. Embed the citizen view in the OneAquaHealth app after a check is submitted ("here's what your check showed").

About

Which urban streams need action, why, and who should act: OneAquaHealth citizen checks read against lab data. IEEE OneAquaHealth Hackathon, Track 2.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages