Public health / SQL + Power BI

    Seeing an outbreak in the sewer before it hits the clinic

    Wastewater surveillance program | SQL + Power BI, normalized signals and trend analysis

    Locations, organizations, site names, and numbers on this page are invented. Virus and marker names are standard public health terms, so those stay.

    The Problem

    The lab results came back as spreadsheets. Each row had a genetic marker count for a sample taken somewhere in the sewer system, and on its own that number did not tell you much. Heavy rain or grey water getting into the lines dilutes a sample, so the count drops even when nothing in the community actually changed. A dry week does the opposite and pushes the count up. That made the files hard to use, because nobody could open one and say plainly which areas were getting worse and which were fine.

    The Solution

    The fix was to measure the dilution instead of guessing at it. Every sample is also tested for PMMoV, the pepper mild mottle virus, which shows up in human waste at a fairly steady rate whether people are sick or not. That makes it a good reference for how watered down a sample is. Dividing each virus count by that sample's PMMoV level takes most of the rain and flow effects out of the numbers, so results from different sites and different days could finally be compared side by side.

    In a second round of the project I expanded the panel beyond COVID to the other viruses the lab was already testing for, so one report covered the full respiratory and gastrointestinal picture instead of a single virus.

    I also added trend analysis, which ended up being the most useful part. A single reading tells you the level on one day, but not which direction things are moving. The report takes the 14 days ending on whatever date you select, compares them with the 14 days before that, and color codes each site by how much it rose or fell. Move the date and the whole map recolors, so you could spot a problem a week or two before it showed up anywhere else.

    Try the trend map

    This is a small working version of the same report, built on invented data for an invented region. Pick a virus, move the date slider, and click a site to see its history. Switch over to raw counts and you can see how much the rain effect was hiding.

    Measure
    Trend end date2026-02-13 to 2026-02-27

    Every trend below is the 14 days ending on this date, compared with the 14 days before it.

    Sites in view
    28
    Rising
    14
    Falling
    12
    Flat
    2
    RID18 Ridge Lift Station · Willowbrook Communities · Rising fast (+2.15)QUA17 Quarry Interceptor · Maple Ridge Care · Rising fast (+1.47)ORC15 Orchard North Trunk · Northfield College · Rising fast (+1.33)PIN16 Pine Plant · State Prairie University · Rising fast (+1.04)IRO09 Iron Campus Line · Granite Valley DPH · Rising fast (+1.03)YAR24 Yarrow Campus Line · Lakewind Utilities · Rising fast (+1.01)BIR02 Birch Interceptor · North Ridge County Health · Rising fast (+0.94)CED03 Cedar Lift Station · Harbor Bluff Water · Rising fast (+0.93)FER06 Fern Plant · State Prairie University · Rising fast (+0.84)ELM05 Elm North Trunk · Northfield College · Rising fast (+0.74)COV27 Cove Interceptor · Maple Ridge Care · Rising fast (+0.64)LAR12 Larch Interceptor · North Ridge County Health · Rising (+0.51)VAL22 Vale Interceptor · North Ridge County Health · Rising (+0.47)DEL28 Dell Lift Station · Willowbrook Communities · Rising (+0.24)MAP13 Maple Lift Station · Harbor Bluff Water · Flat (+0.04)HAR08 Harbor Lift Station · Willowbrook Communities · Flat (-0.18)DUN04 Dune Campus Line · Lakewind Utilities · Falling (-0.2)ASH01 Ash Plant · Cedar Valley DPH · Falling (-0.22)ASP25 Aspen North Trunk · Northfield College · Falling (-0.25)JUN10 Juniper North Trunk · Silver Creek Utilities · Falling (-0.36)THI20 Thistle North Trunk · Silver Creek Utilities · Falling (-0.36)GRO07 Grove Interceptor · Maple Ridge Care · Falling fast (-0.6)WIL23 Willow Lift Station · Harbor Bluff Water · Falling fast (-0.65)UNI21 Union Plant · Cedar Valley DPH · Falling fast (-0.72)NOR14 North Campus Line · Lakewind Utilities · Falling fast (-0.79)BRA26 Bramble Plant · State Prairie University · Falling fast (-0.9)STO19 Stone Campus Line · Granite Valley DPH · Falling fast (-1.13)KET11 Kettle Plant · Cedar Valley DPH · Falling fast (-1.22)
    Rising Flat FallingBubble size is the 14 day average level. Click a site to see its detail.
    SiteTrendLevel
    Willowbrook Communities
    +2.15718
    Maple Ridge Care
    +1.47721
    Northfield College
    +1.334,359
    State Prairie University
    +1.044,769
    Granite Valley DPH
    +1.03368
    Lakewind Utilities
    +1.011,097
    North Ridge County Health
    +0.94480
    Harbor Bluff Water
    +0.93450
    State Prairie University
    +0.841,633
    Northfield College
    +0.742,268
    Maple Ridge Care
    +0.64288
    North Ridge County Health
    +0.519,759
    North Ridge County Health
    +0.471,360
    Willowbrook Communities
    +0.244,009
    Harbor Bluff Water
    +0.044,518
    Willowbrook Communities
    -0.181,412
    Lakewind Utilities
    -0.202,096
    Cedar Valley DPH
    -0.22318
    Northfield College
    -0.251,165
    Silver Creek Utilities
    -0.361,886
    Silver Creek Utilities
    -0.36930
    Maple Ridge Care
    -0.60651
    Harbor Bluff Water
    -0.651,250
    Cedar Valley DPH
    -0.721,556
    Lakewind Utilities
    -0.79747
    State Prairie University
    -0.90300
    Granite Valley DPH
    -1.13189
    Cedar Valley DPH
    -1.22385

    Illustrative data only. 28 invented sites across 10 invented organizations, generated in code. Virus and marker names are standard public health terms.

    The Results

    Cities, counties, universities, and nursing homes could open the map in the morning and see right away where cases were likely to rise. A university could watch the trend for its own residence halls. A county could tell whether an increase was limited to one neighborhood or spread across the whole area. Nursing homes could time their visitor precautions to the local numbers instead of the news. The sampling was already happening before I got involved. The report just turned it into something people could act on the same day they looked at it.

    Sitting on data that should be an early warning? Start with a Reverse Solution diagnostic.

    Start the Conversation