Skip to content

Legislator matching been OCPF and legislature IDs#2168

Open
J-C-L wants to merge 6 commits into
codeforboston:mainfrom
J-C-L:finance-name-matching
Open

Legislator matching been OCPF and legislature IDs#2168
J-C-L wants to merge 6 commits into
codeforboston:mainfrom
J-C-L:finance-name-matching

Conversation

@J-C-L

@J-C-L J-C-L commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

The legislature and OCPF use different ID systems, so in order to use campaign finance data from OCPF, we need to map OCPF filer IDs to the corresponding member ID for the legislator.
This creates a firebase function to get the filers list from OCPF, do the mapping against our current court members, and store the results in Firestore. Successful matches are stored in config/OcpfMemberMapping. Members that couldn't be matched (either no match found or multiple possible matches) are stored in OcpfMemberMappingFlags, with details written to the logs.
This process will have to be run once for each legislative election cycle, and we will have to manually address the unmatched members.

Checklist

  • [N/A] On the frontend, I've made my strings translate-able.
  • [N/A] If I've added shared components, I've added a storybook story.
  • [N/A] I've made pages responsive and look good on mobile.
  • [N/A ] If I've added new Firestore queries, I've added any new required indexes to 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

Describing Local steps (Will replace with dev steps once I've tested there):

  1. Make sure Firestore generalCourts/194/Members is populated (If not, run curl "http://localhost:5001/demo-dtp/us-central1/triggerPubsubFunction?scheduled=startMemberBatches" twice with 30 second delay

  2. Run curl -X POST http://localhost:5001/demo-dtp/us-central1/matchOcpfMembers

  3. Confirm Firestore config/OcpfMemberMapping exists and the number of entries matches terminal output from {"results":{"matched":182...}...}

  4. Confirm entry exists for SND0, with OCPF ID: 15031, name : "Sal N. DiDomenico"

  5. Confirm config/OcpfMemberMappingFlags now exists with "unmatched" and "ambiguous" fields, and each field has the number of entries shown in terminal output: {"results":{"matched":182,"unmatched":8,"ambiguous":5}...}

  6. Look at the Firebase logs in the console and filter for matchOcpfMembers. Scan results to see the details logged for the "unmatched" and "ambiguous" members mentioned above.

  7. Confirm that once a manual fix is made, it will not be overwritten on a subsequent run:

  • Confirm that Mike Connolly (M_C1 ) is on the ambiguous list, and thus not in OcpfMemberMapping (He's in OCPF as Michael L. Connolly)
  • Add an entry to /config/ocpfMemberMapping for Mike Connolly:
    new field for MemberID (M_C1) , with type “map” with 2 nested fields inside: { cpfId: 15470, name: "Mike Connolly" }
  • In terminal, re-run curl -X POST http://localhost:5001/demo-dtp/us-central1/matchOcpfMembers
  • Confirm that M_C1 is still in ocpfMemberMapping and has been removed from ocpfMemberMappingFlags

@vercel

vercel Bot commented Jun 16, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
maple-dev Ready Ready Preview, Comment Jun 16, 2026 9:28pm

Request Review

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.

1 participant