Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add button to audit admin UI for downloading reported results summed by jurisdiction as CSV #1894

Merged
merged 6 commits into from
Mar 5, 2024

Conversation

arsalansufi
Copy link
Contributor

@arsalansufi arsalansufi commented Mar 4, 2024

Overview

Issue link: #1867

During previous batch audits, our audit specialists have manually downloaded every jurisdiction's candidate-totals-by-batch file, summed the numbers across batches, and prepared a summary file to compare against state-published results. A very cumbersome task 😅.

This PR builds the generation of this summary file into the product.

Before audit launch

before-launch

After audit launch

after-launch

Sample CSV before all jurisdiction files have been uploaded

Jurisdiction,Contest 1 - Choice 1,Contest 1 - Choice 2,Contest 2 - Choice 3,Contest 2 - Choice 4,Total Ballots
J1,0,0,99,1,100
J2,40,10,,,50
J3,,,,,
Total,40,10,99,1,150

Sample CSV after all jurisdiction files have been uploaded

Some entries are still blank because Contest 2 only exists in Jurisdiction 1.

Jurisdiction,Contest 1 - Choice 1,Contest 1 - Choice 2,Contest 2 - Choice 3,Contest 2 - Choice 4,Total Ballots
J1,0,0,99,1,100
J2,40,10,,,50
J3,40,10,,,50
Total,80,20,99,1,200

For single-contest batch audits, the headers don't include contest names.

Testing

  • Updated automated tests
  • Tested manually

contest_choice_csv_headers = construct_contest_choice_csv_headers(election)
csv_headers = [
"Jurisdiction",
*contest_choice_csv_headers.values(),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same note here as in #1893 (comment) re dictionaries being ordered

icon="download"
href={`/api/election/${electionId}/batch-tallies/summed-by-jurisdiction-csv`}
>
Download Reported Results
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Landed on the term "Reported Results" since that's what we call these results in the final audit report

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me

@arsalansufi arsalansufi requested a review from jonahkagan March 4, 2024 15:46
@arsalansufi arsalansufi marked this pull request as ready for review March 4, 2024 15:46
@api.route(
"/election/<election_id>/batch-tallies/summed-by-jurisdiction-csv", methods=["GET"],
)
@restrict_access([UserType.AUDIT_ADMIN, UserType.JURISDICTION_ADMIN])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can jurisdiction admins download this file? I don't think so. So I think it makes sense to remove their access

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! Copy-paste error: 931dad6

icon="download"
href={`/api/election/${electionId}/batch-tallies/summed-by-jurisdiction-csv`}
>
Download Reported Results
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me

@arsalansufi arsalansufi force-pushed the arsalan/download-reported-results branch from 816f360 to 931dad6 Compare March 5, 2024 16:52
@arsalansufi arsalansufi merged commit f09f169 into main Mar 5, 2024
5 checks passed
@arsalansufi arsalansufi deleted the arsalan/download-reported-results branch March 5, 2024 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants