"People" root node not giving current memberships for all states


#1

I am trying to run some toy queries for people who have currentMemberships: "<state> Legislature", but for many <state> nothing is returned; California, Florida, Illinois, Iowa, Massachusetts, New Jersey, New York, and Texas return nothing.

(I only found Nebraska returns a nonempty list.)

Example query:

{
  people(memberOf:"Iowa Legislature", first: 100) {
    edges {
      node {
        name
        party: currentMemberships(classification:"party") {
          organization {
            name
            
          }
        }
        links {
          url
        }
        sources {
          url
        }
        chamber: currentMemberships(classification:["upper", "lower"]) {
          post {
            label
          }
          organization {
            name
            classification
            parent {
              name
            }
          }
        }
      }
    }
  }
}

It returns:

{
  "data": {
    "people": {
      "edges": []
    }
  }
}

#2

Nebraska and DC are oddballs in that they only have one chamber, which is modelled in v2 as the entire legislature. In other states, you need to drill down to the chamber and then ask for members of the chamber.


#3

[slaps forehead] Thanks, that fixed everything.


#4

This is an example and if true needs to be fixed: https://docs.openstates.org/en/latest/api/v2/examples.html#get-basic-information-for-all-legislatures

The following is shown:

{
  people(memberOf:"ocd-organization/ddf820b5-5246-46b3-a807-99b5914ad39f", first: 100) {
    edges {
      node {
        name
        party: currentMemberships(classification:"party") {
          organization {
            name

          }
        }
        links {
          url
        }
        sources {
          url
        }
        chamber: currentMemberships(classification:["upper", "lower"]) {
          post {
            label
          }
          organization {
            name
            classification
            parent {
              name
            }
          }
        }
      }
    }
  }
}

You would expect the above to return both Senate and House but it only returns Senate.


#5

I can not for the life of me figure out how to get lower only from the above code. I am completely new to GraphQL so any help would be appreciated.

Where can I find ocd-organization information as well? How do I translate what ocd-organization/ddf820b5-5246-46b3-a807-99b5914ad39f is (I can based on the results but what if I want to find for other organizations?


#6

When asking for an individual it returns lower with no issue:

{
  people(first: 1, name: "Will Ainsworth") {
    edges {
      node {
        name
        chamber: currentMemberships(classification: ["upper", "lower"]) {
          post {
            label
          }
          organization {
            name
            classification
            parent {
              name
            }
          }
        }
      }
    }
  }
}


{
  "data": {
    "people": {
      "edges": [
        {
          "node": {
            "name": "Will Ainsworth",
            "chamber": [
              {
                "post": {
                  "label": "27"
                },
                "organization": {
                  "name": "House",
                  "classification": "lower",
                  "parent": {
                    "name": "Alabama Legislature"
                  }
                }
              }
            ]
          }
        }
      ]
    }
  }
}

#7

Can you expand on what you changed or how you took a different approach to this?


#8

Why does this:

{
  jurisdiction(name: "Alabama") {
    name
    url
    organizations(classification: "legislature", first: 1) {
      edges {
        node {
          id
          name
          children(first: 20) {
            edges {
              node {
                name
              }
            }
          }
        }
      }
    }
  }
}

Return a different ocd id than the example code above for Alabama?

{
  "data": {
    "jurisdiction": {
      "name": "Alabama",
      "url": "http://www.legislature.state.al.us/",
      "organizations": {
        "edges": [
          {
            "node": {
              "id": "ocd-organization/8de9200f-a2e2-4f92-9950-e6c63f265248",
              "name": "Alabama Legislature",
              "children": {
                "edges": [
                  {
                    "node": {
                      "name": "House"
                    }
                  },
                  {
                    "node": {
                      "name": "Senate"
                    }
                  }
                ]
              }
            }
          }
        ]
      }
    }
  }
}

#9

(updated early 11 Nov)
The memberOfparameter you are using, ocd-organization/ddf820b5-5246-46b3-a807-99b5914ad39f , is that of the Senate, so of course it only returns Senate members.

First get your chamber ids using a jurisdiction query, then query for members of each chamber.
In the case at hand, you can get the lower house members with
people(memberOf:"ocd-organization/74ad748b-f0a1-408f-9aa6-3319a868fd55"

Your second question is a bit hard to answer succinctly. There are certainly some kinds of queries “missing” that one might expect to be present, but in my experience, I really didn’t need them in my real application. This is one of those. I suspect you may find that you don’t really need it either, but of course I can’t be sure. You can get collections of organizations, or single organizations, from jurisdiction queries, where you can also get the name, etc, and retain these in a map for later use. Or, you can always (I think) ask for the name and other info in any place where an organization id is returned. For example, in the example query where it asks for

organization {
            name
            classification
            parent {
              name
            }

You could easily get ids too:

organization {
            name
            id
            classification
            parent {
              name
              id
            }

The case you ask about is kind of artificial, because the query isn’t returning the ocd-id; you’re providing it. I figured out what it was by doing a jurisdiction query and eyeballing the ids returned by it for the various organizations included.

Hope that helps; I’ll put in a pull request for clarification on the doc for that example.