Cia data integration

From Hack23/riksdagsmonitor · View interactive version

Cia data integration is an AI agent skill from the GitHub repository Hack23/riksdagsmonitor. Expert knowledge in consuming CIA platform JSON exports, validation, caching strategies, and data pipeline integration

How to use this skill

Skill file

CIA Data Integration Skill

๐Ÿ”ด AI FIRST Quality Principle

Apply the AI FIRST principle: never accept first-pass quality. Minimum 2 iterations. Read all output, improve every section. No shortcuts.

Purpose

This skill provides expertise in consuming JSON exports from the CIA (Citizen Intelligence Agency) platform, implementing robust caching strategies, and ensuring data quality through schema validation.

Core Principles

  1. CIA is Source of Truth - Never modify CIA's pre-computed data
  2. Validate Before Cache - Always validate against CIA-provided JSON schemas
  3. Version Tracking - Track all CIA data updates with timestamps
  4. Graceful Degradation - Fall back to cached data if CIA unavailable
  5. Data Freshness - Monitor and alert on stale data (> 24 hours)
  6. Audit Logging - Log all data operations for traceability

Enforces

CIA Export Consumption

JSON Schema Validation

// Validate CIA export against schema
import Ajv from 'ajv';

const ajv = new Ajv({ allErrors: true });
const schema = await fetchCIASchema(productName);
const validate = ajv.compile(schema);

if (!validate(data)) {
  throw new ValidationError(validate.errors);
}

Caching Strategy

data/cia-exports/
  current/          # Latest CIA exports (19 files)
  archive/          # Historical versions (date-stamped)
  metadata/         # Fetch timestamps, validation status

Data Freshness Monitoring

When to Use

Examples

CIA Export Client

class CIAExportClient {
  async fetchExport(productName) {
    const url = `https://www.hack23.com/cia/api/export/${productName}.json`;
    const data = await fetch(url, { timeout: 30000 });
    
    await this.validateSchema(productName, data);
    await this.cacheWithVersion(productName, data);
    
    return data;
  }
}

Automated Workflow

# .github/workflows/fetch-cia-exports.yml
name: Fetch CIA Exports
on:
  schedule:
    - cron: '0 2 * * *'  # 02:00 CET daily

jobs:
  fetch:
    steps:
      - name: Fetch CIA exports
        run: node scripts/fetch-cia-exports.js
      
      - name: Validate schemas
        run: node scripts/validate-cia-data.js
      
      - name: Commit if changed
        run: |
          if git diff --quiet data/cia-exports/; then
            echo "No changes"
          else
            git add data/cia-exports/
            git commit -m "Update CIA exports"
            git push
          fi

Remember

References


Version: 1.0

Last Updated: 2026-02-06

Category: Data Integration

Maintained by: Hack23 AB


๐Ÿ”— Integration with agentic workflows & analysis artifacts

This skill is consumed by the 11 agentic news workflows in .github/workflows/news-*.md. The authoritative contract lives in CODE1; this skill supplies domain expertise on top of that contract.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.