Building a Florida-focused 2026 Midterms Tracker with Claude's Sonnet 5.5

Words
374
Reading
2 min
2h
Listen to this post
~2 min

I want to share a concrete result from working with Claude's Sonnet 5.5 again on a real civic-data problem. The outcome is a small, runnable Flask application that tracks 2026 U.S. midterm results from three sources: The People's Tally, Open America, and—most importantly to me—the Florida Division of Elections directly. Claude did the homework, with massive design and coding. Florida was an easy case because Florida Election Watch publishes election-night results on a single, fairly stable site, and it also exposes pipe-delimited result files with fields like party code, candidate name, votes, district, and precincts reporting.

Texas is the counterexample. It can be done, but not by swapping a URL. Texas results are decentralized: the Secretary of State publishes statewide election information, while individual counties provide results through different formats and reporting systems. Open America does include Texas among its 22 state feeds, but its statewide figures do not necessarily provide district-level results. Replicating Florida's level of detail therefore means writing additional adapters and accounting for differences in geographic granularity—real engineering, not a one-line change. The same unevenness holds nationally, which is exactly why aggregators like The People's Tally and Open America exist, and why their coverage remains incomplete.

Here is the core of the Florida parser, which extracts candidate names, party codes, and vote totals from the election-night HTML:

FL_PARTIES = "REP|DEM|NPA|LPF|WRI|IND|GRE|CPF|ECO|FFP|ASP|AMF|BPP|CPP|CSV|JEF|MGT|PSL|RFM|NAT|NOP"
FL_CAND = re.compile(rf"([^|<>]+?)\s+({FL_PARTIES})\s+(\d[\d,]*)(?:\s+(\d+(?:\.\d+)?)\s*%)?")

def fl_candidates(seg: str) -> list[dict]:
    seg = FL_HEADER.split(seg, 1)[-1]
    seg = re.split(r"\bTotal\b", seg, maxsplit=1)[0]
    out = []
    for m in FL_CAND.finditer(seg):
        words = m.group(1).split()
        if len(words) > 6:
            words = words[-4:]  # fallback if table header was missed
        out.append({
            "name": " ".join(words),
            "party": party_code(m.group(2)),
            "votes": int(m.group(3).replace(",", "")),
        })
    return out

And here is how the Claude-built app merges sources without pretending to know more than it does—Florida's official count takes precedence, while calls and reporting percentages from other sources are preserved:

fl_rows, fl_status = fetch_florida()
for fr in fl_rows:
    old = merged.get(fr["race_id"])
    if old:  # Florida's official count wins; keep calls and % reporting
        old.update(
            candidates=fr["candidates"], leader=fr["leader"],
            total_votes=fr["total_votes"], source=fr["source"],
            status=fr["status"], priority=bool(old.get("priority")) or fr["priority"],
        )
    else:
        merged[fr["race_id"]] = fr

The Senate snapshot is deliberately conservative. It starts from the 53–47 baseline and only moves a seat when a race is explicitly called—no forecasting, no invented results:

def senate_snapshot(rows: list[dict], registry: dict) -> dict:
    # 2026 pre-election baseline: 53 R; 45 D + 2 independents caucusing with D.
    # Only an explicitly called result changes a seat. This is not a forecast.
    r_total, d_total = 53, 47
    changes = []
    ...
    return {
        "baseline": {"republican": 53, "democratic_caucus": 47},
        "snapshot_republican": r_total,
        "snapshot_democratic_caucus": d_total,
        "majority_threshold": 51,
        "method": "Baseline composition + seat changes with a called winner; not a projection.",
    }

The lesson, again, is not that an LLM replaces engineers. It is that an LLM can compress the distance between an idea and a testable artifact—a regex here, a cache there, a retry policy—so that more of our energy goes to judgment: what to trust, what to label unofficial, what to flag as missing. Florida rewarded that judgment because its data is quite reachable. Where a state does not, the right move is to say so: label the race no_data, cite the aggregator, and avoid pretending coverage is complete.

The full code is public and runnable:

pip install -r requirements.txt
python app.py

Building a Florida-focused 2026 Midterms Tracker with Claude's Sonn... | Ecency