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
2 changes: 2 additions & 0 deletions .github/skills/data-science-for-intelligence/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@ Apply this skill when:
- ✅ Constructing influence networks from voting alignment patterns
- ✅ Forecasting trends in party support or politician effectiveness
- ✅ Clustering politicians or parties by voting similarity
- ✅ Modelling Swedish economic transmission chains using IMF macro context plus SCB KPI/AKU/HEK/fuel-price series and Riksbank policy-rate/minutes signals

Do NOT use for:
- ❌ Simple aggregation queries (use SQL views instead)
- ❌ Real-time operational dashboards (use materialized views)
- ❌ Causal inference without proper experimental design or quasi-experimental methods
- ❌ Replacing IMF cross-country macro/fiscal indicators with SCB or Riksbank series; use SCB/Riksbank only as Swedish ground-truth complements

## Data Science Framework for CIA Platform

Expand Down
2 changes: 2 additions & 0 deletions .github/skills/riksdag-regering-mcp/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Provide comprehensive access to Swedish political data through the `riksdag-rege
4. **Real-Time Access**: Latest parliamentary and government activities
5. **GDPR Compliance**: Public interest basis (Article 6(1)(e)), no personal data beyond official capacity
6. **Multi-Source Integration**: Riksdag documents + Government publications
7. **Quantitative Context Handoff**: Pair parliamentary evidence with SCB/Riksbank helper outputs when domestic economic transmission matters; keep IMF as cross-country macro canon and SCB/Riksbank as Swedish ground truth.

## Available Tools (32 Total)

Expand Down Expand Up @@ -112,6 +113,7 @@ Provide comprehensive access to Swedish political data through the `riksdag-rege
- **Electoral Research**: Historical trends, party evolution
- **Transparency Dashboards**: Real-time political metrics
- **Risk Assessment**: Identify democratic accountability gaps
- **Economic Transmission Analysis**: Combine Riksdag measures with `scripts/scb-fetch.ts` KPI/AKU/HEK/fuel presets and `scripts/riksbank-fetch.ts` policy-rate/minutes context for Swedish-specific impact estimates.

## Calling MCP Tools in Agentic Workflows

Expand Down
16 changes: 15 additions & 1 deletion analysis/templates/comparative-international.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,21 @@ graph TB

---

## 🇸🇪 Swedish Ground-Truth Transmission Layer (SCB + Riksbank)

> Use this table whenever the Swedish measure depends on domestic price, labour-market, household-income or monetary-policy transmission. IMF remains primary for cross-country macro; SCB and Riksbank supply the Swedish-specific ground truth. Fetch with `tsx scripts/scb-fetch.ts preset --preset <cpi|aku|household-economy|fuel-prices> --persist` and `tsx scripts/riksbank-fetch.ts <repo-rate-path|minutes|fuel-price-context> --persist`.

| Transmission step | Swedish source | Required provenance | Current value | Timing / lag | Analytical use |
|-------------------|----------------|---------------------|:-------------:|--------------|----------------|
| Pump price / energy component → CPI | SCB `fuel-prices` (`PR0101A`) + SCB `cpi` (`0000003N`) | `economicProvenance.provider="scb"` | — | Monthly | Estimate direct CPI and disposable-income effect |
| Labour-market slack | SCB `aku` (`000003V8`) | `economicProvenance.provider="scb"` | — | Quarterly | Judge whether Swedish unemployment divergence is structural or cyclical |
| Household disposable-income exposure | SCB `household-economy` (`HE0110A`) | `economicProvenance.provider="scb"` | — | Annual / latest | Distributional incidence and voter-segment exposure |
| Monetary-policy pass-through | Riksbank `repo-rate-path` + `minutes` | `economicProvenance.provider="riksbank"` | — | Per monetary-policy decision | Check whether fiscal relief conflicts with the Riksbank inflation path |

> **Interpretation:** State the Swedish mechanism explicitly: instrument → SCB/Riksbank metric → household / labour / sentiment channel → expected political salience. Never relabel SCB or Riksbank data as IMF; use IMF only for cross-country macro/fiscal comparators.

---

## 📘 Policy-Transfer Assessment

| Question | Answer | Evidence |
Expand Down Expand Up @@ -216,4 +231,3 @@ graph TB
- [ ] **Cross-references resolve** — every `[link](file.md)` in this artifact points to a file that exists in the run folder (`analysis/daily/$ARTICLE_DATE/$SUBFOLDER/`) or to a methodology / template under `analysis/`.
- [ ] **Mermaid renders** — every fenced ` ```mermaid ` block parses (no missing class definitions, no orphan nodes, no >40-node graphs that overflow viewport on mobile).
- [ ] **Line-floor check** — artifact length ≥ the per-artifact floor in [`reference-quality-thresholds.json`](../methodologies/reference-quality-thresholds.json); shorter artifacts trigger Pass-2 rewrite, never a `[truncated]` note.

16 changes: 15 additions & 1 deletion analysis/templates/intelligence-assessment.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,21 @@ flowchart TD

---

## 📊 Quantitative Transmission Check (SCB + Riksbank)

> Complete this block for assessments where economic transmission affects intent, timing or voter impact. It is a Swedish ground-truth layer and complements — but does not replace — IMF macro/fiscal context.

| Mechanism | Required source | economicProvenance provider | Latest signal | Intelligence implication |
|-----------|-----------------|-----------------------------|:-------------:|--------------------------|
| Price shock / relief channel | `tsx scripts/scb-fetch.ts preset --preset cpi` + `tsx scripts/scb-fetch.ts preset --preset fuel-prices` | `scb` | — | Does the measure materially affect household cost pressure? |
| Labour-market sensitivity | `tsx scripts/scb-fetch.ts preset --preset aku` | `scb` | — | Does unemployment amplify or mute the political signal? |
| Household exposure | `tsx scripts/scb-fetch.ts preset --preset household-economy` | `scb` | — | Which voter segments face the strongest disposable-income effect? |
| Monetary-policy reaction function | `tsx scripts/riksbank-fetch.ts repo-rate-path` + `tsx scripts/riksbank-fetch.ts minutes` | `riksbank` | — | Does the Riksbank path support or contradict the claimed transmission? |

**Assessment note:** Cite concrete SCB/Riksbank values before making a forecast about disposable income, consumer sentiment or polling impact. If either source is unavailable, label the gap and fall back to cached `analysis/data/scb/` or `analysis/data/riksbank/` artifacts.

---

## 🚩 Red Flags (elevate scrutiny)

| Signal | Meaning | Recommended action |
Expand Down Expand Up @@ -211,4 +226,3 @@ flowchart TD
- [ ] **Cross-references resolve** — every `[link](file.md)` in this artifact points to a file that exists in the run folder (`analysis/daily/$ARTICLE_DATE/$SUBFOLDER/`) or to a methodology / template under `analysis/`.
- [ ] **Mermaid renders** — every fenced ` ```mermaid ` block parses (no missing class definitions, no orphan nodes, no >40-node graphs that overflow viewport on mobile).
- [ ] **Line-floor check** — artifact length ≥ the per-artifact floor in [`reference-quality-thresholds.json`](../methodologies/reference-quality-thresholds.json); shorter artifacts trigger Pass-2 rewrite, never a `[truncated]` note.

50 changes: 50 additions & 0 deletions scripts/parliamentary-data/data-persistence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export type PersistenceDocumentType =
| 'imf'
| 'statskontoret'
| 'scb'
| 'riksbank'
| string; // extensible for generic MCP servers

/** Sidecar metadata written alongside data files. */
Expand Down Expand Up @@ -617,6 +618,55 @@ export function persistSCBData(
return path.join(dir, filename);
}

/**
* Persist Riksbank public web/JSON artifacts.
*
* Stored under `analysis/data/riksbank/{kind}.json`. Riksbank data is public
* and unauthenticated; provenance sidecars record the source URL/kind and the
* TypeScript CLI used to retrieve it.
*
* @param kind - Logical artifact kind (e.g. 'repo-rate-path', 'minutes').
* @param response - Raw or normalized Riksbank payload.
* @param dataRoot - Override for the data root directory (for testing).
* @returns Absolute path to the persisted data file.
*/
export function persistRiksbankData(
kind: string,
response: unknown,
dataRoot: string = DATA_ROOT,
): string {
const dir = path.join(dataRoot, 'riksbank');
ensureDir(dir);

const sanitized = sanitizeDokId(kind);
const filename = `${sanitized}.json`;
fs.writeFileSync(
path.join(dir, filename),
JSON.stringify(response, null, 2),
'utf8',
);

const candidateUrl = typeof response === 'object' && response !== null && 'url' in response
? (response as { url?: unknown }).url
: undefined;
const sourceUrl = typeof candidateUrl === 'string' && candidateUrl.length > 0
? candidateUrl
: undefined;
const metaFilename = `${sanitized}.meta.json`;
fs.writeFileSync(
path.join(dir, metaFilename),
JSON.stringify({
fetchedAt: new Date().toISOString(),
mcpTool: 'riksbank-ts-client',
kind,
...(sourceUrl ? { url: sourceUrl } : {}),
}, null, 2),
'utf8',
);

return path.join(dir, filename);
}

/**
* Return the absolute path to the data repository root.
* Useful for callers that need to reference persisted files.
Expand Down
Loading
Loading