nprapps / elections24-primaries

2024 primary/caucus election results
https://apps.npr.org/primary-election-results-2024/
Other
5 stars 1 forks source link

Missouri counties with no results showing up as Biden wins #160

Closed alykat closed 7 months ago

alykat commented 7 months ago

On the Missouri Dem primary county-level results, there are a few counties that have reported 0 results but Biden is flagged as the winner: https://apps.npr.org/primary-election-results-2024/states/MO.html#date=3%2F23%2F2024&office=P&party=Dem&counties=true&state

image

Confirming that I see zero results for one of these counties in AP Newsroom as well:

image

Typically, we'd expect to show no data / no winner flag for counties with no votes reported.

alykat commented 7 months ago

Notes from looking at a few examples:

Looking at the county-level data we're generating, for Sullivan County, I see a winner flag for Biden and 0 votes:

image

Looking at the actual API response for that county, I see a winner flag for Biden:

image

But the winner timestamp for the county is the same as the winner timestamp for the state overall.

Then I looked at Kansas, where Biden won overall, but "None of the names shown" won 3 counties.

In AP's data, looking at Rawlins County, they mark Biden as the winner (carrying through the overall state call), even though "None of the names shown" had more votes in that particular county.

image

Our processed county-level data does the same thing:

image

Yet on the results table itself for the county, we have a checkmark shown for "None of the names shown":

image

So the logic to designate a county-level winner must be happening within the county-detail and county-map components?

alykat commented 7 months ago

Looking at county-detail, I think the winner assignment is happening here:

https://github.com/nprapps/elections24-primaries/blob/main/src/js/components/county-detail/index.js#L116-L124

If we're at 100% reporting in a county, the top vote-getter is flagged as the winner. So in the case of Sullivan County, MO, the flag happened b/c it was at 100% reporting — but we need to add an additional check for whether that top vote-getter has any results.

Separately, the Rawlins County, KS, example from above reveals a mismatch between EEVP and reportingPercentage: We're displaying a winner checkmark based on reportingPercentage (100%), but since we have EEVP (90%), we should be going based on that. I'll spin that out into a separate ticket.