What PyQual is and Why It Exists
Throughout the years Vote Smartians have written lots of quality control queries. We decided that some of those queries should be run on a regular basis. This is basically what PyQual is - a list of queries that are set up to automatically run on a daily, weekly, or monthly basis. More specifically, they are Sequel (SQL) queries wrapped in python.

How Results Are Delivered and Who They Go To
The results of those queries are set up to automatically be emailed in spreadsheet format to designated recipients. For example, on a weekly basis the results of the "SIGs without categories" query can be sent to both the Elections Research Director and a Research Associate in SIGs. The Research Directors designate who receives what results using this tool. If you have permissions, please do not alter who receives what results unless you are a Research Director.

What To Do With Results Once You Receive Them
If PyQual is working properly and you are designated to receive query results, then you should be periodically receiving emails with spreadsheet attachments. If there are no errors, the spreadsheet will be empty. Those spreadsheets contain lists of errors (query results). It's your job to find those errors in the database and fix them. For example, if you're in Speeches, you may receive the "Future Speeches" query results. This will be a spreadsheet full of speeches that have speechdates later than today, which is obviously not possible. It's your job to correct those errors. In this example, you would do research to find the correct speechdate, then fix the error in Admin. It's usually not a pressing matter to fix these errors, so don't worry about getting to them immediately if you have more important things to take care of. If appropriate, don't hesitate to delegate the task of fixing these errors to interns.

The List of Tests
Test IDTest NameProgramFrequencyResults
10Multiple Candidates In CongstatusKey VotesDailyCandidates that voted twice on same bill (multiple congstatus_id's)
14Orphan RatingsSIGsWeeklyRatings not associated with a candidate (no rating_candidate_id)
25Missing Left OfficeBiosWeeklyFederal and state candidates who have left office (inactive or resigned) but have no term-end date
17Missing submitted additional bio dataIssue PositionsWeeklyCandidates that have submitted candidate submitted bios, but whose bios have not been added into admin
26No synopsis after 6 monthsKey VotesWeeklyBills that are more than 6 months old and have no synopsis
22Officials Missing DatesBiosWeeklyElected officials without a lastelect, firstelect, or nextelect date
5Orphan Candidate CheckBiosWeeklyCandidates that have no associated office (office_candidate_id) and no associated election (election_candidate_id)
21Notable ContactsIssue PositionsWeeklyCandidates we have contacted 8 or more days ago and have been marked as notable
12Orphan SIGsSIGsWeeklySIGs that have no associated rating (rating_id) and no associated endorsement (endorse_id)
24Bad Next ElectElections MonitoringMonthlyCandidates whose nextelect date is prior to now
11Elections Without StagesElections MonitoringWeeklyElections without an electionstage
7KV Without StatusesKey VotesWeeklyBills without statuses (missing congstatus_id)
27SIGs without categoriesSIGsWeeklySIGs that have not been assigned categories
13Orphan OfficesBiosWeeklyOffices that have no associated candidates (no office_candidate_id and no election_candidate_id)
6Unreleased Election ResultsElections MonitoringDailyElections that have occurred but have no live results
9Future StatusesKey VotesDailyBills that have a status in the future
19Ratings without categoriesSIGsWeeklyRatings that have not been assigned categories
8Missing Finance IDsCampaign FinanceDailyCandidates from this year's election cycle without campaign finance information (no finsource_candidate_id)
23Missing Term Start After ElectionBiosMonthlyCandidates who have won a general election more than six months ago and still lack a termstart date
16Candidates missing ballotnameBiosWeeklyCandidates in elections post 2012 that have no ballotname
30Unreleased EndorsementsSIGsMonthlyEndorsements collected between 30 and 60 days ago and are not released live
33Unreleased RatingsSIGsMonthlyRatings created within the last thirty days and are not released live
34Unreleased SIGs with ContentSIGsMonthlyUnreleased SIGs with a released rating or endorsement
35Future SpeechesSpeechesWeeklySpeeches with a speechdate later than today
32Non-Percentage RatingsSIGsWeeklyRatings created within the past week that use SIG rating (not our rating), and the rating format is not numeric
31Blank RatingsSIGsWeeklyRatings created more than a week ago that either use ourrating and ourrating is null or use sigrating and sigrating is null
29Duplicate Candidate CheckBiosMonthlyFinds candidates with the same firstname and lastname but have different candidate_ids
15Candidate Election stage party assignmentBiosWeeklyFederal or state officials elected post 2012 that have no party affiliation in their election (no electionstage_candidate_party_id)
18Candidate missing stages for electionBiosDailyCandidates from 2007 and up that are not listed as in an election stage (no electionstage_candidate_id)
28Unreleased ElectionsElections MonitoringDailyElections that occurred a week or more ago and are unreleased

Finding the Queries
The queries can be found in the drive. Path: Research > Active > Department Management for Directors > QC > pyqual Queries. They can also be found in the recipient tool mentioned above. Again, please do not alter anything unless you are a Research Director.

PyQual in its Current State (October 2016)
As of October 2016, query results are generally not being sent via email due to some sort of error. Mike Shultz, our IT Director, is aware of this and is okay with being bugged to fix this system and periodically being asked to manually force those emails to be sent. The Research Director and IT Director should keep on top of this project and not let it get lost in the abyss of Vote Smart. The program is very useful and should be continued.
There is one comment on this page. [Display comment]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki