Wikidata:WikiProject US legislation

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.


  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 crosswalkEdit

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 inputEdit

Basic fieldsEdit


  • 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




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 projectsEdit

  • 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



Sample Sunlight API queriesEdit

Affordable Care ActEdit

   "results": [
           "bill_id": "hr3590-111",
           "bill_type": "hr",
           "chamber": "house",
           "committee_ids": [
           "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": "",
                   "pdf": ""
               "pages": 906
           "last_version_on": "2010-08-25",
           "last_vote_at": "2010-03-22T02:48:00Z",
           "nicknames": [
           "number": 3590,
           "official_title": "An act entitled The Patient Protection and Affordable Care Act.",
           "popular_title": "Health care reform bill",
           "related_bill_ids": [
           "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": "",
               "govtrack": "",
               "opencongress": ""
           "withdrawn_cosponsors_count": 0
   "count": 1,
   "page": {
       "count": 1,
       "per_page": 20,
       "page": 1