Update backend/README.md

#17
by munals - opened
Files changed (1) hide show
  1. backend/README.md +12 -11
backend/README.md CHANGED
@@ -18,10 +18,10 @@ HaramGuard/
18
  β”œβ”€β”€ agents/ ← One file per agent
19
  β”‚ β”œβ”€β”€ __init__.py
20
  β”‚ β”œβ”€β”€ perception_agent.py ← YOLO tracking + Guardrails GR1/GR2
21
- β”‚ β”œβ”€β”€ risk_agent.py ← Sliding window + count-based scoring
22
  β”‚ β”œβ”€β”€ reflection_agent.py ← Self-critique design pattern (Bias detection)
23
  β”‚ β”œβ”€β”€ operations_agent.py ← Event-driven playbook + rate-limit guardrail
24
- β”‚ └── coordinator_agent.py ← GPT-4o + output validation guardrails GR-C1..5
25
  β”‚
26
  └── outputs/ ← Auto-created at runtime
27
  β”œβ”€β”€ hajjflow_rt.db ← Main SQLite database
@@ -37,16 +37,16 @@ Frame
37
  PerceptionAgent β†’ FrameResult (YOLO detect + track)
38
  β”‚
39
  β–Ό
40
- RiskAgent β†’ RiskResult (count-based risk score)
41
  β”‚
42
  β–Ό
43
  ReflectionAgent β†’ reflection{} (bias check + correction)
44
  β”‚
45
  β–Ό
46
  OperationsAgent β†’ Decision (event-driven, P0/P1/P2)
47
- β”‚ (P0 only)
48
  β–Ό
49
- CoordinatorAgent β†’ plan{} (GPT-4o action plan)
50
  β”‚
51
  β–Ό
52
  pipeline.state β†’ Dashboard
@@ -58,9 +58,10 @@ pipeline.state β†’ Dashboard
58
  |----|-------|-------------|
59
  | GR1 | PerceptionAgent | Person count capped at 500 |
60
  | GR2 | PerceptionAgent | Density score capped at 50 |
61
- | GR3 | RiskAgent | Risk score clamped to [0, 1] |
62
- | GR4 | OperationsAgent | P0 rate-limited (1 per 5 min per zone) |
63
- | GR-C1..5 | CoordinatorAgent | LLM output validation (fields, threat level, confidence, consistency, Arabic fallback) |
 
64
  | RF1..3 | ReflectionAgent | Chronic LOW bias, rising trend ignored, count-risk mismatch |
65
 
66
  ## πŸ“Š Run Evaluation
@@ -81,9 +82,9 @@ Rubric coverage:
81
  - βœ… Error analysis methodology (Section 6)
82
  - βœ… Evidence of iterative improvement (Section 7)
83
 
84
- ## πŸš€ Run Dashboard
85
 
86
  ```bash
87
  pip install -r requirements.txt
88
- streamlit run dashboard.py
89
- ```
 
18
  β”œβ”€β”€ agents/ ← One file per agent
19
  β”‚ β”œβ”€β”€ __init__.py
20
  β”‚ β”œβ”€β”€ perception_agent.py ← YOLO tracking + Guardrails GR1/GR2
21
+ β”‚ β”œβ”€β”€ risk_agent.py ← Clip segmentation + sliding K-window density scoring
22
  β”‚ β”œβ”€β”€ reflection_agent.py ← Self-critique design pattern (Bias detection)
23
  β”‚ β”œβ”€β”€ operations_agent.py ← Event-driven playbook + rate-limit guardrail
24
+ β”‚ └── coordinator_agent.py ← openai/gpt-oss-120b + output validation guardrails GR-C1..5
25
  β”‚
26
  └── outputs/ ← Auto-created at runtime
27
  β”œβ”€β”€ hajjflow_rt.db ← Main SQLite database
 
37
  PerceptionAgent β†’ FrameResult (YOLO detect + track)
38
  β”‚
39
  β–Ό
40
+ RiskAgent β†’ RiskResult (clip segmentation + K-window density score)
41
  β”‚
42
  β–Ό
43
  ReflectionAgent β†’ reflection{} (bias check + correction)
44
  β”‚
45
  β–Ό
46
  OperationsAgent β†’ Decision (event-driven, P0/P1/P2)
47
+ β”‚
48
  β–Ό
49
+ CoordinatorAgent β†’ plan{} (openai/gpt-oss-120b action plan, all priorities)
50
  β”‚
51
  β–Ό
52
  pipeline.state β†’ Dashboard
 
58
  |----|-------|-------------|
59
  | GR1 | PerceptionAgent | Person count capped at 500 |
60
  | GR2 | PerceptionAgent | Density score capped at 50 |
61
+ | GR3 | RiskAgent | Risk score clamped to [0, 1] (density_pct / 100) |
62
+ | GR3b | RiskAgent | level_changed suppressed during K-window warmup (first 17 frames per clip) |
63
+ | GR4 | OperationsAgent | P0 rate-limited (1 per 5 min per zone); resets on pipeline restart |
64
+ | GR-C1..5 | CoordinatorAgent | LLM output validation (fields, threat_level, confidence, score-level consistency, Arabic fallback) |
65
  | RF1..3 | ReflectionAgent | Chronic LOW bias, rising trend ignored, count-risk mismatch |
66
 
67
  ## πŸ“Š Run Evaluation
 
82
  - βœ… Error analysis methodology (Section 6)
83
  - βœ… Evidence of iterative improvement (Section 7)
84
 
85
+ ## πŸš€ Run Backend API
86
 
87
  ```bash
88
  pip install -r requirements.txt
89
+ python api.py
90
+ ```