Track 6: Resilience Informatics. AfterRain is early warning for city streams: it forecasts when each stream is in danger after rain and plans where and when to sample next.
Inspiration On 23 September 2024, the Freshford storm tank, 4.55 km above Warleigh Weir near Bath, began a spill that its log records for 30 hours. At 09:10 the next morning, a lab sample at the weir read 31,000 E. coli per 100 ml. People swim at Warleigh Weir, and dogs run straight in. The water looked the same as always.
Then we checked OneAquaHealth's own public data. 80 of its 96 pathogen samples were taken after less than 1 mm of rain in the three days before. In Ghent (17 of 17), Oslo (20 of 20) and Toulouse (21 of 21), every one was. Sampling at calm, stable flow is right for reading stream ecology, and it leaves the hours after rain, when overflows and runoff reach the water, as the hours to measure next.
Europe is about to need exactly this. The recast Urban Wastewater Treatment Directive (EU) 2024/3019, Article 5, requires an integrated urban wastewater management plan by 31 December 2033 for every agglomeration of 100 000 population equivalent and above, framed in the One Health approach: people, animals and ecosystems.
What it does AfterRain forecasts when each city stream is in danger after rain, and tells the city team where and when one sample will sharpen that warning most.
Forecast. Tap a stream to see its hourly chance, over the coming week, of exceeding 900 E. coli per 100 ml, the single-sample flag. Fog. Wherever no sample backs the estimate, the map is foggy. Fog means "not measured yet". Request. The stream asks for its next sample: one place and one time window, chosen to clear the most fog while the warning still matters. Answer. Enter a test reading, and the stream's answer changes in front of you. Try it. Open https://yazan-o.github.io/afterrain/. The story starts at Warleigh Weir, near Bath, and arrives at Eiras, a stream site in Coimbra. The live site shows the forecast of 3 October, the one quoted here.
In the forecast of 3 October, Eiras has a 45.6% chance of going over 900 at 15:00 (UTC+1) on 6 October. Tap an example test reading of "900 or less" and the chance falls to 23.8%. Tap "Over 900" instead and it rises to 71.5%. Escravote, upstream, stays at 45.6%. In the same forecast, Coimbra's request is Condeixa, Sunday 4 October, 08:00 to 20:00; when a request's window closes, the app offers the next one from the forecast's remaining days.
Who it is for. OneAquaHealth's city teams, who decide when and where to take samples; citizen samplers, who get one clear request instead of a dashboard; and city officers, who need to know which stream hours carry risk after a storm. A child, a swimmer, a dog and a heron stand on the bank of every stream and share its one estimate: people, animals and ecosystem in one picture.
The storm replay. AfterRain replays the Bath storm: each overflow switches on at its logged minute, the lab samples land at their logged times, and the water's travel between them is modelled. Two public Wessex Water map layers confirm it: the overflow log (site 13130S, 23 September 2024, spill from 09:28 UTC to 15:39 UTC the next day) and the river-quality layer at Warleigh Weir (24 September 2024, 09:10 local time: E. coli 31,000).
How we built it One command rebuilds every number. A Python pipeline pulls each public source (Wessex Water logs and samples, Environment Agency gauges, Hub'Eau, Open-Meteo, OpenStreetMap, the OneAquaHealth API) and writes numbers.json, where each number names its source files and the function that made it. pytest checks hold the evidence, including that no feature uses rain measured after its sample. The forecast. The 51-member ECMWF ensemble rain forecast becomes hourly risk, fog and sampling requests for all 106 OneAquaHealth research sites in Benevento, Coimbra, Ghent, Oslo and Toulouse. One workflow run refreshes it, rebuilds the FHIR records and redeploys. The sampling request. For every site and hour, AfterRain computes how much fog one sample is expected to clear. It scores only the warning hours after the result arrives, with a 24-hour turnaround from sampling to result. The site and window with the largest expected fog reduction get the request. The model runs in the browser. A TypeScript engine reproduces the Python model's test vectors and updates the estimate from a test reading with an exact Bayesian step. No server is needed. The scenes. MapLibre with 3D terrain, WebGL and canvas, on one shared clock, so every frame of the film is reproducible. Built on OneAquaHealth. The OneAquaHealth API, read-only: 106 research sites, 70 citizen sites, urban context for 104 sites, daily weather and the 96 pathogen, fecal and antibiotic-resistance risk scores. The OAH-FHIR Implementation Guide (hl7-eu/oah): AfterRain writes its data as a 925-resource FHIR package, 912 of them on the guide's own profiles (sites, every Bath specimen and result, risk estimates, cohorts and the backtest dataset). The HL7 validator checks 927 files with 0 errors, and the app serves 872 of them: a risk record for each of the 106 sites and every resource they reference. Press and hold the 31,000 sample in the replay to turn over its record. Tested on real samples. Bath, five years: from March 2021 to December 2025, 43 of the 44 samples taken within 48 hours of a Freshford spill were over 900 (median 6,400). Of the other 278 samples, 102 were (median 700). Held-out test: trained on 2021 to 2024 and tested once on 2025 (50 samples, 14 over 900), the Bath model caught 13 of the 14, with AUC 0.95 and a Brier score of 0.113 against 0.242 for always forecasting the usual rate. The best rule of thumb (any spill, high flow or heavy rain) caught 12. A new river: applied without refitting to the River Frome at Farleigh Hungerford (173 samples), a version with no named overflows caught 69 of 93 exceedances, with AUC 0.81. Toulouse: France's Hub'Eau holds 118 E. coli samples from the Garonne at Pech David. After three dry days, 0 of 36 were over 900; after 5 mm or more of rain in two days, 6 of 30 were. The city model fitted at Bath alone ranks the Toulouse samples with AUC 0.79. Requested samples sharpen the forecast: replaying the request-and-update loop on 440 archived E. coli results, one to five requested counts a year at Toulouse cut the error on that year's later samples by 0.09 to 0.15 in log loss, every 95% interval excluding zero. At Bath the cut was 0.04 to 0.07. Automated checks. Unit and end-to-end tests cover the model updates, a word limit on every screen, no console errors, and every on-screen number bound to its source. Each build checks TypeScript, validates FHIR and scans published files. Challenges we ran into The lab delay. A result arrives a day after sampling. AfterRain credits a sample only for the hours after its result is back, so every request is scored on warnings its result can still change. No overflow logs in the five cities. We proved the model where open ground truth exists, at Bath and Toulouse, and run the pooled rain model across the five cities with its uncertainty drawn as fog, so every site learns from its own samples. Running the guide ourselves. We build the OAH-FHIR guide with SUSHI and serve AfterRain's records on our own FHIR endpoint. Accomplishments that we're proud of A stream that asks for its next sample and visibly changes its answer. A finding in OneAquaHealth's own data, 80 of 96 samples after dry days, turned into an action for their own teams. A storm replay a judge can check against two public map layers. 927 FHIR files that pass the HL7 validator against the OneAquaHealth guide with 0 errors, plus a new alert profile, AlertOah: a FHIR Communication with an "until" extension and a Subscription, carrying messages such as "keep dogs out at this spot until this time, because of this spill". The guide does not model alerts yet; we offer it to its authors, with two more findings: its escherichia-coli code means the share of people with E. coli, so water results also carry LOINC 87317-4, and two of its Observation profiles overlap. What we learned The most useful thing a forecast can say is where it is blind. Drawing that as fog turned uncertainty into the interface, and into a reason to go out and measure.
What's next for AfterRain A pilot in one OneAquaHealth city. Two storm-triggered sampling days from AfterRain's requests, with the local team, each result updating the stream. AlertOah to the guide's authors. England next. All ten water companies publish live overflow status, and the national overflow lookup lists 14,384 overflows. A new river takes its overflow feed, a model fit and a test on its own samples. Storm plans in every large EU city. AfterRain's sampling requests give the 2033 integrated plans' storm monitoring a place to start. AfterRain fits OneAquaHealth's work packages: early warning from environmental signals (WP5), a decision aid on where to measure next (WP6), fed by citizen science (WP4), with FAIR, standard data (WP3).
Built With
- environment-agency-hydrology-api
- github
- hapi-fhir
- hl7-fhir-r4
- hl7-fhir-validator
- hub'eau
- maplibre-gl-js
- oah-fhir-implementation-guide
- oneaquahealth-api
- open-meteo
- openstreetmap
- playwright
- pytest
- python
- sushi
- typescript
- vite
- vitest
- webgl
- wessex-water-open-data
Log in or sign up for Devpost to join the conversation.