Skip to content

Upgrade AI analysis guide to v4.0 and improve all news workflow prompts for quality#1534

Merged
pethers merged 15 commits intomainfrom
copilot/improve-ai-driven-analysis-guides
Apr 3, 2026
Merged

Upgrade AI analysis guide to v4.0 and improve all news workflow prompts for quality#1534
pethers merged 15 commits intomainfrom
copilot/improve-ai-driven-analysis-guides

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 3, 2026

  • Upgrade ai-driven-analysis-guide.md to v4.0
  • Improve SHARED_PROMPT_PATTERNS.md with stronger AI content generation prompts
  • Improve news-article-generator.md with AI-driven content quality enforcement
  • Improve individual news workflow prompts (committee-reports, propositions, motions, interpellations, realtime-monitor, week-ahead)
  • Address review round 1: fix header date scope, clarify step numbering, fix BANNED pattern descriptions
  • Address review round 2: fix analysis path variable (ANALYSIS_SUBFOLDER), standardize chart-data class naming across both docs
  • Address review round 3: add ANALYSIS_SUBFOLDER mapping snippet, fix reference URLs, standardize chart type identifiers across both docs
  • Address review round 4: align visualization with data-chart-config canvas convention, expand ANALYSIS_SUBFOLDER mapping for breaking/opposition-motions
  • Address review round 5: align visualization JSON examples with actual Chart.js config schema (type/data/options), add interpellation-debates mapping, fix inline script reference
  • Address review round 6: fix visualization types table (SWOT/Risk→Chart.js not D3.js), clarify scope: news articles use Chart.js/D3.js, markdown analysis uses Mermaid
  • Address review round 7: add government-propositions→propositions mapping, fix Step 3a in analysis guide to use ANALYSIS_SUBFOLDER with slug→folder mapping table
  • Address review round 8: clarify that canvas[data-chart-config] requires explicit client-side initializer to render charts
  • Address review round 9: replace hard-coded date/event example in news-week-ahead.md Step 3c with dynamic MCP data placeholder

Copilot AI and others added 5 commits April 3, 2026 16:54
…y improvements

- Add 2026-04-03 systemic quality audit (444+ generic filler, 456+ excuse-as-analysis, 210+ boilerplate instances)
- Add AI Article Content Generation Protocol with 5 mandatory sections and detailed prompts
- Add Visualization Integration Protocol (Chart.js/D3.js) with 7 chart types
- Add Policy Domain Inference Protocol with Riksdag committee-to-domain mapping table
- Add Pre-Article Analysis Integration requirement (read analysis BEFORE generating articles)
- Add AI Self-Evaluation Quality Gate (replaces disabled stub in helpers.ts)
- Add Empty Analysis Fallback Protocol (MCP direct retrieval when scripts report 0 documents)
- Add cumulative quality tracking across audits

Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/2280838a-2191-4afd-b933-716c9e518e38

Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
…tocol

- Replace quality issues section with 2026-04-03 systemic audit (10 issues with scope data)
- Add BANNED content patterns list (8 specific text patterns that trigger article rejection)
- Add Article Quality Self-Check protocol (13 checks across 3 dimensions)
- Add AI Article Content Generation section with 5 mandatory steps and prompts
- Add Visualization Data Generation protocol (Chart.js/D3.js JSON data templates)
- Update methodology reference from v3.0 to v4.0

Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/2280838a-2191-4afd-b933-716c9e518e38

Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
Each workflow now has a mandatory Step 3c that:
- Reads pre-computed analysis before generating article content
- Scans for and replaces BANNED content patterns (generic filler, boilerplate, excuses)
- Enforces per-document unique "Why It Matters" analysis
- Requires minimum analytical depth (lede, winners/losers, takeaways, references)
- Includes self-quality check against 5-dimension rubric
- Adds article-type-specific intelligence requirements

Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/2280838a-2191-4afd-b933-716c9e518e38

Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
@github-actions github-actions bot added documentation Documentation updates workflow GitHub Actions workflows ci-cd CI/CD pipeline changes news News articles and content generation agentic-workflow Agentic workflow changes size-l Large change (250-1000 lines) labels Apr 3, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 3, 2026

🏷️ Automatic Labeling Summary

This PR has been automatically labeled based on the files changed and PR metadata.

Applied Labels: documentation,workflow,ci-cd,size-l,news,agentic-workflow

Label Categories

  • 🗳️ Content: news, dashboard, visualization, intelligence
  • 💻 Technology: html-css, javascript, workflow, security
  • 📊 Data: cia-data, riksdag-data, data-pipeline, schema
  • 🌍 I18n: i18n, translation, rtl
  • 🔒 ISMS: isms, iso-27001, nist-csf, cis-controls
  • 🏗️ Infrastructure: ci-cd, deployment, performance, monitoring
  • 🔄 Quality: testing, accessibility, documentation, refactor
  • 🤖 AI: agent, skill, agentic-workflow

For more information, see .github/labeler.yml.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 3, 2026

🔍 Lighthouse Performance Audit

Category Score Status
Performance 85/100 🟡
Accessibility 95/100 🟢
Best Practices 90/100 🟢
SEO 95/100 🟢

📥 Download full Lighthouse report

Budget Compliance: Performance budgets enforced via budget.json

Copilot AI requested a review from pethers April 3, 2026 17:31
@pethers pethers marked this pull request as ready for review April 3, 2026 17:48
Copilot AI review requested due to automatic review settings April 3, 2026 17:48
Copy link
Copy Markdown
Contributor

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

Upgrades the AI analysis methodology to v4.0 and strengthens all news-generation workflow prompts to prevent template-driven boilerplate from being published as “analysis,” based on the 2026-04-03 quality audit.

Changes:

  • Updates the AI-driven analysis guide to v4.0 with mandatory AI-only article sections, visualization data protocols, policy-domain inference rules, and an AI self-evaluation quality gate.
  • Expands shared prompt patterns with 2026-04-03 systemic audit findings, banned content patterns, and a mandatory self-check protocol.
  • Adds “AI Content Quality Enforcement (v4.0)” steps across news workflows (committee reports, propositions, motions, interpellations, realtime monitor, week-ahead, and multi-type generator).

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
analysis/methodologies/ai-driven-analysis-guide.md Bumps methodology to v4.0 and adds detailed protocols (AI-only prose, visualizations, classification, quality gate, empty-analysis fallback).
.github/workflows/SHARED_PROMPT_PATTERNS.md Centralizes 2026-04-03 audit findings, banned patterns, self-check rubric, and copy-paste content-generation/visualization protocols.
.github/workflows/news-week-ahead.md Adds v4.0 content-quality enforcement tailored for forward-looking week-ahead intelligence.
.github/workflows/news-realtime-monitor.md Adds v4.0 enforcement requirements for breaking-news quality and visualization expectations.
.github/workflows/news-propositions.md Adds v4.0 enforcement steps to ensure proposition articles replace all script stubs with evidence-based analysis.
.github/workflows/news-motions.md Adds v4.0 enforcement steps emphasizing per-motion uniqueness, counts consistency, and committee-based domains.
.github/workflows/news-interpellations.md Adds v4.0 enforcement steps emphasizing minister-response integration and replacing stub content.
.github/workflows/news-committee-reports.md Adds v4.0 enforcement steps to require analysis-file reading and replacement of boilerplate across committee reports.
.github/workflows/news-article-generator.md Adds v4.0 enforcement for the multi-type generator, including banned-pattern scanning and minimum depth requirements.

Comment on lines +281 to +288
## 📊 TOP 10 QUALITY ISSUES IN CURRENT ARTICLES (2026-04-02 + 2026-04-03)

> **Quality audit findings** — these issues MUST be addressed by improving all agentic workflow prompts. Updated from 2026-04-01 audit with additional 2026-04-02 findings.
> **Quality audit findings** — these issues MUST be addressed by improving all agentic workflow prompts. Updated with 2026-04-03 systemic audit results.

````markdown
### Quality Issues Detected in 2026-04-02 Articles

These issues were identified across all articles generated on 2026-04-02. ALL workflow `.md` files must be updated to prevent these issues.

| # | Issue | Severity | Affected Workflows | Root Cause |
|---|-------|----------|-------------------|------------|
| 1 | **3 of 5 articles have placeholder meta descriptions** ("Analysis of N documents covering Field:, Field:") | CRITICAL | committee-reports, propositions, interpellations | Script generates meta description from template, AI doesn't overwrite |
| 2 | **Generic title suffix "Defense in Focus" repeated** across 3 unrelated article types | CRITICAL | committee-reports, propositions, interpellations | Script generates title from category label, AI doesn't generate newsworthy title |
| 3 | **ZERO links to analysis files** in any news article | HIGH | ALL | No prompt instruction to include GitHub analysis references |
| 4 | **Truncated Swedish text in English articles** — proposition excerpts cut off mid-sentence | HIGH | propositions | Script truncates text; AI should translate/summarize instead |
| 5 | **Cross-reference map reports "0 relationships"** despite clear document clusters | HIGH | ALL analysis | AI cross-reference detection prompt too weak |
| 6 | **SWOT tables use prose** instead of structured evidence tables with dok_id columns | HIGH | committee-reports, interpellations, motions | Prompt doesn't require evidence table format |
| 7 | **Only 3 of 8 stakeholder groups** analyzed in some articles | HIGH | committee-reports, propositions | Prompt only asks for 3 perspectives |
| 8 | **Risk assessment contradictions** — RSK-04 says "LOW RISK" but cites evidence proving strength | MEDIUM | analysis risk-assessment.md | AI doesn't validate label-evidence consistency |
| 9 | **No "Forward Indicators" section** with specific trigger dates | MEDIUM | committee-reports, interpellations, motions | Prompt doesn't require dated triggers |
| 10 | **Generic boilerplate** repeated across articles ("Requires committee review...") | MEDIUM | committee-reports, propositions | Template-driven generation without per-document customization |

#### Workflow Fix Requirements (Updated 2026-04-02)

Every `news-*.md` workflow MUST be updated to:

1. **AI-generate titles**: Add explicit prompt instruction — AI MUST generate a unique, newsworthy title from actual document content; NEVER use template patterns like "Category: Topic This Week: Defense in Focus"
2. **AI-generate meta descriptions**: Add explicit prompt instruction — AI MUST write a 150-160 character description highlighting key political intelligence; NEVER use "Analysis of N documents covering Field:, Field:"
3. **Include analysis references**: Add "📊 Analysis & Sources" section linking to `https://github.com/Hack23/riksdagsmonitor/blob/main/analysis/daily/${DATE}/${ARTICLE_TYPE}/` files
4. **AI-translate, don't truncate**: AI MUST translate/summarize Swedish text for English articles; NEVER paste truncated Swedish text
5. **Require cross-reference detection**: AI MUST identify ≥3 document relationships per date (policy clusters, legislative chains, opposition patterns)
6. **Require structured SWOT tables**: Add HTML table template with `#`, `Statement`, `Evidence (dok_id)`, `Confidence`, `Impact` columns
7. **Require 8 stakeholder groups**: Update prompt to list all 8 groups with instructions for evidence per group
8. **Validate label-evidence consistency**: AI MUST verify risk labels match their cited evidence direction
9. **Require dated forward indicators**: Add "What to Watch" with specific committee dates and vote schedules
10. **Ban boilerplate**: Add anti-pattern list of rejected phrases: "Requires committee review and chamber debate", "Defense in Focus", "Analysis of N documents"
### Systemic Quality Issues (2026-04-03 Audit)

> 🔴 **CRITICAL**: The 2026-04-03 audit revealed that deprecated template functions are the PRIMARY source of low-quality content in 85%+ of articles. AI agents MUST overwrite ALL template-generated content.
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

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

The section title says the “TOP 10 QUALITY ISSUES” cover “2026-04-02 + 2026-04-03”, but the content that follows only documents the 2026-04-03 audit. Either re-add a 2026-04-02 subsection (or summarize it) or rename this header to avoid implying both dates are covered.

Copilot uses AI. Check for mistakes.
Comment on lines +695 to +697
### Step 3d: AI Content Quality Enforcement (v4.0 — MANDATORY)

> 🚨 **v4.0 CRITICAL**: The AI MUST read pre-computed analysis and rewrite ALL script-generated stub content. See `SHARED_PROMPT_PATTERNS.md` §"AI ARTICLE CONTENT GENERATION" and `ai-driven-analysis-guide.md` v4.0.
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

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

PR description calls out “Step 3c” enforcement across workflows, but this workflow introduces the enforcement section as “Step 3d”. If the numbering difference is intentional (because Step 3c is already used for title/meta here), consider aligning the label with the PR description (or adjust the PR description) to avoid confusion when following the instructions.

Copilot uses AI. Check for mistakes.
Comment on lines +640 to +644
**2. Scan for BANNED content patterns** — Search each generated article for these strings and REPLACE them:
- `"The political landscape remains fluid"` → Replace with specific winners/losers
- `"No chamber debate data is available"` → Replace with analysis from document text or MCP debate data
- `"Touches on {X} policy."` followed by generic domain text → Replace with unique per-document analysis
- `"Analysis of N documents covering"` → Replace with analytical lede
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

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

The “Scan for BANNED content patterns” list mixes literal strings with placeholder patterns (e.g., “Touches on {X} policy.”). Because generated articles won’t contain “{X}”, this can be misread as an exact-string search and miss the actual boilerplate. Consider rephrasing these bullets as pattern/prefix matches (e.g., any “Touches on … policy” boilerplate) so the enforcement step is unambiguous.

Suggested change
**2. Scan for BANNED content patterns** — Search each generated article for these strings and REPLACE them:
- `"The political landscape remains fluid"` → Replace with specific winners/losers
- `"No chamber debate data is available"` → Replace with analysis from document text or MCP debate data
- `"Touches on {X} policy."` followed by generic domain text → Replace with unique per-document analysis
- `"Analysis of N documents covering"` → Replace with analytical lede
**2. Scan for BANNED content patterns** — Search each generated article for these exact strings or equivalent boilerplate patterns and REPLACE them:
- Exact string: `"The political landscape remains fluid"` → Replace with specific winners/losers
- Exact string: `"No chamber debate data is available"` → Replace with analysis from document text or MCP debate data
- Pattern/prefix match: any `"Touches on ... policy."` boilerplate followed by generic domain text → Replace with unique per-document analysis
- Pattern/prefix match: any boilerplate starting with `"Analysis of "`, followed by a document count and `" documents covering"` → Replace with analytical lede

Copilot uses AI. Check for mistakes.
@pethers
Copy link
Copy Markdown
Member

pethers commented Apr 3, 2026

@copilot apply changes based on the comments in this thread

…p numbering, rephrase BANNED patterns as prefix matches

- SHARED_PROMPT_PATTERNS.md: Rename header from "2026-04-02 + 2026-04-03" to "2026-04-03 Systemic Audit" with note that it supersedes earlier spot-check findings
- news-interpellations.md: Add note explaining why Step 3d (not 3c) is used — Step 3b/3c already taken by Cross-Reference and Title/Meta steps
- news-article-generator.md: Rephrase BANNED patterns as exact-string vs pattern/prefix matches to avoid confusion with {X} placeholders

Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/6416b0bb-fb0e-4104-b5e4-8a08b90c3b15

Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 3, 2026

@copilot apply changes based on the comments in this thread

All three review comments addressed in 91f0719:

  1. SHARED_PROMPT_PATTERNS.md header — Renamed from "2026-04-02 + 2026-04-03" to "2026-04-03 Systemic Audit" with a note that it supersedes the earlier spot-check findings.
  2. news-interpellations.md Step 3d — Added a note explaining the numbering: interpellations uses Step 3d because Step 3b (Cross-Reference Minister Responses) and Step 3c (AI Title/Meta) are already taken. All other workflows use Step 3c.
  3. news-article-generator.md BANNED patterns — Rephrased as explicit "exact string" vs "pattern/prefix match" entries so enforcement is unambiguous (no {X} placeholders that could be misread as literal search targets).

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 3, 2026

🔍 Lighthouse Performance Audit

Category Score Status
Performance 85/100 🟡
Accessibility 95/100 🟢
Best Practices 90/100 🟢
SEO 95/100 🟢

📥 Download full Lighthouse report

Budget Compliance: Performance budgets enforced via budget.json

Copy link
Copy Markdown
Contributor

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 9 out of 9 changed files in this pull request and generated 2 comments.

Comment on lines +372 to +382
if [ -z "${ANALYSIS_SUBFOLDER:-}" ]; then
case "${ARTICLE_TYPE}" in
committee-reports) ANALYSIS_SUBFOLDER="committeeReports" ;;
opposition-motions) ANALYSIS_SUBFOLDER="motions" ;;
interpellation-debates) ANALYSIS_SUBFOLDER="interpellations" ;;
breaking)
: "${HHMM:?HHMM must be set for breaking articles to resolve realtime-\${HHMM} analysis folder}"
ANALYSIS_SUBFOLDER="realtime-${HHMM}"
;;
*) ANALYSIS_SUBFOLDER="${ARTICLE_TYPE}" ;;
esac
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

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

The article slug → analysis subfolder mapping block is missing a case for government-propositions. In this repo the propositions workflow uses ARTICLE_TYPE="government-propositions" but reads analysis from analysis/daily/${ARTICLE_DATE}/propositions/ (see .github/workflows/news-propositions.md). As written, the default branch would set ANALYSIS_SUBFOLDER="government-propositions" and point to a non-existent analysis folder. Add an explicit mapping to propositions (and ensure any other non-identity slugs are covered).

Copilot uses AI. Check for mistakes.
Comment on lines +1500 to +1506
1. `analysis/daily/${ARTICLE_DATE}/${ARTICLE_TYPE}/synthesis-summary.md` → Extract key findings, risk levels, confidence scores
2. `analysis/daily/${ARTICLE_DATE}/${ARTICLE_TYPE}/swot-analysis.md` → Extract top S/W/O/T entries for Winners & Losers
3. `analysis/daily/${ARTICLE_DATE}/${ARTICLE_TYPE}/risk-assessment.md` → Extract risk scores for Strategic Context
4. `analysis/daily/${ARTICLE_DATE}/${ARTICLE_TYPE}/stakeholder-perspectives.md` → Extract stakeholder impacts
5. `analysis/daily/${ARTICLE_DATE}/${ARTICLE_TYPE}/significance-scoring.md` → Extract significance scores for prioritization
6. Per-document analysis files in `documents/` subfolder → Extract per-document "Why It Matters"

Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

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

This new Step 3a snippet uses analysis/daily/${ARTICLE_DATE}/${ARTICLE_TYPE}/..., but several workflows use hyphenated ARTICLE_TYPE values that do not match the analysis folder names (e.g. committee-reportscommitteeReports, government-propositionspropositions, opposition-motionsmotions). As a result, following these instructions would read from the wrong/non-existent directory. Update the snippet to use ${ANALYSIS_SUBFOLDER} (or clearly define that ${ARTICLE_TYPE} here must be the analysis subfolder name) and reference the slug→folder mapping used in the workflows.

Suggested change
1. `analysis/daily/${ARTICLE_DATE}/${ARTICLE_TYPE}/synthesis-summary.md` → Extract key findings, risk levels, confidence scores
2. `analysis/daily/${ARTICLE_DATE}/${ARTICLE_TYPE}/swot-analysis.md` → Extract top S/W/O/T entries for Winners & Losers
3. `analysis/daily/${ARTICLE_DATE}/${ARTICLE_TYPE}/risk-assessment.md` → Extract risk scores for Strategic Context
4. `analysis/daily/${ARTICLE_DATE}/${ARTICLE_TYPE}/stakeholder-perspectives.md` → Extract stakeholder impacts
5. `analysis/daily/${ARTICLE_DATE}/${ARTICLE_TYPE}/significance-scoring.md` → Extract significance scores for prioritization
6. Per-document analysis files in `documents/` subfolder → Extract per-document "Why It Matters"
Use `${ANALYSIS_SUBFOLDER}` for analysis paths, not the public `${ARTICLE_TYPE}` slug. The workflows map article slugs to analysis folders, for example:
- `committee-reports``committeeReports`
- `government-propositions``propositions`
- `opposition-motions``motions`
1. `analysis/daily/${ARTICLE_DATE}/${ANALYSIS_SUBFOLDER}/synthesis-summary.md` → Extract key findings, risk levels, confidence scores
2. `analysis/daily/${ARTICLE_DATE}/${ANALYSIS_SUBFOLDER}/swot-analysis.md` → Extract top S/W/O/T entries for Winners & Losers
3. `analysis/daily/${ARTICLE_DATE}/${ANALYSIS_SUBFOLDER}/risk-assessment.md` → Extract risk scores for Strategic Context
4. `analysis/daily/${ARTICLE_DATE}/${ANALYSIS_SUBFOLDER}/stakeholder-perspectives.md` → Extract stakeholder impacts
5. `analysis/daily/${ARTICLE_DATE}/${ANALYSIS_SUBFOLDER}/significance-scoring.md` → Extract significance scores for prioritization
6. Per-document analysis files in `analysis/daily/${ARTICLE_DATE}/${ANALYSIS_SUBFOLDER}/documents/` subfolder → Extract per-document "Why It Matters"

Copilot uses AI. Check for mistakes.
@pethers
Copy link
Copy Markdown
Member

pethers commented Apr 3, 2026

@copilot apply changes based on the comments in this thread

…ing, fix Step 3a to use ANALYSIS_SUBFOLDER

1. SHARED_PROMPT_PATTERNS.md case block — Added government-propositions→propositions
   mapping so the propositions workflow resolves to the correct analysis folder.
2. ai-driven-analysis-guide.md Step 3a — Replaced ${ARTICLE_TYPE} with
   ${ANALYSIS_SUBFOLDER} in all 6 analysis path references, added slug→folder
   mapping table (committee-reports→committeeReports, government-propositions→propositions,
   opposition-motions→motions, interpellation-debates→interpellations).

Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/21218a71-4ac7-4873-9c6c-17eb9a12ba38

Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 3, 2026

@copilot apply changes based on the comments in this thread

Both review comments addressed in 9d06eaa:

  1. SHARED_PROMPT_PATTERNS.md case block — Added government-propositionspropositions mapping (line 375) so the propositions workflow resolves to the correct analysis folder.
  2. ai-driven-analysis-guide.md Step 3a — Replaced all ${ARTICLE_TYPE} with ${ANALYSIS_SUBFOLDER} in the 6 analysis path references, and added slug→folder mapping table (committee-reportscommitteeReports, government-propositionspropositions, opposition-motionsmotions, interpellation-debatesinterpellations).

@copilot apply changes based on the comments in this thread only news articles should use d3/chartjs...

All changes applied in 72daf75:

  1. ai-driven-analysis-guide.md visualization types table — Fixed SWOT from D3.jsChart.js (radar) and Risk from D3.jsChart.js (scatter) to match the Chart.js config examples and codebase (dashboard-section.ts, swot-section.ts).
  2. ai-driven-analysis-guide.md scope rule — Added explicit scope: "Chart.js / D3.js visualizations are for HTML news articles only. Markdown analysis files (.md) MUST use Mermaid diagrams for all visualizations."
  3. SHARED_PROMPT_PATTERNS.md scope rule — Same clarification added to the visualization data generation section.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 3, 2026

🔍 Lighthouse Performance Audit

Category Score Status
Performance 85/100 🟡
Accessibility 95/100 🟢
Best Practices 90/100 🟢
SEO 95/100 🟢

📥 Download full Lighthouse report

Budget Compliance: Performance budgets enforced via budget.json

Copy link
Copy Markdown
Contributor

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 9 out of 9 changed files in this pull request and generated 2 comments.

Comment on lines +1406 to +1411
Embed each visualization on the target `<canvas>` element using the existing
`data-chart-config` attribute convention used by the site renderer
(see `scripts/data-transformers/content-generators/dashboard-section.ts`).
Serialize a **complete, valid Chart.js configuration object** (with `type`, `data`, `options`)
into `data-chart-config`. Do **not** use `<script type="application/json" class="chart-data">`;
the rendering implementation reads configs from `canvas[data-chart-config]`.
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

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

The guide claims that “the rendering implementation reads configs from canvas[data-chart-config]”, but there is no client-side initializer in the repo that scans data-chart-config (no matches for canvas[data-chart-config], getAttribute('data-chart-config'), or dataset.chartConfig). As written, this can mislead workflow authors into thinking charts will render automatically in news articles; either reference the actual initializer module/script (and ensure it’s loaded on article pages) or rephrase to make the required initialization step explicit.

Suggested change
Embed each visualization on the target `<canvas>` element using the existing
`data-chart-config` attribute convention used by the site renderer
(see `scripts/data-transformers/content-generators/dashboard-section.ts`).
Serialize a **complete, valid Chart.js configuration object** (with `type`, `data`, `options`)
into `data-chart-config`. Do **not** use `<script type="application/json" class="chart-data">`;
the rendering implementation reads configs from `canvas[data-chart-config]`.
Embed each visualization on the target `<canvas>` element using a
`data-chart-config` attribute as the serialized handoff format
(for generation examples, see `scripts/data-transformers/content-generators/dashboard-section.ts`).
Serialize a **complete, valid Chart.js configuration object** (with `type`, `data`, `options`)
into `data-chart-config`. Do **not** use `<script type="application/json" class="chart-data">`.
**Important:** charts will render only if the target page loads a client-side initializer
that reads `canvas[data-chart-config]` and instantiates Chart.js from that JSON; do not
assume article pages perform this step automatically unless that initializer is explicitly present.

Copilot uses AI. Check for mistakes.
}
```

Embed each chart on the target `<canvas>` element using a `data-chart-config` attribute containing the full Chart.js configuration object. Do **not** emit `<script class="chart-data">` blocks; the site renderer reads configs from `canvas[data-chart-config]`.
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

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

This says “the site renderer reads configs from canvas[data-chart-config]”, but there’s no implementation in the repository that scans data-chart-config attributes to instantiate Chart.js charts. Without an initializer being referenced/loaded, copying this block into workflows will produce articles with non-rendering charts; please either link to the actual initializer (and ensure it’s included on news pages) or clarify that an explicit init step is required.

Suggested change
Embed each chart on the target `<canvas>` element using a `data-chart-config` attribute containing the full Chart.js configuration object. Do **not** emit `<script class="chart-data">` blocks; the site renderer reads configs from `canvas[data-chart-config]`.
Embed each chart on the target `<canvas>` element using a `data-chart-config` attribute containing the full Chart.js configuration object. Do **not** emit `<script class="chart-data">` blocks. Treat `data-chart-config` as the canonical hand-off format for chart data, but only use this pattern when the target page explicitly includes a chart initializer that scans `canvas[data-chart-config]` and instantiates the corresponding Chart.js chart; otherwise the chart will not render.

Copilot uses AI. Check for mistakes.
@pethers
Copy link
Copy Markdown
Member

pethers commented Apr 3, 2026

@copilot apply changes based on the comments in this thread

…lient-side initializer

Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/daa349dd-05a9-4766-a9a3-03877827573b

Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 3, 2026

@copilot apply changes based on the comments in this thread

Both review comments addressed in c6398e5:

  1. ai-driven-analysis-guide.md — Replaced "the rendering implementation reads configs from canvas[data-chart-config]" with explicit caveat: charts render only if the target page loads a client-side initializer that scans canvas[data-chart-config] and instantiates Chart.js; do not assume this happens automatically.
  2. SHARED_PROMPT_PATTERNS.md — Same clarification: data-chart-config is the canonical hand-off format, but charts will not render unless an explicit initializer is present on the page.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 3, 2026

🔍 Lighthouse Performance Audit

Category Score Status
Performance 85/100 🟡
Accessibility 95/100 🟢
Best Practices 90/100 🟢
SEO 95/100 🟢

📥 Download full Lighthouse report

Budget Compliance: Performance budgets enforced via budget.json

Copy link
Copy Markdown
Contributor

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 9 out of 9 changed files in this pull request and generated 1 comment.


**4. Generate government agenda preview** — List upcoming government actions (propositions expected, ministerial meetings, EU engagements) with political significance context.

**5. Replace generic filler** — Remove `"The political landscape remains fluid..."` and replace with specific forward indicators: "Watch: FöU committee scheduling GUTE II follow-up by April 15" with named triggers and dates.
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

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

Step 3c item 5 includes a hard-coded example date ("by April 15") and a specific case ("GUTE II"), which risks the agent reusing stale/incorrect dates or events in future runs. Recommend rephrasing this bullet to require forward indicators with dates extracted from get_calendar_events (or other MCP data) and to avoid fixed calendar dates in examples (use placeholders like "by " instead).

Suggested change
**5. Replace generic filler** — Remove `"The political landscape remains fluid..."` and replace with specific forward indicators: "Watch: FöU committee scheduling GUTE II follow-up by April 15" with named triggers and dates.
**5. Replace generic filler** — Remove `"The political landscape remains fluid..."` and replace it with specific forward indicators grounded in current MCP data. Use named triggers and dates extracted from `get_calendar_events` (or other MCP sources), and do not invent or reuse fixed example dates or case names. Preferred pattern: `"Watch: <committee/event> by <YYYY-MM-DD from calendar>"`.

Copilot uses AI. Check for mistakes.
@pethers
Copy link
Copy Markdown
Member

pethers commented Apr 3, 2026

@copilot apply changes based on the comments in this thread

… MCP data reference

Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/9b2f6f1f-0ba8-4d2e-9e13-70d932092210

Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 3, 2026

@copilot apply changes based on the comments in this thread

Both review comments addressed in c6398e5:

  1. ai-driven-analysis-guide.md — Replaced "the rendering implementation reads configs from canvas[data-chart-config]" with explicit caveat: charts render only if the target page loads a client-side initializer that scans canvas[data-chart-config] and instantiates Chart.js; do not assume this happens automatically.
  2. SHARED_PROMPT_PATTERNS.md — Same clarification: data-chart-config is the canonical hand-off format, but charts will not render unless an explicit initializer is present on the page.

@copilot apply changes based on the comments in this thread

Review comment addressed in 5b83912: Replaced the hard-coded "GUTE II" event name and "April 15" date in Step 3c item 5 with a dynamic pattern that requires sourcing event names, committees, and dates from MCP query results (get_calendar_events, get_betankanden). The example now uses <COMMITTEE>, <TOPIC>, <DATE from calendar> placeholders and explicitly states "Do NOT hard-code example dates or event names."

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 3, 2026

🔍 Lighthouse Performance Audit

Category Score Status
Performance 85/100 🟡
Accessibility 95/100 🟢
Best Practices 90/100 🟢
SEO 95/100 🟢

📥 Download full Lighthouse report

Budget Compliance: Performance budgets enforced via budget.json

Copy link
Copy Markdown
Contributor

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 9 out of 9 changed files in this pull request and generated no new comments.

@pethers pethers merged commit b051335 into main Apr 3, 2026
17 checks passed
@pethers pethers deleted the copilot/improve-ai-driven-analysis-guides branch April 3, 2026 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agentic-workflow Agentic workflow changes ci-cd CI/CD pipeline changes documentation Documentation updates news News articles and content generation size-l Large change (250-1000 lines) workflow GitHub Actions workflows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants