Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Member data for State and District is confusing #277

Open
tomburge opened this issue Sep 29, 2024 · 9 comments
Open

Member data for State and District is confusing #277

tomburge opened this issue Sep 29, 2024 · 9 comments
Labels
documentation Improvements or additions to documentation enhancement New feature or request

Comments

@tomburge
Copy link

I created a gist to showcase the following issue: https://gist.github.com/tomburge/d5b5f238eb5b51c3d14f222e6a744040

In the example1.json, this endpoint was used /member/{stateCode}/{district}.

In the example2.json, this endpoint was used /member/{bioguideId}.

In example1.json the query was for TX district 15. This returned 5 records.

3 had district 15, 1 had district 34, and 1 had no district.

In the example2.json, the member has 4 terms of which 3 are for district 15 and the current one is district 34.

It would be better (and less confusing) to have the district attribute inside of each term instead of a base attribute.

This would help with members who switched districts and for members who were in the House but then in the Senate.

@apreiter18 apreiter18 added documentation Improvements or additions to documentation enhancement New feature or request labels Sep 30, 2024
@apreiter18
Copy link
Collaborator

Hi @tomburge - thank you for this feedback. It's very much appreciated.

One possible workaround, if you are only looking for the current member for a particular district, is to use the "currentMember=True" filter. Here is an example call: https://api.congress.gov/v3/member/congress/118/TX/15?currentMember=true&api_key=[INSERT_KEY]

I am in the process of updating sample documentation and adding the filter to the member endpoint parameters on api.congress.gov. You will see the documentation reflect this update in October.

I hope this helps for now. Please let me know.

@tomburge
Copy link
Author

The workaround makes sense if you are only concerned about current members. I didn't include the tests, but I ran into some issues with existing districts like Texas districts 1-10 with specific Congresses sometimes reporting no results and I have to wonder if no results were returned because a member was included on a response for another district. It was weird.

@apreiter18
Copy link
Collaborator

@tomburge - yes, that is strange behavior, and I would like to investigate further. If you can recall any calls (I just tried Texas districts 1-10 for the 118th Congress and got results so maybe a previous Congress is the culprit?), please send them my way so I can take a look. I will keep digging in the meantime, too, to see if I can replicate this. Thanks for reporting this and following up!

@tomburge
Copy link
Author

tomburge commented Sep 30, 2024

Here are three sets just checked. I wonder if redistricting has something to do with it.

Has Results:
Congress 118
District 3
State TX

No Results:
Congress 100
District 3
State TX

Has Results:
Congress 118
District 4
State TX

No Results:
Congress 101
District 4
State TX

Has Results:
Congress 118
District 7
State TX

No Results:
Congress 105
District 7
State TX

@apreiter18
Copy link
Collaborator

Yes, looking at these examples redistricting is the culprit for these three, @tomburge - thank you for sharing these. I am going to have discussions on our end about this to see if there are particular element(s) we can add to make this a bit clearer. Thanks, again, for reporting this.

@tomburge
Copy link
Author

I just looped through Congresses 97-118 and I got this:

No member found for Congress: 97, District: 10, State: TX
No member found for Congress: 98, District: 10, State: TX
No member found for Congress: 99, District: 10, State: TX
No member found for Congress: 100, District: 10, State: TX
No member found for Congress: 101, District: 10, State: TX
No member found for Congress: 102, District: 10, State: TX
No member found for Congress: 103, District: 10, State: TX
Congress: 104, District: 10, State: TX
Member Name: Doggett, Lloyd
Member ID: D000399
Member Party: Democratic
Congress: 105, District: 10, State: TX
Member Name: Doggett, Lloyd
Member ID: D000399
Member Party: Democratic
Congress: 106, District: 10, State: TX
Member Name: Doggett, Lloyd
Member ID: D000399
Member Party: Democratic
Congress: 107, District: 10, State: TX
Member Name: Doggett, Lloyd
Member ID: D000399
Member Party: Democratic
Congress: 108, District: 10, State: TX
Member Name: Doggett, Lloyd
Member ID: D000399
Member Party: Democratic
Congress: 109, District: 10, State: TX
Member Name: McCaul, Michael T.
Member ID: M001157
Member Party: Republican
Congress: 110, District: 10, State: TX
Member Name: McCaul, Michael T.
Member ID: M001157
Member Party: Republican
Congress: 111, District: 10, State: TX
Member Name: McCaul, Michael T.
Member ID: M001157
Member Party: Republican
Congress: 112, District: 10, State: TX
Member Name: McCaul, Michael T.
Member ID: M001157
Member Party: Republican
Congress: 113, District: 10, State: TX
Member Name: McCaul, Michael T.
Member ID: M001157
Member Party: Republican
Congress: 114, District: 10, State: TX
Member Name: McCaul, Michael T.
Member ID: M001157
Member Party: Republican
Congress: 115, District: 10, State: TX
Member Name: McCaul, Michael T.
Member ID: M001157
Member Party: Republican
Congress: 116, District: 10, State: TX
Member Name: McCaul, Michael T.
Member ID: M001157
Member Party: Republican
Congress: 117, District: 10, State: TX
Member Name: McCaul, Michael T.
Member ID: M001157
Member Party: Republican
Congress: 118, District: 10, State: TX
Member Name: McCaul, Michael T.
Member ID: M001157
Member Party: Republican

Looking at the Congress.gov site for members, I see this as well:

image

The counts decrease farther back you go so it makes me think there may be an issue with the historical data or how it is presented.

@apreiter18
Copy link
Collaborator

@tomburge - you are quite correct, when you deselect "118" you will see the numbers increase. Currently, when "118" is selected it is showing members who are in the 118th Congress AND those who were in previous Congresses, as well. See below:
image

One possible solution, and something I intend to update our documentation with, is to add a "currentMember=False" filter to your call (e.g., https://api.congress.gov/v3/member/congress/97/TX/10?currentMember=False&api_key=INSERT_KEY).

@tomburge
Copy link
Author

tomburge commented Oct 1, 2024

I just validated with the same loop and adding currentMember = False fixes the issue.

Is it possible to add a default value of currentMember = False to the API to this call: GET /member/congress/:congress/:stateCode/:district?

I would think if the API is being called with a specific Congress then the response would be expected to be populated with the members of that specific Congress whether they are current or not.

@apreiter18
Copy link
Collaborator

@tomburge - Yes, we can update the documentation and API value to account for this. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants