Skip to content

Instantly share code, notes, and snippets.

@everypoliticianbot
Created November 1, 2016 17:53
Show Gist options
  • Save everypoliticianbot/3489e1c766b50f6915e8c096764069d2 to your computer and use it in GitHub Desktop.
Save everypoliticianbot/3489e1c766b50f6915e8c096764069d2 to your computer and use it in GitHub Desktop.
Use EveryPolitician gem to determine youngest member of UK legislature
import 'everypolitician'
house_of_commons = EveryPolitician::Index.new.country('UK').legislature('commons')
house_of_commons.legislative_periods.map { |t|
y = t.memberships.map(&:person).sort_by(&:birth_date).last
[t.id, t.start_date.to_s, y.gender, y.name,
((t.start_date — Date.parse(y.birth_date) / 365.25).round(1) ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment