/new-leaders-api

Primary LanguageRubyMIT LicenseMIT

Getting Started as a New Developer

  1. Check out the code base
  2. Install postgres on OSX if its not already there.
  3. Create the postgres user if it doesn't exist: /usr/local/Cellar/postgresql/9.6.3/bin/createuser -s postgres
  4. Create the database: bundle exec rake db:create
  5. Migrate the database to the table structure: bundle exec rake db:migrate
  6. Import the state data with: bundle exec rake know_who:import_states --trace
  7. Export a month directory like this: export KNOW_WHO_MONTH=~/fuzzygroup/consulting/new-leaders-api/spec/fixtures/leaders/2012-12 (adjust to your own directory structure -or- the month you want to load)
  8. Load the leader data with: bundle exec rake know_who:import_month --trace

new-leaders-api

Serving up current congressional leaders for all 50 States on both the US and State level.

== Examples

=== Both Senators from Texas

/v1/states/tx/leaders/us_senate

[
  {"id":337,"slug":"us-sen-john-cornyn","name":"John Cornyn","title":"US Senator","photo_src":"http://publicservantsprayer.org/photos/FL/S//Cornyn_John_211675.jpg","prefix_name":"US Sen. John Cornyn","resource_path":"/v1/leaders/us-sen-john-cornyn","state_code":"tx","born_on":null,"district":"S02","residence":"San Antonio, TX","spouse":"Sandra Hansen","family":"2 children"},
  {"id":522,"slug":"us-sen-kay-hutchison","name":"Kay Hutchison","title":"US Senator","photo_src":"http://publicservantsprayer.org/photos/FL/S//Hutchison_Kay_165278.jpg","prefix_name":"US Sen. Kay Hutchison","resource_path":"/v1/leaders/us-sen-kay-hutchison","state_code":"tx","born_on":null,"district":"S01","residence":"Dallas, TX","spouse":"Ray Hutchinson","family":"4 children"}
]

=== All leaders in Texas:

/v1/states/tx/leaders

=== Other chambers:

/v1/states/tx/leaders/us_house

/v1/states/tx/leaders/state_senate

/v1/states/tx/leaders/state_house

=== Individuals can be found via their slug:

/v1/leaders/us-rep-ron-paul

{"id":264,"slug":"us-rep-ron-paul","name":"Ron Paul","title":"US Representative","photo_src":"http://publicservantsprayer.org/photos/FL/H/Paul_Ron_159084.jpg","prefix_name":"US Rep. Ron Paul","resource_path":"/v1/leaders/us-rep-ron-paul","state_code":"tx","born_on":null,"district":"14","residence":"Lake Jackson, TX","spouse":"Carol Wells","family":"5 children; 18 grandchildren"}

need this??

From the Know Who DB

def legacy_fields

["UID","PID","LEGTYPE","CHAMBER","CHAMBERANK","STATECODE","STATE","DISTRICT","DISTRAIL","DISTYPE","PARTYRANK","PERCENTVOT","ELECTDATE","REELECTYR","ELECTCODE","FECLINK","PYRACUSC","CYRACUSC","PYRADASC","CYRADASC","PYRAFLSC","CYRAFLSC","PYRUSCOSC","CYRUSCOSC","SEATSTCODE","SEATSTAT","DISTRICTID","SEATID","PARTYCODE","FIRSTNAME","LASTNAME","MIDNAME","NICKNAME","PREFIX","GENSUFFIX","TITLE","PROFSUFFIX","GENDER","LEGALNAME","PRONUNCTON","BIRTHPLACE","BIRTHYEAR","BIRTHMONTH","BIRTHDATE","MARITAL","SPOUSE","RESIDENCE","FAMILY","RELIGCODE","RELIGION","ETHCODE","ETHNICS","REOFC1","REOFC1DATE","REOFC2","REOFC2DATE","RECOCCODE1","RECENTOCC1","RECOCCODE2","RECENTOCC2","SCHOOL1","DEGREE1","EDUDATE1","SCHOOL2","DEGREE2","EDUDATE2","SCHOOL3","DEGREE3","EDUDATE3","MILBRANCH1","MILRANK1","MILDATES1","MILBRANCH2","MILRANK2","MILDATES2","MAILNAME","MAILTITLE","MAILADDR1","MAILADDR2","MAILADDR3","MAILADDR4","MAILADDR5","EMAIL","WEBFORM","WEBSITE","WEBLOG","FACEBOOK","TWITTER","YOUTUBE","PHOTOPATH","PHOTOFILE"]

end