Inspiration

Having being raised in Southeast Asia, dengue has been a childhood fear of mine. While cases and breeding sites have been managed better nowadays, a severe lack of manpower still persists to the point where it is still tough to keep up with cases.

In Brazil inspectors are municipal staff, and hiring has stalled: reports on 2023 found a net gain of about 800 agents, against more than 4,000 the year before. So every week a coordinator has to choose which towns get the hours.

Surveillance systems already tell you where transmission is rising. I wanted to build the step after that: the decision about how to spend scarce hours, with a reason for every choice, a person who approves it, and a way to check whether the decision is any good.

What it does

Vigia takes real weekly dengue data for the 399 municipalities of Paraná, Brazil, and proposes where to send a fixed number of inspection teams. The week it plans for looks at the cases expected over the next four weeks.

  • A map you can read. Towns are tinted by expected cases. Hatching marks every town the plan sends inspectors to, denser meaning more of a full inspection is funded, and a road line runs from the regional health office a team starts from to the town.
  • A reason for every decision. Click a town for a plain explanation and a forecast range. Pin a town in or out, and the plan re-solves in well under a second.
  • A person approves. Changing anything withdraws the approval, and every decision goes in an audit log.
  • Play the week. The approved plan runs hour by hour: each team leaves its regional office, drives the road, works its hours and drives back. Each trip also produces the short message a team would receive. With a small local helper, those go to a real Telegram chat while it plays. The web page itself sends nothing.
  • Any past week. Pick a week and the planner behaves as if it were that week, then shows how much of what really happened the plan covered.

How I built it

  • Data. The public InfoDengue API (weekly cases, temperature and humidity for every municipality) and IBGE boundaries, pulled by scripts in the repo.
  • The planner. A mixed-integer linear program solved exactly by HiGHS compiled to WebAssembly, running in the browser. For each municipality i we know the expected cases w_i, the hours for a full inspection n_i and the round-trip drive d_i, and there is a budget B of team-hours. The plan chooses the hours on site h_i and whether the town is visited at all, y_i:

$$\max \sum_i \frac{w_i}{n_i}\, h_i \quad \text{s.t.} \quad \sum_i \left(h_i + d_i\, y_i\right) \le B,\qquad m\, y_i \le h_i \le n_i\, y_i,\quad y_i \in {0,1}$$

In words: y_i is 1 if the town is visited and 0 if not, and m is the shortest worthwhile visit. Drive times come from OpenStreetMap road routing from the nearest of Paraná's 22 regional health offices. We tested the solver against trying every combination on 80 random small instances, and it matches to six decimals.

  • The forecast. A LightGBM model in Python on 39 inputs built from case history, neighbouring towns, the micro-region, the state and the season. I picked it once on 2023 among ten candidates and froze it, then refitted it for each of 2024, 2025 and 2026 using only what was known before that year, so every test year is out of sample. Forecasts ship as a data file, so the app needs no model at run time.
  • The front end. React, TypeScript and Vite, with a hand-built SVG map. No backend, so it runs from a static site.

Results

Replayed 146 real weeks, from 2024 to SE 41/2026. Each week the planner saw only the data up to that week and was scored on the next four. With 3,200 team-hours, about 11% of what inspecting everything in full would take:

Strategy Share of real cases in towns the plan inspects
Even split of the same hours 10.8%
Vigia 36.0%
Perfect foresight (the ceiling) 38.1%

That is about three times an even split and within about two points of the best result these hours could reach even knowing the future. It measures where the cases were, not cases prevented.

Challenges

  • The first forecaster lost to a trivial baseline. A ridge regression with climate did worse than assuming the next month looks like this week. Read what works in the dengue forecasting literature, built a gradient-boosted model on much richer case-history features, and tested ten variants. Weather did not help, which matches published findings. The final model is a clearly better forecaster in every year, with 18 to 23% lower error than the baseline, but it moves the plan's coverage by only 0.2 to 0.9 points, because last week's counts are already close to perfect foresight.

What was learned

A good-looking forecast is not the point. On this data, deciding what to do with the hours mattered far more than predicting the next month better, and an honest "this did not beat the baseline" is more useful to a coordinator than a clever model they cannot trust.

What's next

  • Validate with real vector-control teams, including what an inspection actually achieves, which this data cannot say.
  • Use real-time data vintages, since the latest weeks arrive incomplete in practice.
  • Replace the assumed inspection effort and travel speed with real figures, and add block-level targeting inside a municipality.
  • Extend to other states.

Limits

It does not know whether inspecting a municipality prevents cases. It covers one state, and 2024 was a large epidemic year. Team counts, hours per team, inspection effort and travel speed are assumptions. The hour-by-hour schedule is a simple greedy packing, an illustration and not an optimal dispatch. It has not been validated with any health authority.

Built With

Share this project:

Updates

Submission history