unitedstates / congress-legislators

Members of the United States Congress, 1789-Present, in YAML/JSON/CSV, as well as committees, presidents, and vice presidents.
Creative Commons Zero v1.0 Universal
2.07k stars 507 forks source link

`senate_class` for legislators.csv? #530

Open dannguyen opened 6 years ago

dannguyen commented 6 years ago

First of all, I love that the project now provides CSV versions of the data. The YAML has always been great but a major obstacle for non-dev types. CSV makes the data so much more accessible to folks learning data science, and for those of us who are somewhat experienced and need to look up a quick fact. Thanks for the feature!

Now my complaint :) -- could a senate_class column be added? I like doing exercises analyzing upcoming races, and having the senate_class field would make it much easier to include analysis for Senate races.

I've just discovered the CSV versions so I can poke around and make the tweak for a pull request. Wanted to see if there was a reason for not including it (maybe to keep the file/column array slim?) before giving it a go. Thanks!

JoshData commented 6 years ago

I don't think there was any particular reason it wasn't included. Let's add it!

On December 7, 2017 10:56:29 PM EST, Dan Nguyen notifications@github.com wrote:

First of all, I love that the project now provides CSV versions of the data. The YAML has always been great but a major obstacle for non-dev types. CSV makes the data so much more accessible to folks learning data science, and for those of us who are somewhat experienced and need to look up a quick fact. Thanks for the feature!

Now my complaint :) -- could a senate_class column be added? I like doing exercises analyzing upcoming races, and having the senate_class field would make it much easier to include analysis for Senate races.

I've just discovered the CSV versions so I can poke around and make the tweak for a pull request. Wanted to see if there was a reason for not including it (maybe to keep the file/column array slim?) before giving it a go. Thanks!

-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/unitedstates/congress-legislators/issues/530

-- Sent from my Android device with K-9 Mail. Please excuse my brevity.

AlJohri commented 6 years ago

hey @dannguyen did you ever get around to this? might need this too

dannguyen commented 6 years ago

Thanks for pinging me on this. I believing adding a single line -- to scripts/alternate_bulk_formats.py#generate_csv should do the trick:

    term_fields = [
    ("type", "type"),
    ("state", "state"),
    ("district", "district"),
    ("class", "senate_class"),  ## this is the line
    ("party", "party"),
    ("url", "url"),
    ("address", "address"),
    ("phone", "phone"),
    ("contact_form", "contact_form"),
    ("rss_url", "rss_url"),
    ]

I submitted the single line change as a pull request. https://github.com/unitedstates/congress-legislators/pull/551/commits/cf155b4e504cb79e2286765e40a29759602c2dc9

I'm too incompetent (and sleepy) to figure out how to run alternate_bulk_formats.py to generate the data files used in production and on the Github repo. But the legislators-current.csv file seems to be fine:

https://gist.github.com/dannguyen/501ce45467d20d7d3535bb277dfe7719

(again, sorry for being incapable for just getting the test suites and deploy scripts to run on my machine, just wanted to post what looks like the solution for anyone who needs the field ASAP)