JSON Schema contracts for all inter-service boundaries in the disaster response pipeline.
These contracts are LOCKED once published. Do not change without notifying all team members.
[Disaster Sensor]
│ POST /sensor
▼
[Go Supervisor] ──── CAMARA APIs ────▶ Nokia NaC Network
│ POST /decide
▼
[Python AI Agent]
│ AgentResponse
▼
[Go Supervisor]
├──▶ SMS Dispatch (Africa Service / operator)
├──▶ Rescue Dispatch Worker
└──▶ WebSocket ──▶ [Dashboard]
| File | Schema | Direction | Consumed by |
|---|---|---|---|
sensor_input.json |
SensorInput |
Sensor → Go | internal/sensor/handler.go |
camara_device.json |
CAMARALocation/Reachability/Verification/Congestion/TriagedDevice |
Nokia NaC → Go | internal/camara/*.go |
ai_request.json |
AgentRequest |
Go → Python AI | internal/agent/client.go + Python agent |
ai_response.json |
AgentResponse + DeviceDecision |
Python AI → Go | internal/agent/client.go |
ws_update.json |
WSUpdate + all payloads |
Go → SolidJS | internal/dashboard/broadcast.go + SolidJS |
Go calculates zones. AI decides actions. Never reversed.
- All timestamps: Unix milliseconds (
int64) - All phone numbers: E.164 (
+212XXXXXXXXX) - All zones: lowercase
"red"|"orange"|"green" zonefield inTriagedDeviceis always set by Go haversine — AI may escalate (zone_escalated: true) but never sets it initiallyreasoninginDeviceDecisionis internal audit only — never shown to users, never sent in SMS
React should handle messages in this order:
event_start→ initialise map, draw epicenter + impact radius circledevice_update→ add/update dot on map (colour by zone)zone_summary→ update sidebar counters (sent after each zone batch)narrative_update→ update AI situation report text panelerror→ show warning banner; iffatal: true, show critical alert and halt UI updates
| Zone | Distance from epicenter | Risk level |
|---|---|---|
red |
≤ 33% of radius_km |
Critical — immediate danger |
orange |
33%–66% of radius_km |
High — evacuation recommended |
green |
66%–100% of radius_km |
Moderate — alert and monitor |
| Action | SMS sent | Rescue flagged |
|---|---|---|
sms |
✅ | ❌ |
rescue_flag |
❌ | ✅ |
both |
✅ | ✅ |
none |
❌ | ❌ |
rescue_priority: 0 = not flagged, 1–10 = flagged (1 = highest urgency, dispatched first)
Batches are sent to the AI agent in priority order:
batch_index 0 → zone "red" (process first — highest risk)
batch_index 1 → zone "orange"
batch_index 2 → zone "green"
The AI agent must respond to each batch before Go sends the next.
| Code | Source | Fatal? |
|---|---|---|
CAMARA_TIMEOUT |
internal/camara/ |
Usually false — device skipped |
AGENT_ERROR |
internal/agent/client.go |
Usually true — pipeline halted |
SMS_FAILED |
internal/dispatch/sms.go |
False — logged, rescue may still run |
DB_ERROR |
internal/database/ |
True — cannot log or query shelters |
QOS_FAILED |
internal/camara/qos.go |
False — fallback to standard QoS |
- Ilias (Go) → produces ai_request.json, consumes ai_response.json
- Yassine (Python) → consumes ai_request.json, produces ai_response.json
- Saad / Ayoub (Dashboard) → consumes ws_update.json
- Houssam (DevOps) → validates all contracts in integration tests