Skip to content

Lobbying scraper: Handle amendments where the period row links back to the amendment - #2316

Merged
Mephistic merged 1 commit into
codeforboston:mainfrom
hyphacoop:fix/lobbying-parser
Oct 27, 2026
Merged

Mephistic merged 1 commit into
codeforboston:mainfrom
hyphacoop:fix/lobbying-parser

Conversation

@dasanchez

Copy link
Copy Markdown
Contributor

On some registration pages, the Secretary of the Commonwealth's portal links an amended period's row to the amendment itself rather than to the original filing, so the scraper read the amendment as superseded by itself. That blocks the dev backfill's cleanup, and in the weekly and backfill runs it would delete the amendment's filings right after writing them. The parser now treats a repeated link as the same version, so the amendment stays current. As a backstop, the runs keep the filings of any version a page lists as both current and superseded, and report that page instead.

What's in it

  • Keep an amendment current when the portal links its period row to it

🤖 Generated with Claude Code

On some registration pages the portal links an amended period's row to
the amendment itself instead of to the original filing, so the same
disclosure is linked twice in a row. parse_summary then marked the
amendment as superseded by itself: the migration's write phase skipped
it (superseded_without_current, which blocks cleanup), and the backfill
and weekly runs wrote it and then deleted its filings. A repeated link
to a version is now skipped, so the amendment is the current version
and supersedes nothing on the page.

As a backstop, the backfill and weekly runs no longer delete the filings
of a version a page lists as both superseded and current; they keep
them and report the page.

Verified: pytest in lobbying-scraper (197 passed), including the
repeated-link layout and the kept filings in both modes. Parsing all
33,762 archived registration pages in the local archive before and after
the change differs on one page only, the one with this layout, which now
has no self-superseded versions. The local emulator's filings for that
page, which the local rebuild had deleted, were rewritten from the
archive and the stats rebuilt without errors.

Not verified: the dev write phase reporting superseded_without_current
0; a weekly or backfill run against dev.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
maple-dev Ready Ready Preview Oct 27, 2026 11:13pm UTC

Request Review

@dasanchez dasanchez changed the title Keep an amendment current when the portal links its period row to it Lobbying scraper: Handle amendments where the period row links back to the amendment Oct 27, 2026
@dasanchez
dasanchez marked this pull request as ready for review October 27, 2026 23:22
@Mephistic
Mephistic merged commit 182a797 into codeforboston:main Oct 27, 2026
8 checks passed

This branch was successfully deployed

1 active deployment
Preview – maple-dev — a0c07dab Deployed Oct 27, 2026 by vercel[bot]
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