Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions .github/workflows/news-article-generator.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,66 @@ Use this to enrich political analysis with economic context (GDP, unemployment,
Key Swedish indicators and Nordic comparison data are documented in `scripts/world-bank-context.ts`.
Reference: https://github.com/anshumax/world_bank_mcp_server

**Committee-mapped indicators** (14 indicators → all 15 Riksdag committees):
| Indicator | World Bank ID | Committees |
|-----------|---------------|------------|
| GDP Growth | NY.GDP.MKTP.KD.ZG | FiU |
| Unemployment | SL.UEM.TOTL.ZS | AU |
| Inflation | FP.CPI.TOTL.ZG | FiU |
| Gov. Expenditure | GC.XPN.TOTL.GD.ZS | FiU |
| Trade Openness | NE.TRD.GNFS.ZS | NU, UU |
| Military Expenditure | MS.MIL.XPND.GD.ZS | FöU |
| CO₂ Emissions | EN.ATM.CO2E.PC | MJU |
| R&D Expenditure | GB.XPD.RSDV.GD.ZS | UbU |
| GINI Index | SI.POV.GINI | SoU, AU |
| Current Account | BN.CAB.XOKA.GD.ZS | FiU, NU |
| Tax Revenue | GC.TAX.TOTL.GD.ZS | SkU, FiU |
| Rule of Law | RL.EST | KU, JuU |
| Voice & Accountability | VA.EST | KU |
| Gov. Effectiveness | GE.EST | KU, FiU |

### 📈 Swedish Statistics (SCB MCP)

The **scb** MCP server provides official Swedish statistics via `search_tables` and `get_table_data` tools.
Use this to enrich articles with domestic data from Statistics Sweden (Statistiska centralbyrån).
Key SCB domain-to-committee mappings are documented in `scripts/scb-context.ts`.

**Committee-mapped SCB domains** (15 domains → all 15 Riksdag committees):
| Domain | Key SCB Tables | Committees |
|--------|---------------|------------|
| Fiscal (offentliga finanser) | TAB1291, TAB1292 | FiU |
| Defence (försvar) | — | FöU |
| Environment (växthusgaser) | TAB5404, TAB5407 | MJU |
| Education (utbildning) | TAB4787, TAB4790 | UbU |
| Healthcare (sjukvård) | — | SoU |
| Migration (invandring) | TAB637, TAB4230 | SfU |
| EU/Foreign Trade (utrikeshandel) | TAB2661 | NU, UU |
| Justice (brottslighet) | TAB1172 | JuU |
| Labour (arbetslöshet) | TAB5765, TAB5616 | AU |
| Housing (bostäder) | TAB2052, TAB4709 | CU |
| Transport (trafik) | — | TU |
| Trade/GDP (BNP) | TAB5802, TAB5803 | FiU, NU |
| Taxation (skatter) | TAB1291 | SkU, FiU |
| Culture (kultur, fritid) | TAB5195 | KrU |
| Governance (demokrati) | — | KU |

### 🔍 Statistical Claims Fact-Checking

When generating articles about parliamentary debates or speeches, use `scripts/statistical-claims-detector.ts`
to detect and fact-check politician statistical claims against official World Bank and SCB data.

**How to use:**
1. When processing speeches/debates from `search_anforanden`, scan for statistical claims
2. Cross-reference claimed values against World Bank (`get_indicator_for_country`) and SCB (`get_table_data`)
3. Rate claims: accurate (≤5% deviation), mostly-accurate (5-15%), misleading (15-30%), inaccurate (>30%)
4. Include a "Faktakoll / Fact Check" section in articles with detected claims
5. Use localized headings from `scripts/statistical-claims-detector.ts` FACT_CHECK_HEADINGS

**Example patterns detected:**
- "Arbetslösheten ligger på 7.2 procent" → verify against SCB TAB5765 + World Bank SL.UEM.TOTL.ZS
- "BNP växer med 2.3 procent" → verify against SCB TAB5802 + World Bank NY.GDP.MKTP.KD.ZG
- "Försvarsutgifterna uppgår till 2.1 procent av BNP" → verify against World Bank MS.MIL.XPND.GD.ZS

### 🔐 Security & Workflow Skills

14. **`.github/skills/gh-aw-safe-outputs/SKILL.md`** — Safe-outputs MCP server, create_pull_request tool, container isolation workarounds, noop vs failure handling
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/news-committee-reports.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ Before generating ANY articles, verify MCP connectivity:

**Primary tool:** `get_betankanden` — fetches latest committee reports
**Cross-reference:** `search_voteringar`, `search_anforanden`, `get_propositioner`
**Statistical enrichment:** SCB MCP + World Bank — enrich with data matching the reporting committee. Use domain-to-committee mappings from `scripts/scb-context.ts` (e.g., FiU reports→fiscal TAB1291, AU→labour TAB5765, JuU→crime TAB1172, MJU→environment TAB5404). World Bank indicators are mapped per committee in `scripts/world-bank-context.ts` (14 indicators covering all 15 committees).
**Fact-checking:** Use `scripts/statistical-claims-detector.ts` to detect statistical claims in related debates and cross-reference against official SCB/World Bank data.

```javascript
get_sync_status({})
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/news-evening-analysis.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,18 @@ Use this to enrich political analysis with economic context (GDP, unemployment,
Key Swedish indicators and Nordic comparison data are documented in `scripts/world-bank-context.ts`.
Reference: https://github.com/anshumax/world_bank_mcp_server

**Key committee-mapped indicators**: GDP Growth→FiU, Unemployment→AU, Tax Revenue→SkU, Rule of Law→KU, Military Expenditure→FöU, CO₂→MJU, R&D→UbU, GINI→SoU/AU, Trade→NU/UU (see `scripts/world-bank-context.ts` for complete mapping of 14 indicators to all 15 committees).

### 📈 Swedish Statistics (SCB MCP)

The **scb** MCP server provides official Swedish statistics via `search_tables` and `get_table_data` tools.
Use SCB data for domestic context: labour market (TAB5765), migration (TAB637), GDP (TAB5802), crime (TAB1172), housing (TAB2052), education (TAB4787), taxation (TAB1291), culture (TAB5195).
Full domain-to-committee mapping in `scripts/scb-context.ts` (15 domains → all 15 Riksdag committees).

### 🔍 Statistical Claims Fact-Checking

When analysing parliamentary speeches/debates, detect and fact-check politician statistical claims against World Bank and SCB data. Use `scripts/statistical-claims-detector.ts` patterns to identify claims about unemployment, GDP, inflation, migration, crime, defence spending. Cross-reference against official sources and include a "Faktakoll / Fact Check" section rating claims as accurate/mostly-accurate/misleading/inaccurate.

### 🔐 Workflow & Security Skills

13. **`.github/skills/gh-aw-safe-outputs/SKILL.md`** — Safe-outputs tools, PR creation, container isolation fixes
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/news-month-ahead.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ Before generating ANY articles, verify MCP connectivity:

**Primary tool:** `get_calendar_events` — 30-day forward calendar
**Cross-reference:** `get_propositioner`, `search_dokument`, `search_regering`
**Statistical enrichment:** SCB/World Bank — for major economic milestones (budget debates, economic policy events), pre-fetch trend data from committee-mapped indicators. See `scripts/scb-context.ts` for 15 domain→committee mappings and `scripts/world-bank-context.ts` for 14 WB indicator→committee mappings.

```javascript
get_sync_status({})
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/news-monthly-review.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ Before generating ANY articles, verify MCP connectivity:

**Primary tools:** `search_dokument`, `get_betankanden` — comprehensive document search
**Cross-reference:** `get_propositioner`, `get_motioner`, `search_voteringar`, `analyze_g0v_by_department`
**Statistical enrichment:** SCB MCP — enrich monthly review with key economic indicators (GDP, unemployment, inflation)
**Statistical enrichment:** SCB MCP + World Bank — enrich monthly review with comprehensive economic context across all active policy areas. Fetch key indicators: GDP growth (TAB5802 + NY.GDP.MKTP.KD.ZG), unemployment (TAB5765 + SL.UEM.TOTL.ZS), inflation (FP.CPI.TOTL.ZG), tax revenue (TAB1291 + GC.TAX.TOTL.GD.ZS). Use committee-to-indicator mappings in `scripts/scb-context.ts` and `scripts/world-bank-context.ts` for comprehensive coverage.
**Fact-checking:** Monthly reviews should include a dedicated fact-check section. Scan debates/speeches from the month via `search_anforanden` and use `scripts/statistical-claims-detector.ts` to verify politician statistical claims against official data.

```javascript
get_sync_status({})
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/news-motions.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,8 @@ Before generating ANY articles, verify MCP connectivity:

**Primary tool:** `get_motioner` — fetches latest opposition motions
**Cross-reference:** `search_dokument_fulltext`, `search_anforanden`
**Statistical enrichment:** SCB MCP — enrich with statistics relevant to motion policy areas (labour, education, migration, etc.)
**Statistical enrichment:** SCB MCP — enrich with statistics relevant to motion policy areas. Use domain-to-committee mappings from `scripts/scb-context.ts` to automatically select relevant SCB tables based on which committee the motion is referred to (e.g., AU motions→labour TAB5765, JuU→crime TAB1172, MJU→environment TAB5404). World Bank indicators are mapped per committee in `scripts/world-bank-context.ts`.
**Fact-checking:** Motions often cite statistics to justify policy proposals. Use `scripts/statistical-claims-detector.ts` to detect claims about unemployment, GDP, migration, crime rates, etc. and cross-reference against official SCB/World Bank data. Include a "Faktakoll" section rating the accuracy of cited statistics.

```javascript
get_sync_status({})
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/news-propositions.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,8 @@ Before generating ANY articles, verify MCP connectivity:

**Primary tool:** `get_propositioner` — fetches latest government propositions
**Cross-reference:** `search_dokument`, `analyze_g0v_by_department`
**Statistical enrichment:** SCB MCP — enrich with economic/fiscal data relevant to propositions
**Statistical enrichment:** SCB MCP — enrich with economic/fiscal data relevant to propositions. Use committee-mapped SCB tables: fiscal→TAB1291/TAB1292 (FiU), taxation→TAB1291 (SkU), trade→TAB5802 (NU). World Bank indicators: GDP Growth, Gov Expenditure, Tax Revenue. See `scripts/scb-context.ts` and `scripts/world-bank-context.ts` for full mappings.
**Fact-checking:** When propositions reference specific statistics, cross-reference against SCB/World Bank data using `scripts/statistical-claims-detector.ts` patterns.

```javascript
get_sync_status({})
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/news-week-ahead.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ Before generating ANY articles, verify MCP connectivity:

**Primary tool:** `get_calendar_events` — fetches upcoming 7-day calendar
**Cross-reference:** `search_dokument`, `get_fragor`, `get_interpellationer`
**Statistical enrichment:** SCB/World Bank — for scheduled economic debates, pre-fetch relevant indicators. Use committee-mapped tables from `scripts/scb-context.ts` based on which committees have scheduled meetings (e.g., FiU agenda→fiscal TAB1291 + World Bank GDP/inflation indicators).

```javascript
get_sync_status({})
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/news-weekly-review.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ Before generating ANY articles, verify MCP connectivity:

**Primary tool:** `search_dokument` — searches documents from past 7 days
**Cross-reference:** `search_voteringar`, `get_betankanden`, `search_anforanden`
**Statistical enrichment:** SCB MCP — enrich weekly context with relevant economic indicators
**Statistical enrichment:** SCB MCP + World Bank — enrich weekly context with relevant economic indicators. Auto-select SCB tables and World Bank indicators based on which committees were active during the week (see `scripts/scb-context.ts` and `scripts/world-bank-context.ts` for committee mappings).
**Fact-checking:** Review speeches from `search_anforanden` for statistical claims. Use `scripts/statistical-claims-detector.ts` to detect and cross-reference claims against official SCB/World Bank data. Include a "Faktakoll" section for any detected inaccuracies.

```javascript
get_sync_status({})
Expand Down
13 changes: 13 additions & 0 deletions scripts/article-quality-enhancer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import fs from 'fs';
import type { QualityThresholds, QualityMetrics, QualityResult } from './types/validation.js';
import { hasEconomicContext } from './world-bank-context.js';
import { hasSCBContext } from './scb-context.js';
import { hasStatisticalClaims } from './statistical-claims-detector.js';

/**
* Map of normalized party codes to their common name variants.
Expand Down Expand Up @@ -59,6 +61,7 @@ const DEFAULT_THRESHOLDS: QualityThresholds = {
recommendHistoricalContext: true,
recommendInternationalComparison: false,
recommendEconomicContext: true,
recommendSCBContext: true,
};

/**
Expand Down Expand Up @@ -329,6 +332,8 @@ export async function enhanceArticleQuality(
hasHistoricalContext: hasHistoricalContext(content),
hasInternationalComparison: hasInternationalComparison(content),
hasEconomicContext: hasEconomicContext(content),
hasSCBContext: hasSCBContext(content),
hasStatisticalClaims: hasStatisticalClaims(content),
hasLanguageSwitcher: hasLanguageSwitcher(content),
hasArticleTopNav: hasArticleTopNav(content),
hasBackToNews: hasBackToNews(content),
Expand Down Expand Up @@ -380,6 +385,14 @@ export async function enhanceArticleQuality(
warnings.push('Recommended: Add economic context (World Bank indicators, GDP, unemployment data)');
}

if (options.recommendSCBContext && !metrics.hasSCBContext) {
warnings.push('Recommended: Add Swedish statistical context (SCB official statistics)');
}

if (metrics.hasStatisticalClaims) {
warnings.push('Info: Article contains statistical claims — consider adding fact-check section');
}

// Navigation structure warnings (generated by template — fallback fix: scripts/fix-article-navigation.py)
if (!metrics.hasLanguageSwitcher) {
warnings.push('Missing language-switcher nav (should be generated by article template)');
Expand Down
9 changes: 9 additions & 0 deletions scripts/data-transformers/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,15 @@ export interface ArticleContentData {
speechDebates?: unknown[];
/** SCB statistical context for economic/demographic enrichment */
scbContext?: SCBContext;
/** Statistical claims detected for fact-checking against World Bank / SCB data */
statisticalClaims?: Array<{
sourceText: string;
topic: string;
claimedValue?: number;
speaker?: string;
party?: string;
verificationSource: 'world-bank' | 'scb' | 'both';
}>;
}

// ---------------------------------------------------------------------------
Expand Down
Loading
Loading