Skip to content

Update Legislators for New Court 194 #1664

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 task
Mephistic opened this issue Jan 8, 2025 · 4 comments
Open
1 task

Update Legislators for New Court 194 #1664

Mephistic opened this issue Jan 8, 2025 · 4 comments
Assignees
Labels
backend Backend Development Must Have Ready for Development Automatically assigned to issues that are ready to be picked up

Comments

@Mephistic
Copy link
Collaborator

Mephistic commented Jan 8, 2025

Summary

Massachusetts has just started its new General Court session (Court 194). To handle this on the site, we need to update our code to handle the new crop of legislators in the new session (so that users can accurately determine who their representatives are so they know where to send testimony).

We should automatically start scraping legislative members as soon as we add court 194 to our set of court constants (handled in #1677) - but we don't currently update user profiles to point to their new representatives if they change.

Work Detail

  • Job/script that iterates over existing users who have added their representatives (known as members in Firestore) to their profile and updates those legislators
    • A user's representatives are stored under the representative and senator fields in the firestore profiles collection
    • All members are scraped and stored under generalCourts/{courtNumber}/members
    • We can safely ignore users who haven't added their representatives yet (since the search will start displaying the correct ones as soon as the new session is live).
    • We can determine legislator changes by comparing the names on the generalCourts/{courtNumber}/members entries who match on content.District (e.g. if the user's current representatives are not present in court 194 - find the members in court 194 whose districts match the districts of the user's current representatives and replace the old reps with the court 194 reps)
    • In some rare cases, there will be multiple active members in court 193. This occurs when a member is replaced partway through a session. If this causes any issues, we should consider only members with committee assignments (in content.Committee) - replaced legislators will have their committee assignments removed, so that seems to be the best way to determine the active legislator when there are multiple members for the same district in the same court session.

Omissions

  • We don't need to worry about this working for courts beyond 194 for this ticket - we'll likely implement a longer-term fix here before the next court session in two years
@Mephistic Mephistic added Must Have backend Backend Development labels Jan 8, 2025
@mvictor55
Copy link
Collaborator

New legislators are up!

List of new legislators (note that there are some "new" legislators who are just switching from rep to senate, so they are already in our db): https://www.acecma.org/about/news/new-legislators-to-join-massachusetts-legislature-in-2025-5858

I don't think we need to worry about Matt K's last point above for now (when a legislator resigns mid-session). Let's get the new names into the system, delete the legislators who are no longer in office, and run the script to update our users' profiles

@Mephistic
Copy link
Collaborator Author

Going to split this issue - the court 194 stuff is really meaty enough on its own that we should address/tackle it separately first before digging into updating the user profile legislators.

@Mephistic
Copy link
Collaborator Author

Created a separate issue to getting the court 194 data into the system: #1677

This job can start development independently of that ticket, but I wouldn't expect it to really work until that ticket is done, so this is semi-blocked on that.

@Mephistic Mephistic added the Ready for Development Automatically assigned to issues that are ready to be picked up label Mar 3, 2025
@SamuelBuhan
Copy link
Collaborator

Just create a PR for this issue #1755.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Backend Development Must Have Ready for Development Automatically assigned to issues that are ready to be picked up
Projects
None yet
Development

No branches or pull requests

3 participants