Skip to content

feat(conference-week): update procedure voteDate after crawl#707

Merged
ManAnRuck merged 2 commits intomasterfrom
fix/set-vote-date-logic
Oct 28, 2025
Merged

feat(conference-week): update procedure voteDate after crawl#707
ManAnRuck merged 2 commits intomasterfrom
fix/set-vote-date-logic

Conversation

@ManAnRuck
Copy link
Member

This pull request introduces significant improvements to the conference week details import package, focusing on automated detection and updating of vote dates for Bundestag procedures. The main changes include the addition of a comprehensive data flow documentation, a new utility for updating vote dates, and refinements to the crawling strategy to prioritize upcoming sessions and votes.

Vote date automation and crawling improvements

  • Added a new utility function updateProcedureVoteDates in src/utils/update-vote-dates.ts that automatically updates the voteDate field in procedures based on the last five conference weeks with sessions, improving performance and ensuring current votes are prioritized.
  • Modified the main run logic in src/index.ts to call updateProcedureVoteDates after saving conference weeks, logging the number of procedures updated and handling errors gracefully. [1] [2]
  • Adjusted the crawling strategy in src/routes.ts to only crawl forward to future weeks, focusing on upcoming sessions and votes rather than historical data.

Documentation and developer guidance

  • Replaced the old feature list in README.md with a new summary emphasizing conference week scraping, vote detection, procedure linking, and automated vote date updates. Added a link to the new vote date flow documentation.
  • Added docs/votedate-flow.md, a detailed technical documentation with diagrams explaining the full vote date data flow, crawler strategy, validation logic, data models, performance optimizations, and troubleshooting steps for common issues.

Add a new utility to derive and batch-update Procedure.voteDate from saved conference week sessions (last 5 weeks) and call it after persisting conference weeks. Continue execution if the voteDate update fails and log results.

Also:
- Restrict crawler navigation to forward-only (enqueue next week only)
- Add comprehensive docs (docs/votedate-flow.md) and update README with features/documentation link
- Import and wire updateProcedureVoteDates in the main run flow
@ManAnRuck ManAnRuck requested a review from Copilot October 28, 2025 19:07
@ManAnRuck ManAnRuck self-assigned this Oct 28, 2025
@ManAnRuck ManAnRuck added the Bug label Oct 28, 2025
@ManAnRuck ManAnRuck moved this to ⚙️ In Progress in Democracy Oct 28, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds automatic voteDate synchronization from conference weeks to procedures and optimizes the crawler to focus on upcoming votes by crawling forward only.

Key changes:

  • New updateProcedureVoteDates utility that syncs vote dates from conference week sessions to procedures
  • Modified crawler to only enqueue future weeks (removed backward crawling)
  • Comprehensive documentation added explaining the voteDate flow with Mermaid diagrams

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/utils/update-vote-dates.ts New utility to batch update procedure voteDates from the last 5 conference weeks
src/index.ts Integrates voteDate update step after conference weeks are saved to DB
src/routes.ts Removes backward crawling by not enqueueing previousYear/previousWeek URLs
docs/votedate-flow.md Extensive documentation of the voteDate data flow with diagrams and troubleshooting
README.md Updated feature list to highlight voteDate functionality

Split updateProcedureVoteDates into smaller pure functions (extractProcedureIdsFromSession,
groupProcedureIdsByDate, fetchRecentConferenceWeeks, updateProceduresVoteDate) and keep the
orchestration in updateProcedureVoteDates. Add comprehensive unit tests for extraction and
grouping logic to improve correctness and prevent regressions. Export ISession type from the
ConferenceWeekDetail model and adjust package.json lint scripts to run lint:es and lint:ts.
These changes improve testability, readability and separation of concerns.

Signed-off-by: Manuel Ruck <git@manuelruck.de>
@ManAnRuck ManAnRuck requested a review from Copilot October 28, 2025 19:42
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.

@ManAnRuck ManAnRuck merged commit f6c3edd into master Oct 28, 2025
23 checks passed
@ManAnRuck ManAnRuck deleted the fix/set-vote-date-logic branch October 28, 2025 20:04
@github-project-automation github-project-automation bot moved this from ⚙️ In Progress to 🚀 Shipped in Democracy Oct 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: 🚀 Shipped

Development

Successfully merging this pull request may close these issues.

2 participants