votingworks / arlo

GNU Affero General Public License v3.0
141 stars 25 forks source link

Implement contest choice name standardization flow #1948

Closed arsalansufi closed 3 months ago

arsalansufi commented 3 months ago

Overview

Issue link: https://github.com/votingworks/arlo/issues/1917

This PR implements a contest choice name standardization flow that mirrors our existing contest name standardization flow!

We long ago made the assumption that, though contest names can vary across jurisdictions, choice names would not. That assumption has since been proven wrong, notably in Nevada and Washington. The new flow allows you to add choice names to your standardized contests file and map CVR choice names to those standardized choice names.

The new "Choice Names" column in the standardized contests file isn't required. If you don't include it, we'll still try to detect and warn you when contest choice names are inconsistent across jurisdictions, per existing logic. Main change to that existing warning is that it'll now suggest adding choice names to your standardized contests file as a workaround. I didn't want to require the new column because it might actually be a hindrance for some users. I'm thinking of OC, who audits many contests and has only one jurisdiction.

Note that contest name standardization does affect contest choice name standardization. We don't explicitly block contest choice name standardization on contest name standardization. You can start standardizing choice names before you standardize contest names. It just may be that standardizing contest names surfaces more choice names to be standardized.

Sample standardized contests file with choice names

We're using slashes as separators within the "Choice Names" field instead of commas since individual choice names may contain commas.

Contest Name,Jurisdictions,Choice Names
State Treasurer,all,"Conine, Zach/Elliott, Bryan/Fiore, Michele/Hendrickson, Margaret/None of These Candidates"

The template standardized contests file is unchanged and doesn't include the new column.

Screencaptures and screenshots

End-to-end, before adding choice names to the standardized contests file, after adding choice names to the standardized contests file, and through contest choice name standardization

https://github.com/votingworks/arlo/assets/12616928/8bc014f8-121c-46a7-a53f-e26392c560c3


Getting started on contest choice name standardization before contest name standardization, completing contest name standardization, and revisiting contest choice name standardization

https://github.com/votingworks/arlo/assets/12616928/0e20aea3-854f-44a6-bc57-76171d349bf5


Completion of contest name standardization surfacing contest choice name standardization

https://github.com/votingworks/arlo/assets/12616928/dd3fd8bd-2191-4422-bf75-a592c67b2517


Side-by-side of contest name and contest choice name standardization dialogs

contest-names contest-choice-names

Testing

Punted on new tests in this PR as it's large enough as is, and I wanted to get this reviewed while I work on tests in a follow-up PR. Also wanted to get Jonah's eyes on this core logic today, whereas I can have someone else review tests tomorrow when he's out.