Wikidata:WikiProject US legislation

From Wikidata
Jump to navigation Jump to search

This WikiProject is working to import data about US legislation into Wikidata. Right now, we're working to write a bot that will import data on all bills introduced into either house of Congress from 2009 to the present from Sunlight Foundation's Congress API. The Sunlight Foundation is interested in maintaining the bot and re-running it at regular intervals.

The group was born at the Sunlight Foundation—Wikimedia DC Wikihack on 5 and 6 April 2014.

Plan

[edit]
  1. Choose an ID scheme for US federal legislation and apply it to all the existing Wikidata items for US bills and laws 2009–present.
  2. Create a schema crosswalk between Sunlight's Congress API and Wikidata.
  3. Propose necessary new properties.
  4. Write a bot that fetches data from the Congress API and writes it to Wikidata according to the crosswalk. The bot must be idempotent so that it can be reused.

Proposed crosswalk

[edit]

Note: The crosswalk includes fairly complex transformations as well as straight one-to-one mappings, so this proposal will dip into pseudocode when necessary.

Proposals needing input

[edit]

Basic fields

[edit]

Titles

[edit]
  • official_title: "An act entitled The Patient Protection and Affordable Care Act." => official name (new property?)
  • short_title: "Patient Protection and Affordable Care Act" => LABEL
  • popular_title & nicknames: "Health care reform bill" => all different values that exist become aliases

History

[edit]

Actions

[edit]

Sponsorship

[edit]

The Sunlight schema provides for one sponsor (in rare cases, zero) and multiple cosponsors.

  • sponsor => sponsor (P859) [this is currently used most for sports sponsors, but that's not necessarily a problem]
    • sponsor_ID => new P (Bioguide ID)
  • for cosponsor in cosponsors
    • cosponsor.legislator => new P (cosponsor)
      • consponsor.legislator.bioguide_id => new P (Bioguide ID)

Possible future projects

[edit]
  • Add 'votes for' and 'votes against' qualifiers to 'voting' significant events
  • One day, when there is a Bioguide–Wikidata mapping, make sponsor and cosponsor Wikidata items, not just strings

Documents

[edit]

Members

[edit]

Sample Sunlight API queries

[edit]

Affordable Care Act

[edit]

congress.api.sunlightfoundation.com/bills?bill_id=hr3590-111

 {
    "results": [
        {
            "bill_id": "hr3590-111",
            "bill_type": "hr",
            "chamber": "house",
            "committee_ids": [
                "HSWM"
            ],
            "congress": 111,
            "cosponsors_count": 40,
            "enacted_as": {
                "congress": 111,
                "law_type": "public",
                "number": 148
            },
            "history": {
                "active": true,
                "active_at": "2009-10-07T18:35:00Z",
                "awaiting_signature": false,
                "enacted": true,
                "enacted_at": "2010-03-23",
                "house_passage_result": "pass",
                "house_passage_result_at": "2010-03-22T02:48:00Z",
                "senate_cloture_result": "pass",
                "senate_cloture_result_at": "2009-12-23",
                "senate_passage_result": "pass",
                "senate_passage_result_at": "2009-12-24",
                "vetoed": false
            },
            "introduced_on": "2009-09-17",
            "last_action_at": "2010-03-23",
            "last_version": {
                "version_code": "enr",
                "issued_on": "2010-08-25",
                "version_name": "Enrolled Bill",
                "bill_version_id": "hr3590-111-enr",
                "urls": {
                    "html": "http://www.gpo.gov/fdsys/pkg/BILLS-111hr3590enr/html/BILLS-111hr3590enr.htm",
                    "pdf": "http://www.gpo.gov/fdsys/pkg/BILLS-111hr3590enr/pdf/BILLS-111hr3590enr.pdf"
                },
                "pages": 906
            },
            "last_version_on": "2010-08-25",
            "last_vote_at": "2010-03-22T02:48:00Z",
            "nicknames": [
                "obamacare",
                "ppaca"
            ],
            "number": 3590,
            "official_title": "An act entitled The Patient Protection and Affordable Care Act.",
            "popular_title": "Health care reform bill",
            "related_bill_ids": [
                "hconres254-111",
                "hres1203-111",
                "hr3780-111",
                "hr4872-111",
                "s1728-111",
                "s1790-111"
            ],
            "short_title": "Patient Protection and Affordable Care Act",
            "sponsor": {
                "first_name": "Charles",
                "last_name": "Rangel",
                "middle_name": "B.",
                "name_suffix": null,
                "nickname": null,
                "title": "Rep"
            },
            "sponsor_id": "R000053",
            "urls": {
                "congress": "http://beta.congress.gov/bill/111th/house-bill/3590",
                "govtrack": "http://www.govtrack.us/congress/bills/111/hr3590",
                "opencongress": "http://www.opencongress.org/bill/111-h3590/show"
            },
            "withdrawn_cosponsors_count": 0
        }
    ],
    "count": 1,
    "page": {
        "count": 1,
        "per_page": 20,
        "page": 1
    }
 }