Repository navigation
Finance backfill - #2315
Open
J-C-L wants to merge 15 commits into
Open
Finance backfill#2315J-C-L wants to merge 15 commits into
J-C-L wants to merge 15 commits into
Conversation
Report types already logged a warning when unrecognized, defaulting to a safe itemsOnly treatment. Record types fell through to a silent default with no distinction between deliberately-ignored codes (205, 220) and a genuinely new one — this makes that failure mode loud too. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Pulls the matching logic out of the matchOcpfMembers HTTP handler into a reusable, court-parameterized function so the upcoming backfill script can match historical courts too. Active-filers-only filtering now applies only to the current court; historical courts drop it since a legislator who served years ago has likely closed their OCPF committee by now. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Extracts runOcpfFinanceScrape into scrapeFinanceForCourt(court, options), deriving YEARS per-call from generalCourts instead of a module-level constant tied to the current court. Adds generalCourts entries for 189-191 so historical courts can be targeted. The two existing triggers are unaffected — both still just call scrapeFinanceForCourt(currentGeneralCourt, ...). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…SON summary Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ays win Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…mpty mapping docs Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…in the finance backfill Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
J-C-L
requested review from
mertbagt,
mvictor55,
nesanders,
sashamaryl and
timblais
as code owners
October 27, 2026 21:36
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
J-C-L
requested review from
Mephistic,
alexjball and
kiminkim724
as code owners
October 27, 2026 21:36
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This is the bulk of the work for backfilling campaign finance data for legislators. (Issue: #2118)
Major changes:
Other changes:
Checklist
firestore.indexes.json(Please do not only create indexes through the Firebase Web UI, even though the error messages may reccommend it - indexes created this way may be obliterated by subsequent deploys)Steps to test/reproduce
Locally (on emulator):
and curl -X POST http://localhost:5001/demo-dtp/us-central1/scrapeOcpfFinanceManual
/generalCourts/194/ocpfMemberMappingConfig exists with ocpfMemberMapping and ocpfMemberMappingFlags and /generalCourts/194/membersFinance exists
http://localhost:3000/legislators/194/RLR0#finance
/generalCourts/192/ocpfMemberMappingConfig/ exists with ocpfMemberMapping and ocpfMemberMappingFlags
yarn firebase-admin run-script backfillOcpfMemberMapping --env local --courts 192 --verbose
Ex: yarn firebase-admin run-script backfillOcpfMemberMapping --env local --courts 193,192xxx
Ex: yarn firebase-admin run-script backfillOcpfMemberMapping --env local --courts 999
http://localhost:3000/legislators/192/AMS2#finance
Run yarn firebase-admin run-script backfillOcpfFinance --env local --courts=999
Confirm output shows: Court 999 failed: Error: No general court entry for court 999. Nothing written.
Confirm court 999 is not written into Firestore
Run yarn firebase-admin run-script backfillOcpfFinance --env local --courts=192,193
Confirm both courts run and the succeeded/failed summary lists both.
Run yarn firebase-admin run-script backfillOcpfFinance --env local --courts=192,193,abc
Confirm that for non numeric, whole set fails with: --courts (item 3): Expected number, received nan
Run yarn firebase-admin run-script backfillOcpfFinance --env local --courts=192,193,999
Confirm that for one bad court, rest will run, output includes a summary of which succeeded and which failed
*Run yarn firebase-admin run-script backfillOcpfFinance --env local --courts=192
Note: This proves the defensive logging is working.
Later, when we want to perfect the data, we need to look into these types and classify them in REPORT_TYPE_HANDLING/KNOWN_IGNORED_RECORD_TYPE_IDS.