[Low priority] Get districts of legislators cleanly in v2?


#1

Is there some way to retrieve the district of a legislator (i.e., PostNode + DivisionNode), without fetching empty PostNodes for all the other memberships? A PostNode has no classification, at least, none that’s visible as a field, so it can’t be filtered for using the classification field parameter on currentMemberships. I currently use e.g.

{people(
  memberOf: "ocd-organization/98d43d46-9571-4a40-9007-581d84d41bb8",  
  first: 5) {
    edges {
      node {
        id 
        name
        currentMemberships {
          post {
            division {
              id
              name
} } } } } }

but this returns e.g.

            "currentMemberships": [
              {
                "post": null
              },
              {
                "post": {
                  "division": {
                    "id": "ocd-division/country:us/state:co/sldu:7",
                    "name": "Colorado State Senate district 7"
                  }
                }
              },
              {
                "post": null
              },
              {
                "post": null
              },
              {
                "post": null
              },
              {
                "post": null
              },
              {
                "post": null
              },
              {
                "post": null
              }
            ]

which is very usable, but lame.


#2

hm, I wonder if it’d make sense to just add a special case property for these. something like currentRole

thoughts on other ways?


#3

If you go this way, consider naming it “currentPosts”. My data paranoia (from frequent beatings by data) suggests that it may be valid somewhere, somehow, to have more than one post at once - hence the plural. And “role” doesn’t make sense to me - people have roles on committees, etc., so it’s not evocative for me.

Another possibility is to have a pseudo-classification of “_post”, which is guaranteed not to occur on any Organization. I don’t like this as much because it feels like “secret sauce” - a bit of a hack.


#4

This topic was automatically closed 70 days after the last reply. New replies are no longer allowed.