Project case study
Pharos
A public map and analysis of US county suicide rates and the conditions around them, built to show what the data can and cannot say.
- Role
- Designer and sole developer
- Status
- Live
- Timeline
- July 2026 to present
- Evidence
- Suicide rates for 3,142 counties from 2019 to 2024, with hot spots, county trends and uncertainty intervals where the source publishes them.
- Evidence
- A model of county suicide rates that explains 56% of the variation in counties it has never seen, measured on November 15, 2026.
- Evidence
- 444 unit tests and 10 database integration tests passed on November 16, 2026.
Topics

Pharos is a public map of suicide rates in every US county, with the conditions around them: income, health care access, firearm laws, climate, social ties and about 150 other measures from public sources. I built it to make county suicide data easier to explore without overstating what it shows. Every rate that is too uncertain to show is marked instead of drawn, and every analysis says what it can and cannot support.
If you or someone you know is struggling, call or text 988 or chat at 988lifeline.org. It is free, confidential and available every hour of the day.
The problem
County suicide data is public, but it is scattered across federal agencies, published in different forms, and easy to misread. Some sources give crude rates, some age-adjusted. Some pool several years. Small counties have a handful of deaths, so their rates jump from year to year, and agencies suppress or model them. A map that colors every county by its latest number makes noise look like signal and invites the kind of “worst county” ranking that safe-messaging guidance warns against.
My role
I designed and built Pharos on my own: the data pipeline, the database, the statistics and models, the API, the map and the deployment. The data comes from public agencies and research groups, credited on the site.
How it works
Pharos pulls from more than 40 public sources: CDC, County Health Rankings, IHME, the Census Bureau, BLS, NOAA, HRSA, USDA, RAND and others. Each source has its own importer that records where its data came from, maps old county codes to current ones and logs anything it cannot place instead of dropping it silently. Everything lands in PostgreSQL with PostGIS, keyed by county and year.
The main outcome is CDC’s annual suicide-only county rates for 2019 to 2024. Two other series sit beside it: County Health Rankings’ pooled rates, and IHME’s 2000 to 2019 estimates, kept for their longer history even though they combine suicide with homicide. The site treats these as separate series, because they differ in what they count and what their year means.
On top of the data:
- Display rules. Rates based on fewer than 20 deaths are shown as insufficient data, never as a color. Suppressed counties are unknown, not zero.
- Hot spots. Moran’s I, LISA and Getis-Ord Gi* find counties that cluster with neighbors of similar rates, with false-discovery-rate correction across about 2,900 tests a year.
- Age standardization. CDC publishes only crude county rates, so Pharos computes an age-standardized rate from each county’s age mix and national rates by age group.
- Model. XGBoost with SHAP breaks a county’s predicted rate into the contributions of each measure, with flags on measures that move together and so share credit unreliably.
The API is FastAPI with a Redis cache, and the map is MapLibre GL. It runs on Railway, with a weekly off-site database backup and an uptime check in GitHub Actions.

Selecting a county opens its rate, the interval around it where the source publishes one, its age-standardized rate, and a trend line where masked years show as gaps. For counties large enough to be in the model, it also shows the model’s breakdown.

Key decisions
- Mark uncertainty instead of hiding it. Insufficient-data counties get their own pattern, intervals appear where the source publishes them, and a data gaps page lists every missing year and covariate.
- No rankings. The API returns counties keyed by code, never sorted by rate, and the site has no “worst counties” list. The 988 Lifeline is on every page that shows suicide data.
- Suicide-only data first. The site originally opened on IHME’s longer series, which includes homicide. It now opens on CDC’s suicide-only rates and runs its analyses on them.
- Score the model honestly. Checking the model in November 2026 turned up three problems, each of which made it look better than it was. More than half its training rows were CDC’s own modeled estimates. Random test splits let it recognize counties it had already seen. Filtering out small counties by their death counts taught it that small counties have high rates. The fixes cut its score from an apparent 0.81 to 0.56, and the methodology page records each step.

Results
- Coverage: 3,142 counties, three outcome series and about 150 covariates. Counties with a usable rate each year are listed on the data gaps page.
- Clustering: measured November 15, 2026. County suicide rates cluster geographically every year from 2019 to 2024, with Moran’s I between 0.26 and 0.29. Between 31 and 135 counties a year are significant hot or cold spots after correction.
- Model: measured November 15, 2026, on 4,627 county-years from counties expected to have at least 10 suicides a year. Holding out whole counties, the model explains 56% of the variation (R² 0.56 ± 0.03). Its largest contributions come from the share of adults divorced or separated, state firearm-law restrictiveness and elevation.
- Age standardization: age structure turned out to matter little. Across counties the age-standardized rate correlates 0.995 with the crude rate, because adult suicide rates are fairly flat by age nationally.
- Tests: on November 16, 2026, 444 unit tests and 10 integration tests against a real PostGIS database passed.
What went wrong
The off-site database backup failed every week from October 8 to November 15, 2026, and I did not notice until I tested it by hand: the storage keys had changed. Railway’s own daily backups were still running, so no data was at risk, but a backup nobody checks is not much of a backup. The keys are fixed and the backup runs again. A failed run now opens a GitHub issue that stays open until the next good backup closes it, which I tested with a simulated failure on November 16, 2026.
Limits and next steps
Pharos describes counties, not people. A county trait that goes with higher suicide rates is not a cause, and nothing here says anything about an individual. The CDC series covers only 2019 to 2024, so long-term trends still lean on IHME’s combined series. The model covers larger counties only, because small counties’ rates are too noisy or are themselves estimates.
Next: more of the sources on the project roadmap that already have verified downloads but no importer yet.
Links
Data: CDC National Vital Statistics System via CDC WONDER and the Mapping Injury, Overdose, and Violence dashboard; County Health Rankings & Roadmaps; IHME Global Health Data Exchange; US Census Bureau; and the other sources credited on the site.