Code-speaking Manifesto: Auditing Japan's Public CSVs and APIs

IT Policy Proposals
Code-speaking Manifesto: Auditing Japan's Public CSVs and APIs

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

  • Three-line summary
- The Japanese government publishes many CSVs (notice.go.jp, mhlw.go.jp, soumu.go.jp, env.go.jp) — good foundation, but inconsistent schemas and metadata make reuse hard.

- Machine-readability issues: encoding, missing schema, no stable APIs, and scattered hosting hurt reproducibility and policy evaluation.

- Technical fixes: standardize schema (CSVW/JSON Table Schema), add OpenAPI-backed endpoints, publish data packages and time-series APIs for transparency.

結論

Public data in CSV form is a huge win compared to PDFs — but CSV alone isn't enough. 要するに、データを機械で「使える」形にするにはスキーマ、API、メタデータ、そして安定的なエンドポイントが必要です。エンジニア的に言うと、API一本とスキーマ一枚で行政の再現性と説明責任が劇的に上がるんですよね。

Report: what I looked at and why it matters

This quick audit used several concrete datasets surfaced in search results: NOTICE (https://notice.go.jp/docs/status_notice.csv), MHLW rescue facilities CSV (https://www.mhlw.go.jp/content/001682075.csv), a national dataset from MIC (https://www.soumu.go.jp/main_content/000323625.csv), and a Ministry of Environment file (https://www.env.go.jp/content/900398071.csv). These are real CSV files — hooray — but several patterns repeat:

  • Encoding and headers: Many gov CSVs in Japan use Shift_JIS or unspecified encodings. That trips up pandas/read_csv unless you guess encoding or convert first. 要するに、一貫した UTF-8 出力がほしい。
  • Missing machine schema: No JSON Table Schema / CSVW annotations. Consumers must infer column types, date formats, and units — error-prone.
  • No unified API: Files are individually downloadable, but there's no REST API to filter, paginate, or query time ranges. エンジニア的に言うと、bulk CSV is fine for dump, but you also need query endpoints for apps.
  • Metadata & provenance: License, last-updated timestamps, and stable IDs often absent. That makes auditing policy targets vs results painful.

Quick technical checks you can run

This is practical — code you can run to validate a public CSV.

import requests

import pandas as pd

r = requests.head('https://notice.go.jp/docs/status_notice.csv')

print(r.headers.get('content-type'))

then load safely

df = pd.read_csv('https://notice.go.jp/docs/status_notice.csv', encoding='utf-8', low_memory=False)

print(df.head())

If encoding fails, try chardet to detect or pass encoding='shift_jis'. Also validate schema:

# quick column type coercion check

for col in df.columns:

try:

pd.to_datetime(df[col])

print(col, 'looks datetime')

except: pass

Policy measurement gap example

Many policy documents promise numerical targets (e.g., disaster shelter readiness, migration targets). The datasets above provide raw inventories (shelter lists, migration records), but since they lack consistent time-series endpoints and unique IDs, it's hard to compute target vs actual over time reliably. 要するに、数値目標の検証が手作業になってしまう。

Technical recommendations (concrete)

  • Publish a Data Package (frictionlessdata.io) per resource: CSV + datapackage.json with schema, encoding UTF-8, license.
  • Add CSVW/JSON Table Schema alongside each CSV to declare types, units, and primary keys.
  • Provide a simple REST API with OpenAPI spec: GET /resources/{id}/rows?from=2023-01-01&to=2024-01-01&limit=1000. This enables reproducible queries and dashboards.
  • CI for data hygiene: automated checks that validate schema, detect null spikes, and emit alerts on anomalies.
  • Offer Parquet and JSONL derivatives for large datasets to speed analytics and lower bandwidth.

Implementation sketch: OpenAPI fragment

paths:

/datasets/{id}/rows:

get:

parameters:

- name: from

in: query

schema:

type: string

format: date

- name: to

in: query

schema:

type: string

format: date

responses:

'200':

content:

application/json: {}

まとめ

CSV publication is an excellent start — much better than locked PDFs — but to turn data into accountability you need schema, APIs, and provenance. エンジニア的に言うと、データフォーマットと契約(schema+API)が揃えば、政策検証は自動化できる。現状は良い基盤だけど、あと一歩を踏み出すべき段階です。

おかむーから一言

I started companies to build this exact infrastructure — tech can make government measurable and improvable. Let's push for data contracts, not just data dumps。興奮してきた!