Operations · integrations

Data sources & API keys

MetroMind runs fully offline on its demo dataset. This is where an operator or authority connects the same app to live conditions — one JSON contract, no code changes.

Operations

Live metro feed

Point MetroMind at any endpoint that returns network conditions as JSON — line delays and per-station crowding. While live is selected the app polls it continuously and every module (Copilot, CrowdCast, Safety, the map) re-reasons on real conditions. Feed fetches run server-side, so CORS is never an issue and the key can stay in the environment.

Expected feed contract

{
  "updatedAt": "2026-10-24T09:00:00+05:30",
  "lines": [
    { "id": "aqua",   "status": "delay", "delayMin": 12 },
    { "id": "purple", "status": "normal" }
  ],
  "stations": [
    { "id": "shivaji-nagar", "crowd": 0.72 },
    { "name": "Deccan Gymkhana", "crowd": 0.31 }
  ]
}

Station entries match by id or name (slugified — “Shivaji Nagar”, “shivaji-nagar” and “SHIVAJI NAGAR” all resolve); unmatched entries are skipped, never guessed. crowd is 0–1 (values >1 are read as %). A GTFS-RT source needs a tiny converter to this shape — the normalization layer lives in lib/livefeed.ts.

pilot keys are kept in this browser only (localStorage) for field trials — production deployments should set LIVE_FEED_URL + LIVE_API_KEY as server env vars and leave this blank.

Optional · explanations

AI API key (OpenAI or GLM)

Route explanations are generated by templates by default. Setting an OpenAI or z.ai (GLM) key upgrades them to model-written whys — the app is fully functional without either and falls back instantly on any error, timeout or missing key. (Note: an AI key powers the wording of explanations — live network data comes from the feed integration above.)

# .env.local (server-side only — never shipped to the client)
OPENAI_API_KEY=sk-...          # or ZAI_API_KEY for z.ai / GLM
OPENAI_MODEL=gpt-4o-mini       # optional
AI_PROVIDER=                   # optional: force "openai" or "zai"

Keys are read server-side only. The ai: auto / forced offline switch in the Demo Control bar overrides this at runtime for A/B comparisons.

Honest scope

What “production ready” means here

The integration seam, normalization, polling and failure fallbacks are real and tested — point them at a genuine feed and the app runs on it. What this project does not include is an authority agreement, a GTFS-RT converter service, or hardened multi-tenant auth; those sit outside a one-day build and are on the roadmap.

dial 112 / contact station staff for real emergencies — this app does not dispatch.