Plate 01

Study · MVP, not published

Influenza PR

A public data product on severe influenza in Paraná. Every rate shows where it came from and what it does not mean.

The starting point

Brazil publishes hospitalised severe acute respiratory syndrome (SARS) notifications as open data through SIVEP-Gripe, one row per patient. I wanted to know how influenza cases and deaths moved across Paraná from 2022 to 2025, by municipality and health region, and to build the answer the way a surveillance team, a journalist and a researcher could all trust it: official data, aggregated, with the provenance of every number one click away.

Seasonality page: weekly rate for four years overlaid, and a table of peak week per year
Seasonality: four years overlaid week by week, with the peak and the weeks above a chosen threshold.

The problem to solve

Dividing a few thousand cases a year among 399 municipalities produces mostly noise: a town of 3,000 people with two cases shows a rate three times the state’s. The product had to show that honestly, never expose an individual record, and never let a cleaner layout hide what the data does not measure. It also had to be reproducible: the same sources, the same code, the same numbers.

What I built

Three parts in one repository. A Python pipeline fetches the official Parquet files and pins each one by URL, download date, size, SHA-256 and schema hash, then builds a versioned snapshot in DuckDB that is committed to Git. A FastAPI service serves only aggregates: municipality, health region, macro-region and state, with numerator, denominator, 95% confidence interval and completeness on every rate. A React interface with ECharts and MapLibre offers an overview, a choropleth map, seasonality by epidemiological week, a territorial comparator with rate ratios, and a methodology page. One Summary / Full switch, carried in the URL, changes density instead of splitting audiences into separate screens. CSV and Parquet exports carry snapshot, methodology version and source on every row.

PythonDuckDBFastAPIReactEChartsMapLibreSpec-driven
Territorial comparator: ranking with confidence intervals and a forest plot of rate ratios
Comparator: ranking with 95% intervals and a forest plot of rate ratios against a chosen reference.

Decisions

  1. Four states, never two

    Observed zero, missing data, suppressed cell and unstable estimate are different facts and get different colours and labels. A rate with a numerator under 20 is flagged unstable but still shown: hiding a small town is not more honest than marking it.

  2. The snapshot lives in Git

    The published aggregate is committed next to the code, and the deploy reads it from the repository. Every deploy served exactly one known snapshot, and rolling back a number is a git revert.

  3. Aggregates only, by construction

    The API never reads the patient-level files; it reads the snapshot. Rates are recomputed from summed numerators and denominators, and a suppressed cell removes numerator and denominator from the markup, not just from view.

Where it stands

The MVP closes its own books: a test suite checks that cases and deaths add up across the four territorial levels, that every municipality belongs to exactly one health region, and that regional rates are recomputed from sums, never averaged. End-to-end tests confirm that no API response contains an individual record field, and an axe-core audit runs in CI. The Docker image and Railway configuration are ready; the deploy itself has not been run.

How it was built

A written specification came first, with data sources, indicators, acceptance criteria and what the interface must never do. Agents executed it in phases from a CLAUDE.md and the spec; each phase ended with tests as its validation criterion, and the acceptance checklist records evidence, a commit and a measured number for every criterion. Decisions that changed the numbers (population source, instability threshold, cell suppression, map scale) are recorded as ADRs.

Plate 02Another project

Next specimen.

Plate 03The next conversation

What are webuilding next?

A new product, a system that needs to evolve, or a team with an interesting challenge. Tell me where you want to go.

Start a conversation