Code-Talking Manifesto: Reading Government Data as Engineers

IT Policy Proposals
Code-Talking Manifesto: Reading Government Data as Engineers

どうも〜おかむーです! Hi — I’m Okamu, and today we’re going to read policy through the lens developers love: code, schemas, and automation. Engineer-wise, public data should be predictable, machine-readable, and instrumentable — let’s see how current Japanese government CSVs stack up and what to do about it.

  • This piece inspects publicly listed CSV endpoints (notice.go.jp, env.go.jp, inpit.go.jp, mhlw.go.jp, soumu.go.jp).
  • Short technical audit: encoding, schema, metadata, update patterns, API gaps.
  • Concrete developer-friendly fixes: schema, CI checks, lightweight API, and adoption paths.

結論

Public data is getting there (CSV links exist!), but engineering practices are inconsistent: encodings differ, schemas are undocumented, updates lack provenance, and APIs are rare. 要するに、データ自体はあるけど“使える状態”になっていない。改善は小さな工程(schema, license, CI, simple REST/CSV endpoints)で十分です。

What I looked at

These are the endpoints surfaced in search results:

  • https://notice.go.jp/docs/status_notice.csv (NOTICE status CSV)
  • https://www.env.go.jp/content/900398071.csv (Ministry of Environment — Ibaraki CSV)
  • https://www.inpit.go.jp/content/100869372.csv (domestic migration data 2011)
  • https://www.mhlw.go.jp/content/001682075.csv (shelter facilities data)
  • https://www.soumu.go.jp/main_content/000323625.csv (national dataset list)

I didn’t need to download heavy PDFs to see the pattern: gov domains publish CSVs directly (nice!), but often without explicit machine-readable metadata (JSON Schema, DataPackage, or OpenAPI) and without clear API endpoints.

Quick technical audit (common issues)

  • Encoding: many gov CSVs historically use Shift_JIS / CP932. If the file is not UTF-8, web apps and downstream tools choke. Engineer-wise, normalize to UTF-8.
  • Schema/columns: No embedded schema or field types. Consumers guess column types, date formats, and ID semantics. 要するに、傾向として "guesswork" が増える。
  • Metadata: missing license, update timestamps, provenance. You need license+updated_at for legal and operational use.
  • Stability & endpoints: CSV file URLs can change between releases. No versioning or API that supports stable identifiers and pagination.
  • Geodata: location fields often free-text (prefecture/city). For maps, GeoJSON and canonical codes (JIS X 0401/0402) are better.

Example: how an engineer would consume one of these CSVs

This is the kind of snippet I run quickly to validate encoding and preview columns (bash + Python):

# quick curl + encoding check

curl -sS https://notice.go.jp/docs/status_notice.csv -o tmp.csv

file tmp.csv

head -n 5 tmp.csv | nkf -g

# pandas preview and automatic type inference

import pandas as pd

df = pd.read_csv('tmp.csv', encoding='cp932') # try cp932 then utf-8

print(df.head())

print(df.dtypes)

Engineer note: if you need to try multiple encodings programmatically, use chardet or cchardet to detect, then normalize to UTF-8 and store canonical copies.

Concrete improvements (low-cost, high-impact)

  • Publish a tiny JSON Schema or Frictionless Data Package next to each CSV
  • - Example datapackage.json minimal fields: name, title, resources[ { path, schema: { fields: [...] } } ]

  • Canonicalize encoding: always serve UTF-8; add Content-Type headers including charset=utf-8.
  • Provide an optional simple REST wrapper: /api/v1/notices.csv and /api/v1/notices.json
  • - Implement as static hosting + lambda or nginx rewrite. No heavy infra required.

  • Add machine-readable metadata: license (SPDX ID), updated_at, source_url, contact
  • Use standard codes for geos (JIS codes) and date ISO 8601 for dates
  • Add Git-backed publishing + CI validations
  • - On push, run CSVLint/agate checks: column count stable, date parseable, no mixed types.

    Example JSON Schema fragment (illustrative)

    {
    

    "title": "notice_status",

    "type": "object",

    "properties": {

    "notice_id": { "type": "string" },

    "title": { "type": "string" },

    "issued_at": { "type": "string", "format": "date-time" },

    "pref_code": { "type": "string" }

    },

    "required": ["notice_id","issued_at"]

    }

    要するに、Schemaがあれば取り回しが劇的に楽になりますよね。

    Policy vs Data: measuring gaps

    Many policies set targets (e.g., evacuation capacity, migration numbers). With well-structured time-series CSVs + stable IDs you can programmatically compute: progress to target, trends, and anomalies. Right now, the friction is data hygiene: inconsistent timestamps, missing unique IDs, and undocumented changes make reproducible evaluation hard.

    Practical check to compute trend completeness (pseudo-query):

    • Ensure record has: id, date (ISO), metric
    • GROUP BY date ORDER BY date -> percent_nulls
    This kind of single SQL or pandas pipeline gives you a quick health metric of the dataset.

    Roadmap for adoption (how local governments can ship good data fast)

  • Start with a Data Package and UTF-8 CSVs for one dataset (pilot)
  • Add automated validation in GitHub Actions (CSV schema, encoding, row counts)
  • Expose JSON API endpoint (same schema) and CORS-enabled static hosting
  • Publish examples and a small SDK (Python/JS) that wraps the API
  • Encourage private sector to build dashboards and services — feed back issues to data maintainers
  • 参考 — why these specific URLs matter

    • notice.go.jp status CSV: operational notifications are high value — machine-readable status reduces phone calls and duplication.
    • env.go.jp and mhlw.gov CSVs: environmental and shelter datasets are prime candidates for GIS/real-time dashboards.
    • soumu.go.jp national CSV index: shows willingness to publish, so improving engineering practices unlocks broad reuse.

    まとめ

    CSV endpoints exist! That’s already great. But to be truly reusable you need: UTF-8, JSON Schema / DataPackage, license & provenance metadata, stable endpoints (or API), and CI validation. エンジニア的に言うと、これはAPI一本で解決する話でもありますが、その前に“データの契約(schema)”を結ぶのが最優先。

    おかむーから一言

    I built stuff on tiny budgets and shipping a simple schema+CI beats complex portals every time. Let’s get government data to the point where hackers and analysts can ship useful tools without guessing what a column means — that’s how policy becomes measurable and accountable!