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

Mechanism for identifying active members #90

Open
fowles opened this issue Mar 29, 2022 · 4 comments
Open

Mechanism for identifying active members #90

fowles opened this issue Mar 29, 2022 · 4 comments

Comments

@fowles
Copy link
Contributor

fowles commented Mar 29, 2022

Consider. https://legislation.nysenate.gov/api/3/members/2022/senate?limit=1000&key=REDACTED

this responds with a large list that contains

{
      "sessionMemberId" : 1864,
      "shortName" : "CLEARE",
      "sessionYear" : 2021,
      "districtCode" : 30,
      "alternate" : false,
      "memberId" : 1504
},

and

{
      "sessionMemberId" : 1798,
      "shortName" : "BENJAMIN",
      "sessionYear" : 2021,
      "districtCode" : 30,
      "alternate" : false,
      "memberId" : 1136
}, 

CLEARE is the active member having replaced BENJAMIN in a special election, but the API does not provide a way of determining that.

Observationally, the memberId and sessionMemberId are larger, which is likely to do with them being handed out in order, but this is not documented anywhere. Ideally, there would be a documented way to determine the active member in cases like this. I propose adding a boolean "active" : true which will be true for the member that is currently serving and false for a member that has been replaced.

@KevinCaseiras
Copy link
Member

Hey @fowles,

There are a few options available to determine who is active but it looks like they are missing from our docs.

One option is to add the full=true search param. i.e. /api/3/members/2022/senate?limit=1000&full=true This will give you a response with an incumbent field, which is true for currently serving members.

{
  "memberId": 1504,
  "chamber": "SENATE",
  "incumbent": true,
  "fullName": "Cordell Cleare",
  "shortName": "CLEARE",
  "imgName": "Cordell Cleare.jpg",
  "sessionShortNameMap": {
    "2021": [
      {
        "sessionMemberId": 1864,
        "shortName": "CLEARE",
        "sessionYear": 2021,
        "districtCode": 30,
        "alternate": false,
        "memberId": 1504
      }
    ]
  },
  "person": {
    "personId": 1321,
    "fullName": "Cordell Cleare",
    "firstName": "Cordell",
    "middleName": "",
    "lastName": "Cleare",
    "email": "",
    "prefix": "Senator",
    "suffix": "",
    "verified": true,
    "imgName": "Cordell Cleare.jpg"
  },
  "alternate": false,
  "sessionMemberId": 1864,
  "sessionYear": 2021,
  "districtCode": 30
}

Another option is to use our search api. A call to
/api/3/members/search?term=_exists_:sessionShortNameMap.2021%20AND%20incumbent:true will give you a summary of all currently active members.

Our member data is updated manually, so at times it may be missing data or slightly out of date. If your looking for the most accurate and up to date info on current senators, https://www.nysenate.gov/senators-json may be a better source of data for you (unfortunately I'm not aware of a similar api for assembly members).

I'm going to close this issue, but if you have any other issues or questions feel free to re open this or create a new issue.

@fowles
Copy link
Contributor Author

fowles commented Mar 30, 2022

When I try this with full=true I see

      "memberId" : 384,
      "chamber" : "SENATE",
      "incumbent" : false,
      "fullName" : "Joseph P. Addabbo Jr.",
      "shortName" : "ADDABBO",
      "imgName" : "384_joseph_p._addabbo_jr..jpg",

but he is still an active member of the senate (I am pretty sure).

Is there a data error?

@fowles
Copy link
Contributor Author

fowles commented Mar 30, 2022

I don't appear able to reopen this issue

@KevinCaseiras
Copy link
Member

Yes that does appear to be a data error, thanks for pointing it out.

@KevinCaseiras KevinCaseiras reopened this Mar 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants