""" Hard-coded constants for CIRO's deterministic decision logic. What lives here --------------- Constants that are NOT meant to be tuned per request or per environment — they encode product decisions about how CIRO classifies and responds to crises. Putting them in one module keeps risk-tiering, planning, and the UI in lockstep about which types map to which tier. What does NOT live here ----------------------- Environment-driven config (API keys, feature flags, ports) — that belongs in `core/config.py` (pydantic-settings). If a value is something ops would change, it goes there, not here. """ from __future__ import annotations # ── Risk tiering ────────────────────────────────────────────────────────── # # These sets define the response path a crisis takes after detection: # # LOW_RISK_TYPES → automated response (reroute, alert), no humans # MEDIUM_HIGH_RISK_TYPES → requires crowd verification before any # emergency dispatch # # Crisis types not in either set are treated as MEDIUM by the classifier # (fail-safe default — never silently skip verification for an unknown # type). LOW_RISK_TYPES: frozenset[str] = frozenset({ "traffic_jam", "rainfall", "road_blockage", }) MEDIUM_HIGH_RISK_TYPES: frozenset[str] = frozenset({ "flood", "fire", "accident", "building_collapse", "infrastructure_failure", "infrastructure", # alias used by the detection taxonomy "heatwave", }) # Confidence threshold below which a high-risk crisis is downgraded to # medium. The intent: "we are not confident enough to skip crowd # verification, but we are confident enough to investigate further." # Hard-coded — not configurable per request, per the phase doc's # architectural constraint. CONFIDENCE_THRESHOLD: float = 0.6 # ── NGO escalation ──────────────────────────────────────────────────────── # # Severity score (1-5, from SituationReport) at or above which a confirmed # crisis is escalated to registered NGOs. Hard-coded per the phase doc. NGO_ESCALATION_THRESHOLD: int = 3 # Maps crisis type to the NGO categories that are relevant for that type. # An NGO matches when it has at least one category from this list AND its # coverage_areas overlap with the crisis location. Any crisis type not in # this map is treated as requiring "disaster_relief" as a fallback. NGO_CRISIS_TYPE_MAP: dict[str, list[str]] = { "flood": ["disaster_relief", "rescue"], "fire": ["fire_rescue", "medical"], "accident": ["medical", "rescue"], "building_collapse": ["rescue", "disaster_relief", "medical"], "heatwave": ["medical", "community_welfare"], "infrastructure_failure": ["disaster_relief"], "infrastructure": ["disaster_relief"], # detection-agent alias }