This repository contains a flask app which managed processes for VIP QA and DECC through the 2014 Election. VIP-specific scripts are stored in the vip folder, and decc-specific scripts are stored in the decc folder. Each folder, except app, contains its own README detailing the included scripts.
##For this app to run, the following environment variables must be defined:
###For DECC:
+*DECCINPUT:* the directory to use to input to decc scripts
+*DECCOUTPUT:* the directory to output decc files after processing
+*PGHOST:* the URL or IP of the DECC database server
+*PGUSER:* the username to connect to the DECC database
+*PGPASSWORD:* the password associated with PGUSER
+*PGDB:* the DECC database name
###For VIP QA:
+*GOOGLE_NATIVE_APP_CLIENT_ID:* The client ID associated with the VIP QA app
+*GOOGLE_NATIVE_APP_CLIENT_SECRET:* The client secret associated with the VIP QA app
+*GOOGLE_PUBLIC_API_KEY:* The API key used to query the Google civicInfo API
+*GOOGLE_GEOCODE_API_KEY:* The API key used to query the Google geocode API
+*VIPQADATA:* The directory containing TargetSmart PII spreadsheets used to QA election-day voting sites
+*EVIPQADATA:* The directory containing TargetSmart PII spreadsheets used to QA early voting sites
This folder contains the scripts which QA early and election-day voting sites. Each of the scripts are summarized below.
+*readData.py* contains a very simple function (read()) which accepts a directory and a state abbreviation. Reads in a csv named {state abbreviation}.csv from the provided directory.
+*civicInfo.py* interacts with the Google CivicInfo API. Contains 3 functions.
..+ *getVoterInfo()* returns a decoded json object for the provided address string and electionID, by default the electionID is set to 4100-the 2014 General Election.
..+ *getVIPValues()* accepts the object provided by getVoterInfo() and returns the election day polling location details.
..+ *getEVValue()* accepts the object provided by getVoterInfo() and returns the early-vote polling location details.
+*sheets.py* interacts with the Google Drive and Spreadsheets API's includes functions which can be used to copy a Google Sheet and then write rows to it.
..+ *getService()* accepts as arguments the service name, version, and credential object. It creates and authorizes a service which can be used with the Google API client library
..+ *copySheet()* accepts as arguments a sheet name, an original sheet key, and a credentials object. It uses the Google API client library (and calls getService()) to copy a sheet template.
..+ *getClient()* creates a gData spreadsheets client and authorizes it using stored credentials (created in app/views.py)
..+ *convertRow()* accepts a dictionary with row values. It replaces the keys in the dictionary with lower-case, spaceless versions of themselves.
..+ *writeRow()* accepts a dictionary with row values, a gdata client, a sheetKey, and sheetID (sheet within the google spreadsheet). It converts the input dictionary using convertRow() and then writes it to the sheet provided.
+*geocode.py* geocodes and finds the distance between address strings.
..+ *geocode()* accepts a string containing an address and returns a dictionary with the latitude (lat) and longitude (lng) of the best match for that address.
..+ *haversine()* accepts two location dictionaries and returns the haversine distance (in miles) between them.
+ The scripts named *{state abbreviation}.py* each have a different structure based on the state on which they work. The unifying factor is a function titled *run()* which accepts a row dictionary from the TargetSmart data and returns the Polling Place ID, name, and address.
+*execute.py* calls all of the other scripts in this folder to read and process VIP QA data.
..+ *getRowData()* accepts a row dictionary from TargetSmart data, and returns an address string and county which can be used to query the civicInfo API.
..+ *VIP()* accepts a state abbreviation and credentials object which reads in that state's TargetSmart data, creates a Google Spreadsheet, and then iterates over the data to query the civicInfo API, query the state lookup tool, and write the returned data to the new Google Spreadsheet.
..+ *EVIP()*: accepts a state abbreviation, a credentials object, and a boolean indicating whether to run 25 or 50 rows. This function reads in state Data, creates a google spreadsheet, and then iterates over rows querying the Google CivicInfo API and writing returned data to the new spreadsheet. No SOS tools were created for EV data.
ProTip!
Use n and p to navigate between commits in a pull request.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.
We use optional third-party analytics cookies to understand how you use GitHub.com so we can build better products.
Learn more.
We use optional third-party analytics cookies to understand how you use GitHub.com so we can build better products.
You can always update your selection by clicking Cookie Preferences at the bottom of the page.
For more information, see our Privacy Statement.
Essential cookies
We use essential cookies to perform essential website functions, e.g. they're used to log you in.
Learn more
Always active
Analytics cookies
We use analytics cookies to understand how you use our websites so we can make them better, e.g. they're used to gather information about the pages you visit and how many clicks you need to accomplish a task.
Learn more
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
update fork #1
update fork #1
Changes from 1 commit
cf756ade2ae14c7feb5d1c3ab935793d9d05c0c2499ce5e911954e3d33a00bab423d6ff9ff8aebca3d69ab0fc85281d815b29539084b636600cf8a9a78a2c2dd55a38febb6ee1850308e454840bcacd7353d7262884de3740804991d17422798bfea5bb654481fd1c9ee2d7fcf305d0a6fa1e9564d696ac2c823fFile filter...
Jump to…
add main and VIP readmes