-
-
Save cyberoctopi/3519af38101927a75dac80e167cdc60c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn get-senator-data | |
"Fetch necessary fields from senate-data json feed" | |
[data] | |
(let [first-name (->> data :results (mapcat #(->> % :members (map :first_name)))) | |
last-name (->> data :results (mapcat #(->> % :members (map :last_name)))) | |
middle-name (->> data :results (mapcat #(->> % :members (map :middle_name)))) | |
date-of-birth (->> data :results (mapcat #(->> % :members (map :first_name))))] | |
(println-str (first first-name)))) | |
(get-senator-data senate-data) | |
;; ^ now I can take this and create a function that goes through and gets every field I want. after that...store it to a database | |
(let [members (->> senate-data :results (mapcat :members))] | |
(->> members (mapcat :first_name))) | |
(def data-fields [:first_name :last_name :middle_name | |
:date_of_birth :gender :next_election | |
:party :state_rank :state :in_office | |
:seniority :leadership_role :title | |
:total_votes :votes_with_party_pct | |
:missed_votes :phone :office :contact_form]) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment