Awesome
This repository contains code to build cosponsorship networks from bills (and motions) passed in the Swedish Parliament.
The data come from the Riksdag's open data portal.
HOWTO
Replicate by running make.r
in R.
The data.r
script downloads information on bills and sponsors. Once unzipped to the raw
folder, the raw JSON data files will take up to 1.5 GB of disk space -- make sure that you have at least that amount of free space on your hard drive.
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
The sponsors data are read from the JSON dumps available on the Riksdag's open data portal.
uid
-- bill unique identifier (int)doc
-- document identifier (the first two characters are legislature codes)legislature
-- legislature years, imputed fromdoc
date
-- bill date (yyyy-mm-dd)authors
-- semicolon-separated sponsor unique identifiersn_au
-- total number of sponsors
Sponsors
The sponsors data are read from the XML listings available on the Riksdag's open data portal.
name
-- sponsor nameborn
-- year of birth (num)sex
-- gender (F/M), read from the profileparty
-- political party, abbreviatedpartyname
-- political party, full nameconstituency
-- constituency, stored as the string to its Wikipedia English entry (see note)status
-- last parliamentary statusmandate
-- semicolon-separated mandate years, used to compute thenyears
seniority variablejob
-- occupationurl
-- profile URL, shortened to unique numeric identifierphoto
-- photo URL, coded as a numeric dummy (0/1); photo URLs are based on profile URLsuid
-- sponsor unique identifier, composed ofname
andurl
Note -- missing constituencies are due to a reform of the constituency system, which merged several constituencies into single ones. There are lots of missing constituencies for the legislatures before 2002, 4% (n = 18 constituencies) missing in 2002-2006, and none afterwards.