codeforboston / codeforboston/maple
Update Legislators for New Court 194
- Dominant language
- TypeScript
- Stars
- 56
- Forks
- 175
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 13
Description
**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 https://github.com/codeforboston/maple/issues/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 `member`s 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
Contributor guide
Assessment
This issue has not been assessed yet.