Skip to content

NH: capture version links for bills carried over from prior session year - #5769

Merged
jessemortenson merged 1 commit into
openstates:mainfrom
alexkost819:fix/nh-bill-text
Aug 26, 2026
Merged

jessemortenson merged 1 commit into
openstates:mainfrom
alexkost819:fix/nh-bill-text

Conversation

@alexkost819

@alexkost819 alexkost819 commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • NH bills carried over from a prior session year (LSR keeps that year's prefix, e.g. 25-0059 while being scraped as part of session 2026) never appear in NH's LsrsOnly.txt bulk-data dump for the current session, so versions_by_lsr had no id to build a billinfo.aspx page from — the scraper fell into a warn-only branch, leaving these bills with zero version/document links, including bills that became law (HB113, HB565, SB564, HB661, SB522, SB49, SB189, HB348 were the reported examples).
  • scrape_from_web already had a working fallback for exactly this case: query the legacy docket page directly by LSR + session year (no numeric id required). Extracted that logic into scrape_versions_from_docket and wired it into the main bulk-data path's missing-id branch, instead of just logging a warning.
  • This is a distinct failure mode from PR NH: missing version fix #3508 (which fixed a required time-based query param on GET requests) — that fix is intact and unrelated; this gap was simply never wired up in the primary bulk-data path.

Verification

Reproduced against NH's live site: all 8 reported became_law examples had LSRs entirely absent from LsrsOnly.txt (or, for SB564/SB522, already had a version id but that's a separate/already-working path). Confirmed bill_status/legacy/bs2016/bill_docket.aspx?lsr=<lsr>&sy=<session> returns real version links for these bills directly.

Ran a full 2026-session scrape before and after the fix (same code otherwise):

bills zero versions + zero documents
before 1387 232
after 1387 1 (HR48 — genuinely has no text filed on NH's site)

All 8 reported example bills have version links after the fix.

Example: HB113

Beforeversions: [], only the generic search-page source:

{
  "identifier": "HB113",
  "versions": [],
  "documents": [],
  "sources": [
    { "url": "https://gc.nh.gov/bill_Status/advanced.aspx", "note": "" }
  ]
}

After — introduced, amendment, and engrossed versions all captured, each with HTML/PDF links:

{
  "identifier": "HB113",
  "versions": [
    {
      "note": "Introduced",
      "links": [
        { "url": "https://gc.nh.gov/bill_status/legacy/bs2016/billText.aspx?sy=2026&v=HI&id=65&txtFormat=html", "media_type": "text/html" },
        { "url": "https://gc.nh.gov/bill_status/legacy/bs2016/billText.aspx?sy=2026&v=HI&id=65&txtFormat=pdf", "media_type": "application/pdf" }
      ]
    },
    {
      "note": "Amendment: #2026-0541h",
      "links": [
        { "url": "https://gc.nh.gov/bill_status/legacy/bs2016/billtext.aspx?sy=2026&txtFormat=amend&id=2026-0541H", "media_type": "application/pdf" }
      ]
    },
    {
      "note": "Ought to Pass",
      "links": [
        { "url": "https://gc.nh.gov/bill_status/legacy/bs2016/billText.aspx?sy=2026&v=SP&id=65", "media_type": "text/html" },
        { "url": "https://gc.nh.gov/bill_status/legacy/bs2016/billText.aspx?sy=2026&v=SP&id=65&txtFormat=pdf", "media_type": "application/pdf" }
      ]
    }
  ],
  "documents": [],
  "sources": [
    { "url": "https://gc.nh.gov/bill_Status/advanced.aspx", "note": "" }
  ]
}

Before/after scrape output

Full NH 2026-session scrape output, before and after the fix:

Test plan

  • python3 -m py_compile scrapers/nh/bills.py
  • Full NH 2026-session scrape run before and after the fix, compared bill counts and zero-version/document counts
  • Confirmed all 8 reported became_law example bills now have version links

Bills carried over from a prior session (LSR keeps that year's prefix,
e.g. "25-0059" while being scraped as part of session "2026") never
appear in NH's LsrsOnly.txt bulk-data dump for the current session, so
versions_by_lsr had no id to build a billinfo.aspx page from. The
scraper fell into a warn-only branch, leaving these bills with zero
version/document links even after passing (became_law).

scrape_from_web already had a working fallback for this exact case:
query the legacy docket page directly by LSR + session year, no
numeric id required. Extracted that into scrape_versions_from_docket
and wired it into the main bulk-data path's missing-id branch.

Verified against NH's live site for the reported became_law examples
(HB113, HB565, HB661, SB49, SB189, HB348 all had LSRs absent from
LsrsOnly.txt). A full 2026-session scrape before/after the fix drops
bills with zero versions and zero documents from 232/1387 to 1/1387
(the remainder, HR48, has no text filed on NH's site at all).

@jessemortenson jessemortenson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, merging

@jessemortenson
jessemortenson merged commit 2ef7e5d into openstates:main Aug 26, 2026
1 check passed
@alexkost819
alexkost819 deleted the fix/nh-bill-text branch August 27, 2026 22:16
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

Successfully merging this pull request may close these issues.

2 participants