Skip to content

feat(monthly-review): multi-month trends, party rankings, and legislative efficiency metrics#610

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/enhance-monthly-review-features
Draft

feat(monthly-review): multi-month trends, party rankings, and legislative efficiency metrics#610
Copilot wants to merge 2 commits intomainfrom
copilot/enhance-monthly-review-features

Conversation

Copy link
Contributor

Copilot AI commented Feb 26, 2026

Monthly reviews were functionally identical to weekly reviews — just a longer lookback window with the same generic content pipeline. This PR makes monthly reviews a distinct intelligence product.

New content sections (all 14 languages)

  • Month in Numbers — document counts by type, speech count, month-over-month delta, 3-month rolling average
  • Party Performance Rankings — parties ranked by combined motion + speech activity (top 8)
  • Legislative Efficiency — committee throughput rate (reports / propositions) + opposition motion context
  • Strategic Outlook — activity trajectory (accelerating/decelerating) + coalition stability from CIA context

Data pipeline changes

Added Step 6 to generateMonthlyReview: fetches previous 2 months of documents in parallel for trend comparison, then computes MonthlyMetrics inline:

const monthlyMetrics: MonthlyMetrics = {
  totalDocuments: documents.length,
  reportCount, propositionCount, motionCount,
  speechCount: speeches.length,
  previousMonthDocCount: prevMonthDocs.length,
  twoMonthsAgoDocCount: twoMonthsDocs.length,
  partyRankings,  // sorted by motionCount + speechCount
  legislativeEfficiencyRate: propositionCount > 0 ? reportCount / propositionCount : 0,
};

Architecture

  • Added MonthlyMetrics interface to data-transformers/types.ts; added optional monthlyMetrics field to ArticleContentData
  • Added generateMonthlyReviewContent to content-generators.ts — calls generateGenericContent for the base document list then appends the four new sections
  • data-transformers/index.ts now routes monthly-review to generateMonthlyReviewContent instead of the shared generic handler
  • MonthlyReviewValidationResult extended with hasPartyRankings, hasLegislativeEfficiency, hasMonthInNumbers
Original prompt

This section details on the original issue you should resolve

<issue_title>Improve Monthly Review: Add multi-month trends, party rankings, and legislative efficiency metrics</issue_title>
<issue_description>## 📋 Issue Type
Enhancement — Extend Monthly Review with multi-month trend analysis, party performance rankings, and strategic outlook

🎯 Objective

Enhance scripts/news-types/monthly-review.ts to provide comprehensive monthly trend analysis, party performance comparative rankings, legislative efficiency metrics, and a forward-looking strategic outlook. Transform monthly reviews from document summaries into the definitive monthly intelligence brief.

📊 Current State

  • File: scripts/news-types/monthly-review.ts (335 lines)
  • REQUIRED_TOOLS: 6 tools — same as weekly review (search_dokument, get_dokument_innehall, search_anforanden, get_betankanden, get_propositioner, get_motioner)
  • Enrichment pipeline: Same as weekly review but with 30-day lookback
  • Gap: Monthly reviews don't aggregate weekly patterns into monthly trends, lack party performance rankings, and don't include legislative efficiency metrics (bills passed vs introduced, committee throughput)
  • Impact: Monthly reviews are essentially longer weekly reviews instead of providing unique strategic monthly intelligence

🚀 Desired State

  • Multi-month trend analysis (3-month rolling averages for key metrics)
  • Party performance rankings (legislative output, speech frequency, voting discipline)
  • Legislative efficiency metrics (bill passage rates, committee throughput, government vs opposition success)
  • Coalition stability assessment (monthly trajectory of coalition cohesion)
  • Cross-party collaboration index (bills with multi-party support)
  • "Month in Numbers" summary statistics section
  • Strategic outlook section connecting monthly trends to upcoming legislative calendar
  • Historical comparison with same month in previous parliamentary terms

🔧 Implementation Approach

1. Multi-month trend aggregation (~80 lines)

// Fetch previous months for trend comparison
const previousMonthDocs = await mcpClient.call('search_dokument', {
  from_date: twoMonthsAgo,
  to_date: oneMonthAgo,
  limit: 100
});
  • Calculate month-over-month change rates
  • Identify accelerating/decelerating trends
  • Generate 3-month rolling metrics

2. Party performance rankings (~70 lines)

  • Rank parties by legislative output (propositions introduced, motions filed)
  • Rank by debate activity (anföranden frequency, question volume)
  • Rank by voting discipline (party cohesion percentage)
  • Create comparative party scorecard

3. Legislative efficiency metrics (~60 lines)

  • Bill passage rate: betänkanden adopted vs total
  • Government success rate: propositions reaching committee approval
  • Committee throughput: average days from referral to report
  • Opposition effectiveness: motions getting committee attention

4. "Month in Numbers" section (~40 lines)

  • Total documents processed by type
  • Total speeches and debate hours
  • Total votes and their outcomes
  • Key personnel changes or appointments

5. Enhanced article templates

  • Add "Month in Numbers" statistical summary
  • Add "Party Performance Rankings" table
  • Add "Legislative Efficiency" metrics
  • Add "Strategic Outlook" forward-looking section
  • Update all 14 language templates

🤖 Recommended Agent

code-quality-engineer — TypeScript enhancement with data aggregation patterns

✅ Acceptance Criteria

  • Multi-month trend analysis implemented (3-month rolling)
  • Party performance rankings calculated and rendered
  • Legislative efficiency metrics calculated (passage rates, throughput)
  • "Month in Numbers" summary section added
  • Strategic outlook section connects trends to upcoming calendar
  • Article templates include all new sections
  • All 14 language templates updated
  • Monthly reviews are substantively different from weekly reviews
  • Article quality validation passes
  • No regression in existing monthly review generation

📚 References

  • File: scripts/news-types/monthly-review.ts
  • Weekly review pattern: scripts/news-types/weekly-review.ts (base enrichment pipeline)
  • Risk analysis: scripts/data-transformers/risk-analysis.ts
  • Policy analysis: scripts/data-transformers/policy-analysis.ts
  • Document analysis: scripts/data-transformers/document-analysis.ts
  • CIA methodology: Hack23/cia BUSINESS_PRODUCT_DOCUMENT.md (party performance metrics)
    </issue_description>

<agent_instructions>Extend monthly-review articles in scripts/news-types/monthly-review.ts with multi-month trend analysis, party performance rankings, and legislative efficiency metrics. Add "Month in Numbers" and "Party Performance Rankings" template sections. Leverage data-transformers for analysis. Run tests with npx vitest run.</agent_instructions>

Comments on the Issue (you are @copilot in this ...


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…islative efficiency metrics

- Add MonthlyMetrics interface to data-transformers/types.ts
- Add generateMonthlyReviewContent to content-generators.ts with 4 new sections
  in all 14 languages: Month in Numbers, Party Performance Rankings,
  Legislative Efficiency, and Strategic Outlook
- Route monthly-review type to the new generator in data-transformers/index.ts
- Fetch previous 2 months for 3-month rolling trend analysis in monthly-review.ts
- Compute party rankings from motion/speech parti fields
- Compute legislative efficiency rate (reports / propositions)
- Extend MonthlyReviewValidationResult with hasPartyRankings, hasLegislativeEfficiency,
  hasMonthInNumbers fields and corresponding check functions
- Add 6 new tests covering all new sections and features

Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
Copilot AI changed the title [WIP] Enhance monthly review with multi-month trends and metrics feat(monthly-review): multi-month trends, party rankings, and legislative efficiency metrics Feb 26, 2026
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.

Improve Monthly Review: Add multi-month trends, party rankings, and legislative efficiency metrics

2 participants