| Method | Path | Description & Parameters |
|---|---|---|
| GET | /risk/{code} | Composite risk score + 95% CI + driver attributions + forecast code: ISO-3166 alpha-2 (e.g. US, AR, UA) → RiskResponse · computed fresh or from cache |
| GET | /risk/compare | Compare up to 10 countries in one call countries: comma-separated codes (e.g. US,BR,AR,DE) → list[RiskResponse] |
| GET | /risk/{code}/history | All stored score snapshots for a country limit: int (default 100) · offset: int → list[HistoryPoint] |
| GET | /risk/{code}/drivers | Signed per-indicator driver attributions code: country code → list[DriverAttribution] |
| GET | /risk/{code}/aspects | 5-aspect NLP breakdown (central-bank statement) code: country code → AspectScoresResponse |
| GET | /risk/{code}/forecast | 6-month and 12-month score extrapolations code: country code → { '6m': ForecastPoint, '12m': ForecastPoint } |
| GET | /risk/movers | Countries with largest risk score change (7-day window) limit: int (default 10) → list[MoverPoint] |
| GET | /risk/bulk | Batch score multiple countries (POST body) body: { countries: [code, …] } → list[RiskResponse] |
| GET | /indicators/{code} | Raw economic indicator time series code: country · metric: filter by name → list[IndicatorRow] |
| GET | /events/{code} | Political event feed with severity scores code: country · limit: int → list[EventRow] |
| GET | /governance/{code} | Governance sub-scores (V-Dem, WJP, TI, FH) code: country → GovernanceResponse |
| GET | /nlp/{code} | Central-bank NLP hawkishness + latest statement text code: country → NLPResponse |
| GET | /calibration/summary | Methodology, component weights, AUC estimate → CalibrationSummary |
| GET | /calibration/roc | Full ROC/PR curve data · include_curve=true for arrays include_curve: bool → ROCResult |
| GET | /calibration/dataset | Crisis event dataset (220 events, 2000–2023) → { n_total, events: […] } |
| GET | /health | API health + DB connectivity + scored country count → HealthResponse |
| GET | /health/ready | Kubernetes readiness probe → 200 / 503 |
| GET | /metrics | Prometheus scrape endpoint → text/plain |
| Param | Type | Default |
|---|---|---|
| economic_weight | float | 0.45 |
| political_weight | float | 0.25 |
| nlp_weight | float | 0.20 |
| governance_weight | float | 0.10 |
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | Requested resource |
| 404 | Not Found | {"detail":"…"} — unknown country code or no data yet |
| 422 | Validation Error | {"detail":[…]} — invalid parameter type/range |
| 429 | Rate Limited | {"error":"rate limit exceeded"} |
| 500 | Server Error | {"detail":"internal server error"} |