Is this a bug between bill and bills or am I missing something?


#1

I am trying to loop through all the bills for 2018rs in Alabama with the following code.

{
  search_1: bills(first: 1, jurisdiction: "Alabama", session: "2018rs") {
    edges {
      node {
        id
        identifier
        title
        classification
        updatedAt
        createdAt
        legislativeSession {
          identifier
          jurisdiction {
            name
          }
        }
        versions {
          date
          note
          links {
            url
          }
        }
        documents {
          date
          note
          links {
            url
          }
        }
        subject
        abstracts {
          abstract
          note
          date
        }
        otherTitles {
          title
          note
        }
        otherIdentifiers {
          identifier
          scheme
          note
        }
        sponsorships {
          name
          entityType
          person {
            id
            name
          }
          primary
          classification
        }
        relatedBills {
          identifier
          legislativeSession
          relationType
          relatedBill {
            id
          }
        }
        votes {
          edges {
            node {
              id
              motionText
              motionClassification
              startDate
              result
              counts {
                option
                value
              }
              createdAt
              updatedAt
            }
          }
        }
        actions {
          date
          description
          classification
        }
        sources {
          url
          note
        }
      }
    }
    pageInfo {
      hasNextPage
      endCursor
    }
  }
}

but it is not returning anything for the versions section. However when I use the following code it results in versions returned:

{
  b1: bill(jurisdiction: "Alabama", session: "2018rs", identifier: "HB 144") {
    id
    identifier
    title
    classification
    updatedAt
    createdAt
    legislativeSession {
      identifier
      jurisdiction {
        name
      }
    }
    actions {
      date
      description
      classification
    }
    documents {
      date
      note
      links {
        url
      }
    }
    versions {
      date
      note
      links {
        url
      }
    }
    sources {
      url
      note
    }
  }
}

Why can I get information from specific bills but not via a search through all bills? My first example returns HB 144 and so does my second one but with different results.


#2

In the above examples, the first example returns:

{
  "data": {
    "search_1": {
      "edges": [
        {
          "node": {
            "id": "ocd-bill/bef0b8a9-fccb-4046-8b7b-98dcd7455b7c",
            "identifier": "HB 144",
            "title": "Ten Commandments, display of on state property and at public schools, authorized, const. amend.",
            "classification": [
              "bill"
            ],
            "updatedAt": "2018-10-19 05:52:33.951219+00:00",
            "createdAt": "2018-01-12 05:11:21.044577+00:00",
            "legislativeSession": {
              "identifier": "2018rs",
              "jurisdiction": {
                "name": "Alabama"
              }
            },
            "versions": [],
            "documents": [],
            "subject": [
              "Constitutional Amendments"
            ],
            "abstracts": [],
            "otherTitles": [],
            "otherIdentifiers": [],
            "sponsorships": [
              {
                "name": "Mooney",
                "entityType": "person",
                "person": null,
                "primary": true,
                "classification": "primary"
              }
            ],
            "relatedBills": [],
            "votes": {
              "edges": []
            },
            "actions": [
              {
                "date": "2018-01-09T05:00:00+00:00",
                "description": "Read for the first time and referred to the House of Representatives committee on Constitution, Campaigns and Elections",
                "classification": [
                  "reading-1",
                  "referral-committee"
                ]
              }
            ],
            "sources": [
              {
                "url": "http://alisondb.legislature.state.al.us/Alison/SESSBillsList.aspx?STATUSCODES=Had%20First%20Reading%20House%20of%20Origin&BODY=999999",
                "note": ""
              },
              {
                "url": "http://alisondb.legislature.state.al.us/Alison/SESSBillStatusResult.aspx?BILL=HB144",
                "note": ""
              }
            ]
          }
        }
      ],
      "pageInfo": {
        "hasNextPage": true,
        "endCursor": "YXJyYXljb25uZWN0aW9uOjA="
      }
    }
  }
}

with an empty versions.

My second example returns:

{
  "data": {
    "b1": {
      "id": "ocd-bill/bef0b8a9-fccb-4046-8b7b-98dcd7455b7c",
      "identifier": "HB 144",
      "title": "Ten Commandments, display of on state property and at public schools, authorized, const. amend.",
      "classification": [
        "bill"
      ],
      "updatedAt": "2018-10-19 05:52:33.951219+00:00",
      "createdAt": "2018-01-12 05:11:21.044577+00:00",
      "legislativeSession": {
        "identifier": "2018rs",
        "jurisdiction": {
          "name": "Alabama"
        }
      },
      "actions": [
        {
          "date": "2018-01-09T05:00:00+00:00",
          "description": "Read for the first time and referred to the House of Representatives committee on Constitution, Campaigns and Elections",
          "classification": [
            "reading-1",
            "referral-committee"
          ]
        }
      ],
      "documents": [],
      "versions": [
        {
          "date": "",
          "note": "Introduced",
          "links": [
            {
              "url": "http://alisondb.legislature.state.al.us/ALISON/SearchableInstruments/2018rs/PrintFiles/HB144-int.pdf"
            }
          ]
        }
      ],
      "sources": [
        {
          "url": "http://alisondb.legislature.state.al.us/Alison/SESSBillsList.aspx?STATUSCODES=Had%20First%20Reading%20House%20of%20Origin&BODY=999999",
          "note": ""
        },
        {
          "url": "http://alisondb.legislature.state.al.us/Alison/SESSBillStatusResult.aspx?BILL=HB144",
          "note": ""
        }
      ]
    }
  }
}

With desired versions filled in.


#3

Is there a better place to ask questions related to API 2 returns that might get attention faster? GitHub for example?


#4

I ended up just using bills to get the ocd number and then using bill to update each bill.


#5

This is unusual, I’ll take a look


#6

Aha! yes there was indeed a bug with the cached vs. non-cached resolution of versions.

I deployed a fix for that 5 minutes ago.

Your first example works now from what I can tell, querying multiple bills at once will in general be more efficient than doing them individually.


#7

Good to know. I will use bills for 2017 and earlier now :slight_smile: