Code Speaks: Auditing Japan's Gov Data Pipelines and Dashboards

IT Policy Proposals
Code Speaks: Auditing Japan's Gov Data Pipelines and Dashboards

どうも〜おかむーです!今日はちょっとエンジニアっぽい話をしますよ〜

  • GovTech Tokyo and Digital Agency are pushing dashboards and case studies, but many outputs remain PDFs or scattered endpoints
  • Machine-readability (CSV/JSON/API) is the gating factor for reuse — PDFs kill developer velocity
  • With modest engineering (APIs, OpenAPI, CI for data), local and national policy KPIs could become auditable and reusable

結論

政府・自治体はデータ公開の「最後の1メートル」が弱い。データはあるけどほとんどPDF、非標準フォーマット、APIが限定的で実装負担が高い。エンジニア目線では「CSV/JSON + stable API + metadata + examples」があれば、政策の実績対目標の差をリアルタイムに追えるようになる。具体的にはe-Statやgo.jpのリソースを基に、データパイプラインの自動化とOpenAPI提供を推す!

Report: what's happening and what's wrong

What I checked (sources)

  • Digital Agency (digital.go.jp) — case studies and resources for data reuse
  • GovTech Tokyo services (govtechtokyo.or.jp) — dashboard unification and shared components
  • Digital田園都市交付金のKPI資料(chisou.go.jp)と県の実績PDF(pref.yamaguchi.lg.jp) — 実績とKPIがPDFで公開されている例

これ見てくださいよ:GovTech Tokyo はダッシュボードの体系化を進めているけど、実際のKPI値や年度推移はPDFの表だったり、スライド(PPTX)で配られていたりします。エンジニア的に言うと、これAPI一本で解決する話なんですよね。

Technical fail modes

  • PDF-first publication: tables embedded in PDFs (chisou.go.jp, pref.yamaguchi.lg.jp). Hard to ingest automatically.
  • No stable API schema: many local governments lack OpenAPI specs or versioned endpoints.
  • Mixed formats: Excel, PPTX, PDFs, and ad-hoc CSVs with inconsistent headers and encodings.
  • Weak metadata: no machine-readable schema (JSON Schema or DCAT), so consumers must reverse-engineer fields.

要するに:データはあるけどエンジニアが使うには手間が多すぎる、ということです。

Concrete technical checks and examples

  • e-Stat provides an API (https://www.e-stat.go.jp/) — good reference for how a national stats API should behave: API keys, paged endpoints, JSON/CSV outputs.
  • For PDF tables like the Digital田園交付金 KPI PDFs, use tabula-py or Camelot to extract, but this is brittle and brittle extraction is costly in maintenance.

Example: fetch e-Stat CSV (pseudo)

import requests

import pandas as pd

API_KEY = 'YOUR_ESTAT_KEY'

url = 'https://api.e-stat.go.jp/rest/3.0/app/getSimpleStatsData'

params = {'appId': API_KEY, 'statsDataId': '0003412310', 'lang': 'J'}

r = requests.get(url, params=params)

parse JSON or save CSV

Example: extract a table from PDF (if no CSV available)

import tabula

df_list = tabula.read_pdf('kpi_report.pdf', pages='all', multiple_tables=True)

do cleaning, standardize column names, store as CSV/Parquet

KPI vs actual — the policy angle

chisou.go.jp のチェック・アクションガイドラインやpref.yamaguchi.lg.jpの事業実績PDFを見てください。KPIが設定されている一方で、年度毎の時系列データや達成率の可視化がないため、政策効果の定量的な検証が難しいケースが多いです。目標と実績が別々のドキュメントに分かれていると、差分分析やトレンド分析が手作業になります。

Practical improvements (engineering roadmap)

  • Single source of truth: publish canonical datasets as CSV/JSON and Parquet for large tables, and store on a public object store (S3-compatible) with CORS enabled.
  • API with OpenAPI spec: provide GET endpoints for KPIs, filters by year/region, pagination, and machine-readable schemas (JSON Schema).
  • Metadata and DCAT: add dataset descriptions, last-updated timestamps, provenance fields.
  • CI/CD for data: tests that validate schema, row counts, value ranges, and alert on anomalies.
  • Reference clients & examples: provide Python/R snippets and reproducible notebooks that show how to fetch, clean, and visualize KPI gaps.
  • Data licensing and SLAs: clear open license (CC-BY or similar) and uptime/availability commitments for critical endpoints.
  • Minimal viable API design (example)

    • GET /api/v1/kpis?prefecture=Yamaguchi&year=2024
    • Response: JSON array with fields: kpi_id, name, target_value, actual_value, unit, source_url, last_updated
    • Provide OpenAPI and an interactive Swagger UI so civic hackers can explore instantly.

    まとめ

    • PDF-first publication slows reuse and auditing. 要するに、機械可読な公開が最優先だよ!
    • e-Stat は良い見本。都道府県や省庁は同様のAPI/metadataパターンを採用すべき。
    • 技術的改善はコスト小、効果は大。CSV/JSON + OpenAPI + CIで政策の透明性と再利用性を一気に上げられる。

    おかむーから一言

    テクノロジーで社会をアップデートするって言ってるんだから、データを人手から解放しようぜ!小さなAPI一本で、政策への信頼が変わるんです。"