Code Speaks: Auditing Japan’s Public Data through CSVs and APIs

IT Policy Proposals
Code Speaks: Auditing Japan’s Public Data through CSVs and APIs

どうも〜おかむーです! Hi — let’s dig into public data like engineers, not pundits.

  • Government publishes useful CSVs (NICTER, env, MHLW), but formats and metadata vary a lot
  • Machine-readability rules exist, yet many KPIs and grant reports remain locked in PDFs
  • Technical fixes (APIs, schemas, frictionless data) would unlock reuse and accountable policy

結論

Public data is getting better — there are real CSV endpoints (e.g. https://notice.go.jp/docs/status_nicter.csv, https://www.env.go.jp/content/900398071.csv, https://www.mhlw.go.jp/content/001429177.csv) — but the ecosystem still mixes PDFs, inconsistent encodings, and sparse schema. エンジニア的に言うと、データの取り出しと結合が毎回手作業になるのは大損失。要するに、APIと機械判読可能なメタデータが必須です。

Report: what I checked and what it means

What I inspected

  • NICTER notice CSV (notice.go.jp/docs/status_nicter.csv) — straightforward CSV feed for security notices
  • Ministry of Environment CSV (env.go.jp/content/900398071.csv) — environmental data in CSV form
  • MHLW CSV (mhlw.go.jp/content/001429177.csv) — health-related tabular export
  • Classification mapping from Ministry of Internal Affairs (soumu.go.jp/main_content/000420038.csv) — code tables for linking
  • Grant program pages and evaluation PDFs (chisou.go.jp, prefectural PDFs) showing KPI reporting in PDF
  • Policy guidance on machine-readable stats (soumu.go.jp and cas.go.jp materials)

Technical observations

  • Encoding & header issues: many gov CSVs still use Shift_JIS or ambiguous encodings — you need to detect/convert to UTF-8 before parsing.
  • Missing schema: CSV files often lack a machine-readable schema (types, units, allowed values). That makes validation and joins brittle.
  • Identifier hygiene: datasets use local codes but not global persistent IDs. Join operations require manual mapping using CSV code tables (e.g. soumu classification CSV).
  • PDF vs CSV: grant evaluations and KPI narratives are often PDFs (chisou.go.jp reports). PDFs block programmatic KPI aggregation across projects.
  • API coverage: there is no consistent REST/GraphQL API layer or OpenAPI specs across ministries. Some portals provide bulk CSV only.

Code example: robust ingest pattern (Python / pandas)

import requests, chardet, pandas as pd

r = requests.get('https://notice.go.jp/docs/status_nicter.csv')

enc = chardet.detect(r.content)['encoding']

df = pd.read_csv(pd.compat.StringIO(r.content.decode(enc)), parse_dates=['date'])

normalize codes using soumu code table

codes = pd.read_csv('https://www.soumu.go.jp/main_content/000420038.csv', encoding='utf-8')

df = df.merge(codes, left_on='category_code', right_on='code', how='left')

要するに、最初にエンコーディング検出 → 明示的なスキーマ → マッピングの流れが安定化の鍵です。

KPI and policy evaluation gaps

  • Digital Garden City grants (chisou.go.jp) publish project lists and self-evaluations, but the evaluation artifacts are mixed CSVs and PDFs. That prevents easy cross-municipality KPI aggregation.
  • Guidance documents (cas.go.jp, soumu.go.jp) already call for machine-readable stats. The missing piece is enforcement and developer-friendly APIs.

Concrete technical recommendations

  • Publish a Data Package (frictionlessdata.io) alongside each CSV containing schema, primary key, license, and update cadence.
  • Standardize UTF-8 CSVs with ISO 8601 dates and explicit datatype columns.
  • Provide a simple REST API with OpenAPI spec and rate limits, plus bulk-download endpoints.
  • Assign persistent IDs to projects/grants and expose KPI time-series as CSV/JSON-LD.
  • Add CI for data quality: schema validation, null-rate checks, and semantic tests in GitHub Actions.

まとめ

Public data assets exist and are valuable, but inconsistent formats (encodings, missing schema), PDFs for KPI, and lack of APIs make programmatic accountability painful. エンジニア的に言うと、ここはAPI一本で解決する話なんですよ。少しのガバナンスとエンジニアリング投資で、再利用性と評価可能性は劇的に上がります!

おかむーから一言

I’ve built and shipped GovTech products — open data that’s actually usable unlocks civic innovation. Let’s push for APIs, schemas, and reproducible KPI pipelines. Tech for better government, let’s go!