LibraryOfCongress / api.congress.gov

congress.gov API
605 stars 38 forks source link

feat(member): terms that represent term of the elected position #208

Open ryparker opened 3 months ago

ryparker commented 3 months ago

This is not a bug. This issue is to offer some insight on how term data could be made more useful for consumers and to aid in the design of future improvements to the member API.

The Problem

Currently the member API returns terms which correlate to the congress terms that the elected official served in, not the terms of the official's position.

The definition for terms in the docs:

<terms> Container of a member’s terms of service in chronological order. A element may include the following child, which is repeatable:

<item> Container for the member’s service in an individual Congress.

Example 1:

curl --location 'https://api.congress.gov/v3/member/S001222?format=json&api_key=<API_KEY>'
"terms": [
            {
                "chamber": "House of Representatives",
                "congress": 118,
                "district": 3,
                "endYear": 2023,
                "memberType": "Representative",
                "startYear": 2023,
                "stateCode": "NY",
                "stateName": "New York"
            }
        ],

This is George Santos's (S001222) term data. Notice how the endYear is present, however we don't know what month, or day. We also don't have any information on if or why their term was ended prematurely. What if they were expelled in 2025 just days before the end of the congress? The current term data would look as if they completed the full term.

Example 2:

curl --location 'https://api.congress.gov/v3/member/S000148?format=json&api_key=<API_KEY>'
"terms": [
            {
                "chamber": "House of Representatives",
                "congress": 97,
                "district": 16,
                "endYear": 1983,
                "memberType": "Representative",
                "startYear": 1981,
                "stateCode": "NY",
                "stateName": "New York"
            },
            {
                "chamber": "House of Representatives",
                "congress": 98,
                "district": 10,
                "endYear": 1985,
                "memberType": "Representative",
                "startYear": 1983,
                "stateCode": "NY",
                "stateName": "New York"
            },
            {
                "chamber": "House of Representatives",
                "congress": 99,
                "district": 10,
                "endYear": 1987,
                "memberType": "Representative",
                "startYear": 1985,
                "stateCode": "NY",
                "stateName": "New York"
            },
            {
                "chamber": "House of Representatives",
                "congress": 100,
                "district": 10,
                "endYear": 1989,
                "memberType": "Representative",
                "startYear": 1987,
                "stateCode": "NY",
                "stateName": "New York"
            },
            {
                "chamber": "House of Representatives",
                "congress": 101,
                "district": 10,
                "endYear": 1991,
                "memberType": "Representative",
                "startYear": 1989,
                "stateCode": "NY",
                "stateName": "New York"
            },
            {
                "chamber": "House of Representatives",
                "congress": 102,
                "district": 10,
                "endYear": 1993,
                "memberType": "Representative",
                "startYear": 1991,
                "stateCode": "NY",
                "stateName": "New York"
            },
            {
                "chamber": "House of Representatives",
                "congress": 103,
                "district": 9,
                "endYear": 1995,
                "memberType": "Representative",
                "startYear": 1993,
                "stateCode": "NY",
                "stateName": "New York"
            },
            {
                "chamber": "House of Representatives",
                "congress": 104,
                "district": 9,
                "endYear": 1997,
                "memberType": "Representative",
                "startYear": 1995,
                "stateCode": "NY",
                "stateName": "New York"
            },
            {
                "chamber": "House of Representatives",
                "congress": 105,
                "district": 9,
                "endYear": 1999,
                "memberType": "Representative",
                "startYear": 1997,
                "stateCode": "NY",
                "stateName": "New York"
            },
            {
                "chamber": "Senate",
                "congress": 106,
                "endYear": 2001,
                "memberType": "Senator",
                "startYear": 1999,
                "stateCode": "NY",
                "stateName": "New York"
            },
            {
                "chamber": "Senate",
                "congress": 107,
                "endYear": 2003,
                "memberType": "Senator",
                "startYear": 2001,
                "stateCode": "NY",
                "stateName": "New York"
            },
            {
                "chamber": "Senate",
                "congress": 108,
                "endYear": 2005,
                "memberType": "Senator",
                "startYear": 2003,
                "stateCode": "NY",
                "stateName": "New York"
            },
            {
                "chamber": "Senate",
                "congress": 109,
                "endYear": 2007,
                "memberType": "Senator",
                "startYear": 2005,
                "stateCode": "NY",
                "stateName": "New York"
            },
            {
                "chamber": "Senate",
                "congress": 110,
                "endYear": 2009,
                "memberType": "Senator",
                "startYear": 2007,
                "stateCode": "NY",
                "stateName": "New York"
            },
            {
                "chamber": "Senate",
                "congress": 111,
                "endYear": 2011,
                "memberType": "Senator",
                "startYear": 2009,
                "stateCode": "NY",
                "stateName": "New York"
            },
            {
                "chamber": "Senate",
                "congress": 112,
                "endYear": 2013,
                "memberType": "Senator",
                "startYear": 2011,
                "stateCode": "NY",
                "stateName": "New York"
            },
            {
                "chamber": "Senate",
                "congress": 113,
                "endYear": 2015,
                "memberType": "Senator",
                "startYear": 2013,
                "stateCode": "NY",
                "stateName": "New York"
            },
            {
                "chamber": "Senate",
                "congress": 114,
                "endYear": 2017,
                "memberType": "Senator",
                "startYear": 2015,
                "stateCode": "NY",
                "stateName": "New York"
            },
            {
                "chamber": "Senate",
                "congress": 115,
                "endYear": 2019,
                "memberType": "Senator",
                "startYear": 2017,
                "stateCode": "NY",
                "stateName": "New York"
            },
            {
                "chamber": "Senate",
                "congress": 116,
                "endYear": 2021,
                "memberType": "Senator",
                "startYear": 2019,
                "stateCode": "NY",
                "stateName": "New York"
            },
            {
                "chamber": "Senate",
                "congress": 117,
                "endYear": 2023,
                "memberType": "Senator",
                "startYear": 2021,
                "stateCode": "NY",
                "stateName": "New York"
            },
            {
                "chamber": "Senate",
                "congress": 118,
                "memberType": "Senator",
                "startYear": 2023,
                "stateCode": "NY",
                "stateName": "New York"
            }
        ],

This is Chuck Schumer (S000148). Senator Schumer just recently won his term in the 2022 election. However the congress term data does not reflect this. His term was renewed from 2023 - 2029, however the current term data only tells us that he is serving in the 118th congress from 2023 (no end date). Based on this term data we have no idea of when the Senator's term will actually end.

Opportunities

George Santos' term data could look like this:

"terms": [
            {
                "chamber": "House of Representatives",
                "memberType": "Representative",
                "electionDate": "2022-11-05",
                "startDate": "2023-01-03",
                "endDate": "2025-01-03",
                "actualEndDate": "2023-12-01",
                "endReason": "expelled",
                "stateCode": "NY",
                "stateName": "New York"
               "district": 3,
            }
        ],

Chuck Schumer's term data could look like this:

"terms": [
            {
                "chamber": "House of Representatives",
                "memberType": "Representative",
                 "electionDate": "1980-11-05",
                "startDate": "1981-01-03",
                "endDate": "1983-01-03",
                "stateCode": "NY",
                "stateName": "New York"
                "district": 16,
            },
            {
                "chamber": "House of Representatives",
                "memberType": "Representative",
                 "electionDate": "1982-11-05",
                "startDate": "1983-01-03",
                "endDate": "1985-01-03",
                "stateCode": "NY",
                "stateName": "New York"
                "district": 10,
            },
            {
                "chamber": "House of Representatives",
                "memberType": "Representative",
                 "electionDate": "1984-11-05",
                "startDate": "1985-01-03",
                "endDate": "1987-01-03",
                "stateCode": "NY",
                "stateName": "New York"
                "district": 10,
            },
            {
                "chamber": "House of Representatives",
                "memberType": "Representative",
                "electionDate": "1986-11-05",
                "startDate": "1987-01-03",
                "endDate": "1989-01-03",
                "stateCode": "NY",
                "stateName": "New York"
                "district": 10,
            },
            {
                "chamber": "House of Representatives",
                "memberType": "Representative",
                "electionDate": "1988-11-05",
                "startDate": "1989-01-03",
                "endDate": "1991-01-03",
                "stateCode": "NY",
                "stateName": "New York"
                "district": 10,
            },
            {
                "chamber": "House of Representatives",
                "memberType": "Representative",
                "electionDate": "1990-11-05",
                "startDate": "1991-01-03",
                "endDate": "1993-01-03",
                "stateCode": "NY",
                "stateName": "New York"
                "district": 10,
            },
            {
                "chamber": "House of Representatives",
                "memberType": "Representative",
                "electionDate": "1992-11-05",
                "startDate": "1993-01-03",
                "endDate": "1995-01-03",
                "stateCode": "NY",
                "stateName": "New York"
                "district": 9,
            },
            {
                "chamber": "House of Representatives",
                "memberType": "Representative",
                "electionDate": "1994-11-05",
                "startDate": "1995-01-03",
                "endDate": "1997-01-03",
                "stateCode": "NY",
                "stateName": "New York"
                "district": 9,
            },
            {
                "chamber": "House of Representatives",
                "memberType": "Representative",
                "electionDate": "1996-11-05",
                "startDate": "1997-01-03",
                "endDate": "1999-01-03",
                "stateCode": "NY",
                "stateName": "New York"
                "district": 9,
            },
            {
                "chamber": "Senate",
                "memberType": "Senator",
                "electionDate": "1998-11-05",
                "startDate": "1999-01-03",
                "endDate": "2005-01-03",
                "stateCode": "NY",
                "stateName": "New York"
            },
            {
                "chamber": "Senate",
                "memberType": "Senator",
                "electionDate": "2004-11-05",
                "startDate": "2005-01-03",
                "endDate": "2011-01-03",
                "stateCode": "NY",
                "stateName": "New York"
            },
            {
                "chamber": "Senate",
                "memberType": "Senator",
                "electionDate": "2010-11-05",
                "startDate": "2011-01-03",
                "endDate": "2017-01-03",
                "stateCode": "NY",
                "stateName": "New York"
            },
            {
                "chamber": "Senate",
                "memberType": "Senator",
                "electionDate": "2016-11-05",
                "startDate": "2017-01-03",
                "endDate": "2023-01-03",
                "stateCode": "NY",
                "stateName": "New York"
            },
            {
                "chamber": "Senate",
                "memberType": "Senator",
                "electionDate": "2022-11-05",
                "startDate": "2023-01-03",
                "endDate": "2029-01-03",
                "stateCode": "NY",
                "stateName": "New York"
            }
        ],

Now we see that Senator Schumer has served 9 terms in the House and will be serving his 5th consecutive term in the Senate.

Benefits

Providing position term data is useful because it represents: