Skip to content

Smoss/scrape ma district pages#2145

Open
Smoss wants to merge 4 commits into
codeforboston:mainfrom
Smoss:smoss/scrape-ma-district-pages
Open

Smoss/scrape ma district pages#2145
Smoss wants to merge 4 commits into
codeforboston:mainfrom
Smoss:smoss/scrape-ma-district-pages

Conversation

@Smoss

@Smoss Smoss commented May 20, 2026

Copy link
Copy Markdown
Contributor

Summary

Checklist

  • On the frontend, I've made my strings translate-able.
  • If I've added shared components, I've added a storybook story.
  • I've made pages responsive and look good on mobile.
  • 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)

Screenshots

Add some screenshots highlighting your changes.

Known issues

If you've run against limitations or caveats, include them here. Include follow-up issues as well.

Steps to test/reproduce

For each feature or bug fix, create a step by step list for how a reviewer can test it out. E.g.:

  1. Go to the home page
  2. Click on a testimony
  3. See that it's loaded with a loading spinner

@vercel

vercel Bot commented May 20, 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 17, 2026 1:35am

Request Review

@Mephistic Mephistic left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM overall - just need to sync on which Legislator Profile Page to use as the base and we can merge this. Thanks for taking this on!

memberCode: z.string()
})

export default createPage<{

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we already have the skeleton for the legislator profile page here: https://github.com/codeforboston/maple/blob/main/pages/legislators/profile.tsx

It was added in #2113

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We discussed this at hack night - we've decided to go with this PR's approach of using the Member code as the base ID for the legislator profile page. This fits better with our V1, where the priority is supporting the page for Members who do not have profiles - when the majority of members will not have profiles at launch.

Longer term, we may move to a system that prioritizes the Profile ID (e.g. if we want to support non-Legislator Legislator Profiles such as for Candidates), but we've decided that is more effort than the alternative for the first pass (especially since that will require additional pipeline work). It should be simple enough to move from one approach to the other later if the need arises.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That said, we do want to integrate the feature flag here before merging - @mertbagt is aware of the two pages and is going to follow up with the work to integrate them

Smoss added 2 commits June 16, 2026 19:30
- Added functions to read district snapshots from files and strip ignored HTML tags.
- Updated `parseSecDistricts` to utilize the new function for cleaning HTML input.
- Introduced tests for parsing SEC snapshots in `parseSecDistricts.test.ts` to ensure correct district counts for Senate and House.
- Modified the scraping script to read HTML from local files if not fetching from the web.
- Implemented a feature flag to conditionally render the legislator profile page.
- Added a redirect to a 404 page if the feature flag for legislators is disabled.

@Mephistic Mephistic left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - thanks for jumping on the flag issue!

@Mephistic

Copy link
Copy Markdown
Collaborator

Just waiting on the unit tests to pass to merge!

- Removed unused imports and refactored test functions in `parseSecDistricts.test.ts` to build HTML snapshots for Senate and House districts.
- Updated the project configuration in `project.yml` to correct the formatting of the languages list.
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