-
Notifications
You must be signed in to change notification settings - Fork 19
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
Filter out dominion partial ballots #910
Conversation
I have verified this PR using the following processes:
To add an extra layer of comfort and security, I wrote a SQL query to count the unique round-by-round interpretations. The SQL query does this by:
SQL query: .mode box
.headers on
-- Attach both databases
ATTACH DATABASE './us-house-outstack-included.sqlite3' AS outstack_included_db;
ATTACH DATABASE './us-house-outstack-excluded.sqlite3' AS outstack_excluded_db;
-- Create a temporary view for records only in outstack_included_db
WITH unique_included_records AS (
SELECT r1."RCTab CVR Id", rbr1."Round 1", rbr1."Round 2", rbr1."Round 3"
FROM outstack_included_db.rctab_cvr r1
JOIN outstack_included_db.round_by_round rbr1
ON r1."RCTab CVR Id" = rbr1."RCTab CVR Id"
WHERE NOT EXISTS (
SELECT 1
FROM outstack_excluded_db.rctab_cvr r2
WHERE r1."RCTab CVR Id" = r2."RCTab CVR Id"
)
)
-- Count occurrences for each candidate/category across all rounds
SELECT
'Begich' as Category,
COUNT(CASE WHEN "Round 1" LIKE '%Begich%' THEN 1 END) as "Round 1 Count",
COUNT(CASE WHEN "Round 2" LIKE '%Begich%' THEN 1 END) as "Round 2 Count",
COUNT(CASE WHEN "Round 3" LIKE '%Begich%' THEN 1 END) as "Round 3 Count"
FROM unique_included_records
UNION ALL
SELECT
'Peltola',
COUNT(CASE WHEN "Round 1" LIKE '%Peltola%' THEN 1 END),
COUNT(CASE WHEN "Round 2" LIKE '%Peltola%' THEN 1 END),
COUNT(CASE WHEN "Round 3" LIKE '%Peltola%' THEN 1 END)
FROM unique_included_records
UNION ALL
SELECT
'Howe',
COUNT(CASE WHEN "Round 1" LIKE '%Howe%' THEN 1 END),
COUNT(CASE WHEN "Round 2" LIKE '%Howe%' THEN 1 END),
COUNT(CASE WHEN "Round 3" LIKE '%Howe%' THEN 1 END)
FROM unique_included_records
UNION ALL
SELECT
'Hafner',
COUNT(CASE WHEN "Round 1" LIKE '%Hafner%' THEN 1 END),
COUNT(CASE WHEN "Round 2" LIKE '%Hafner%' THEN 1 END),
COUNT(CASE WHEN "Round 3" LIKE '%Hafner%' THEN 1 END)
FROM unique_included_records
UNION ALL
SELECT
'Overvotes',
COUNT(CASE WHEN "Round 1" LIKE '%Overvotes%' THEN 1 END),
COUNT(CASE WHEN "Round 2" LIKE '%Overvotes%' THEN 1 END),
COUNT(CASE WHEN "Round 3" LIKE '%Overvotes%' THEN 1 END)
FROM unique_included_records
UNION ALL
SELECT
'Skipped Rankings',
COUNT(CASE WHEN "Round 1" LIKE '%Skipped Rankings%' THEN 1 END),
COUNT(CASE WHEN "Round 2" LIKE '%Skipped Rankings%' THEN 1 END),
COUNT(CASE WHEN "Round 3" LIKE '%Skipped Rankings%' THEN 1 END)
FROM unique_included_records
UNION ALL
SELECT
'Exhausted Choices',
COUNT(CASE WHEN "Round 1" LIKE '%Exhausted Choices%' THEN 1 END),
COUNT(CASE WHEN "Round 2" LIKE '%Exhausted Choices%' THEN 1 END),
COUNT(CASE WHEN "Round 3" LIKE '%Exhausted Choices%' THEN 1 END)
FROM unique_included_records
UNION ALL
SELECT
'Did Not Rank',
COUNT(CASE WHEN "Round 1" LIKE '%Did Not Rank%' THEN 1 END),
COUNT(CASE WHEN "Round 2" LIKE '%Did Not Rank%' THEN 1 END),
COUNT(CASE WHEN "Round 3" LIKE '%Did Not Rank%' THEN 1 END)
FROM unique_included_records;
-- Detach databases when done
DETACH DATABASE outstack_included_db;
DETACH DATABASE outstack_excluded_db; I then did a little sanity check on that by using the Python interpreter to: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Closes #909
Confirmed that I get the same results as expected (+2 to +9 relative to the certified results, as explained elsewhere)
Adds tests that confirm this behavior, as no previous test did. Used a random selection of CVR files from the Alaska election which contain partial ballots.