Awesome
This repository contains code to build cosponsorship networks from bills passed in of the Portuguese Parliament .
HOWTO
Replicate by running make.r
in R.
The data.r
script downloads information on bills and sponsors. Unfortunately, the scraper is highly error-prone, as explained at the top of the script: multiple re-runs are required to successfully collect all bills. All photos should download fine.
See also Ricardo Lafuente's Python scraper for bills, which also runs slowly but is certainly more efficient overall, as well as his listing of Portuguese MPs, which is similar to the one collected by this repository.
The build.r
script then assembles the edge lists and plots the networks, with the help of a few routines coded into functions.r
. Adjust the plot
, gexf
and mode
parameters to skip the plots or to change the node placement algorithm.
DATA
Bills
legislature
-- legislature number (Roman number, VI-XII)session
-- legislature sessionref
-- bill local identifier (number/legislature)title
-- titlebid
-- bill unique identifierauthors
-- party affiliation(s) of the individual sponsor(s)sponsors
-- individual sponsor(s), as numeric identifiersn_au
-- number of sponsors on the bill
Sponsors
The sponsors data have multiple rows for each sponsor (one per legislature in which the sponsor sat).
url
-- unique numeric identifier, from the profile URLlegislature
-- legislature of activityname
-- short namefullname
-- full name (Portuguese names are looooong)sex
-- gender (F/M), imputed from status ("deputado/a") and first namesborn
-- year of birthparty
-- political party, abbreviatedconstituency
-- constituencyphoto
-- URL to the online photo of the sponsornyears
-- seniority (time in office since legislature 6), in years
Constituencies are standardized to Wikipedia Português handles (except for "Portuguese outside Europe"), and genders have been checked to ensure that male and female names do not overlap.