Skip to content

For retrieving interest group ratings of members of Congress from Project VoteSmart

License

Notifications You must be signed in to change notification settings

shlarson/get-votesmart

Repository files navigation

get-votesmart

For retrieving interest group ratings of members of Congress from Project VoteSmart

Contents

  • Overview
  • Technologies
  • Setup

Overview

This series of programs was used to scrape votesmart.org for Special Interest Group ratings for members of the 116th U.S. Congress. Ratings are organized on VoteSmart by category, and are generally presented as a percentage score. Interest groups have been manually reviewed and coded for directional consistency, and running the programs will sort and clean the ratings accordingly. The final table will be a matrix where the Rows are members of Congress and the Columns are averaged categorical interest group ratings. The column PERSON_ID corresponds to CANDIDATE_ID from the VoteSmart API.

Technologies

Setup

Download the entire package (9 files)

  • all_sig_directions.txt
  • states_and_ids.txt
  • ratings_all.txt
  • categories_descriptions.xlsx
  • 01_get_all.py
  • 02_gen_table_direct.py
  • 03_gen_simple_table.py
  • 04_gen_adj_scores.py
  • 05_gen_final_table.py

01_get_all.py

Generates a very large database in SQLite.

Retrieves State codes from the txt file.

Uses state codes to start cycling through data retrieval. VoteSmart is set up to easily retrieve information assuming the candidate of interest is known and the user is looking for detailed information about that specific candidate. This program branches more or less by searching each state for the winners of House elections in '18 and Senate winners in '14, '16, and '18 and retrieving each candidateId. The candidateId is then used to pick out relevant variables. More information on connecting to VoteSmart can be found here.

02_gen_table.py

Generates a new database.

Retrieves 0 or 1 direction codes from txt file.

03_gen_simple_table.py

Retrieves all ratings from txt file.

This text file could be generated on your own through a simple SQL command, be sure to use vertical bars | as a value separators, not commas.

04_gen_adj_scores.py

Codes each rating to be directionally consistent according to the manually-reviewed SIGs.

Some oddities may require manual assignment. Use the categories_descriptions file to assess.

05_gen_final_table.py

Every adjusted rating will be averaged and assigned to a new table.

About

For retrieving interest group ratings of members of Congress from Project VoteSmart

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages