# rishi0754eegzvbhxhnh/final-year-project architecture

> Architecture diagram of the GitHub repository rishi0754eegzvbhxhnh/final-year-project, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rishi0754eegzvbhxhnh/final-year-project
- Repository: https://github.com/rishi0754eegzvbhxhnh/final-year-project

## Overview

SignalScout collects phone-probe and sensor readings, classifies them, maps coverage, and uses persistent weak/dead zones to drive evidence-backed complaints and later fix verification. The graph also preserves suggestions, analytics, model reporting, administration, and optional sensor hardware. Some frontend/API connections and unsampled subsystems are documented only at product level; those links are dashed where implementation wiring was not shown.

Main entry points: [`backend/app/api/ingest.py`](https://github.com/rishi0754eegzvbhxhnh/final-year-project/blob/main/backend/app/api/ingest.py) (Ingest endpoints), [`frontend/src/App.tsx`](https://github.com/rishi0754eegzvbhxhnh/final-year-project/blob/main/frontend/src/App.tsx) (Web app), [`backend/app/services/ingest.py`](https://github.com/rishi0754eegzvbhxhnh/final-year-project/blob/main/backend/app/services/ingest.py) (Reading ingestion), [`backend/app/services/complaint_service.py`](https://github.com/rishi0754eegzvbhxhnh/final-year-project/blob/main/backend/app/services/complaint_service.py) (Complaint lifecycle)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web and Field Probe"]
  node_web_app["Web app<br/>[App.tsx]"]
  node_probe["Phone probe<br/>[useProbe.ts]"]
  node_coverage_ui["Coverage map UI<br/>[CoverageMap.tsx]"]
  node_complaint_ui["Complaint UI"]
  node_operator_ui["Operator desk<br/>[OperatorDesk.tsx]"]
end

subgraph group_api["API and Access"]
  node_api_app["API application<br/>[main.py]"]
  node_auth["Authentication<br/>[security.py]"]
  node_ingest_api["Ingest endpoints<br/>[ingest.py]"]
  node_domain_api["Product endpoints"]
  node_database[("Application database<br/>[db.py]")]
  node_settings["Runtime settings"]
end

subgraph group_readings["Readings and Coverage"]
  node_ingest["Reading ingestion<br/>[ingest.py]"]
  node_coverage_api["Coverage queries<br/>[coverage.py]"]
  node_events["Live events<br/>[events.py]"]
  node_carrier["Carrier lookup<br/>[carrier.py]"]
end

subgraph group_complaints["Complaints and Operations"]
  node_zone_engine["Zone state engine<br/>[zone_engine.py]"]
  node_complaint_service["Complaint lifecycle"]
  node_evidence["Complaint evidence<br/>[evidence.py]"]
  node_notifications["Notifications<br/>[notifier.py]"]
end

subgraph group_models["Models and Suggestions"]
  node_classification["Reading classification<br/>[service.py]"]
  node_signal_rules["Signal ranges<br/>[signal_ranges.py]"]
  node_suggestions["Signal suggestions<br/>[suggest.py]"]
  node_analytics["Analytics and model metrics<br/>[analytics.py]"]
  node_training["Model training<br/>[train_all.py]"]
end

node_field_user(("Field user"))
node_sensor(("ESP32 / Simulator"))

node_field_user -->|"uses"| node_web_app
node_sensor -.->|"uploads readings"| node_ingest_api
node_web_app -.->|"starts measuring"| node_probe
node_probe -.->|"syncs batches"| node_ingest_api
node_web_app -.->|"views map"| node_coverage_ui
node_web_app -.->|"views complaints"| node_complaint_ui
node_web_app -.->|"opens desk"| node_operator_ui
node_api_app -->|"mounts router"| node_ingest_api
node_api_app -->|"mounts routers"| node_domain_api
node_ingest_api -->|"requires device auth"| node_auth
node_ingest_api -->|"looks up carrier"| node_carrier
node_ingest_api -->|"passes readings"| node_ingest
node_ingest -->|"classifies readings"| node_classification
node_classification -->|"uses fallback bands"| node_signal_rules
node_ingest -.->|"stores readings"| node_database
node_ingest -->|"publishes readings"| node_events
node_coverage_api -->|"queries readings"| node_database
node_coverage_api -.->|"streams updates"| node_events
node_ingest -.->|"triggers evaluation"| node_zone_engine
node_zone_engine -->|"reads zone history"| node_database
node_zone_engine -->|"loads thresholds"| node_settings
node_zone_engine -->|"transitions complaints"| node_complaint_service
node_complaint_service -->|"persists lifecycle"| node_database
node_complaint_service -->|"emits events"| node_events
node_complaint_service -->|"sends notices"| node_notifications
node_complaint_service -.->|"uses evidence"| node_evidence
node_domain_api -.->|"serves suggestions"| node_suggestions
node_domain_api -.->|"serves analytics"| node_analytics
node_training -->|"trains classifier"| node_classification
node_field_user -.->|"optional deployment"| node_sensor

click node_web_app "https://github.com/rishi0754eegzvbhxhnh/final-year-project/blob/main/frontend/src/App.tsx"
click node_probe "https://github.com/rishi0754eegzvbhxhnh/final-year-project/blob/main/frontend/src/lib/probe/useProbe.ts"
click node_coverage_ui "https://github.com/rishi0754eegzvbhxhnh/final-year-project/blob/main/frontend/src/pages/CoverageMap.tsx"
click node_complaint_ui "https://github.com/rishi0754eegzvbhxhnh/final-year-project/blob/main/frontend/src/pages/ComplaintDetail.tsx"
click node_operator_ui "https://github.com/rishi0754eegzvbhxhnh/final-year-project/blob/main/frontend/src/pages/desk/OperatorDesk.tsx"
click node_api_app "https://github.com/rishi0754eegzvbhxhnh/final-year-project/blob/main/backend/app/main.py"
click node_auth "https://github.com/rishi0754eegzvbhxhnh/final-year-project/blob/main/backend/app/core/security.py"
click node_ingest_api "https://github.com/rishi0754eegzvbhxhnh/final-year-project/blob/main/backend/app/api/ingest.py"
click node_domain_api "https://github.com/rishi0754eegzvbhxhnh/final-year-project/tree/main/backend/app/api"
click node_ingest "https://github.com/rishi0754eegzvbhxhnh/final-year-project/blob/main/backend/app/services/ingest.py"
click node_classification "https://github.com/rishi0754eegzvbhxhnh/final-year-project/blob/main/backend/app/ml/service.py"
click node_signal_rules "https://github.com/rishi0754eegzvbhxhnh/final-year-project/blob/main/backend/app/ml/signal_ranges.py"
click node_coverage_api "https://github.com/rishi0754eegzvbhxhnh/final-year-project/blob/main/backend/app/api/coverage.py"
click node_zone_engine "https://github.com/rishi0754eegzvbhxhnh/final-year-project/blob/main/backend/app/services/zone_engine.py"
click node_complaint_service "https://github.com/rishi0754eegzvbhxhnh/final-year-project/blob/main/backend/app/services/complaint_service.py"
click node_evidence "https://github.com/rishi0754eegzvbhxhnh/final-year-project/blob/main/backend/app/services/evidence.py"
click node_notifications "https://github.com/rishi0754eegzvbhxhnh/final-year-project/blob/main/backend/app/services/notifier.py"
click node_events "https://github.com/rishi0754eegzvbhxhnh/final-year-project/blob/main/backend/app/services/events.py"
click node_database "https://github.com/rishi0754eegzvbhxhnh/final-year-project/blob/main/backend/app/core/db.py"
click node_suggestions "https://github.com/rishi0754eegzvbhxhnh/final-year-project/blob/main/backend/app/ml/suggest.py"
click node_analytics "https://github.com/rishi0754eegzvbhxhnh/final-year-project/blob/main/backend/app/api/analytics.py"
click node_settings "https://github.com/rishi0754eegzvbhxhnh/final-year-project/blob/main/backend/app/services/settings_service.py"
click node_carrier "https://github.com/rishi0754eegzvbhxhnh/final-year-project/blob/main/backend/app/services/carrier.py"
click node_training "https://github.com/rishi0754eegzvbhxhnh/final-year-project/blob/main/ml/train_all.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_web_app,node_probe,node_coverage_ui,node_complaint_ui,node_operator_ui,node_field_user toneBlue
class node_api_app,node_auth,node_ingest_api,node_domain_api,node_database,node_settings toneAmber
class node_ingest,node_coverage_api,node_events,node_carrier toneMint
class node_zone_engine,node_complaint_service,node_evidence,node_notifications toneRose
class node_classification,node_signal_rules,node_suggestions,node_analytics,node_training,node_sensor toneIndigo
```

## Components

### Web and Field Probe

- [Web app](https://github.com/rishi0754eegzvbhxhnh/final-year-project/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Phone probe](https://github.com/rishi0754eegzvbhxhnh/final-year-project/blob/main/frontend/src/lib/probe/useProbe.ts): `frontend/src/lib/probe/useProbe.ts`
- [Coverage map UI](https://github.com/rishi0754eegzvbhxhnh/final-year-project/blob/main/frontend/src/pages/CoverageMap.tsx): `frontend/src/pages/CoverageMap.tsx`
- [Complaint UI](https://github.com/rishi0754eegzvbhxhnh/final-year-project/blob/main/frontend/src/pages/ComplaintDetail.tsx): `frontend/src/pages/ComplaintDetail.tsx`
- [Operator desk](https://github.com/rishi0754eegzvbhxhnh/final-year-project/blob/main/frontend/src/pages/desk/OperatorDesk.tsx): `frontend/src/pages/desk/OperatorDesk.tsx`

### API and Access

- [API application](https://github.com/rishi0754eegzvbhxhnh/final-year-project/blob/main/backend/app/main.py): `backend/app/main.py`
- [Authentication](https://github.com/rishi0754eegzvbhxhnh/final-year-project/blob/main/backend/app/core/security.py): `backend/app/core/security.py`
- [Ingest endpoints](https://github.com/rishi0754eegzvbhxhnh/final-year-project/blob/main/backend/app/api/ingest.py): `backend/app/api/ingest.py`
- [Product endpoints](https://github.com/rishi0754eegzvbhxhnh/final-year-project/tree/main/backend/app/api): `backend/app/api`
- [Application database](https://github.com/rishi0754eegzvbhxhnh/final-year-project/blob/main/backend/app/core/db.py): `backend/app/core/db.py`
- [Runtime settings](https://github.com/rishi0754eegzvbhxhnh/final-year-project/blob/main/backend/app/services/settings_service.py): `backend/app/services/settings_service.py`

### Readings and Coverage

- [Reading ingestion](https://github.com/rishi0754eegzvbhxhnh/final-year-project/blob/main/backend/app/services/ingest.py): `backend/app/services/ingest.py`
- [Coverage queries](https://github.com/rishi0754eegzvbhxhnh/final-year-project/blob/main/backend/app/api/coverage.py): `backend/app/api/coverage.py`
- [Live events](https://github.com/rishi0754eegzvbhxhnh/final-year-project/blob/main/backend/app/services/events.py): `backend/app/services/events.py`
- [Carrier lookup](https://github.com/rishi0754eegzvbhxhnh/final-year-project/blob/main/backend/app/services/carrier.py): `backend/app/services/carrier.py`

### Complaints and Operations

- [Zone state engine](https://github.com/rishi0754eegzvbhxhnh/final-year-project/blob/main/backend/app/services/zone_engine.py): `backend/app/services/zone_engine.py`
- [Complaint lifecycle](https://github.com/rishi0754eegzvbhxhnh/final-year-project/blob/main/backend/app/services/complaint_service.py): `backend/app/services/complaint_service.py`
- [Complaint evidence](https://github.com/rishi0754eegzvbhxhnh/final-year-project/blob/main/backend/app/services/evidence.py): `backend/app/services/evidence.py`
- [Notifications](https://github.com/rishi0754eegzvbhxhnh/final-year-project/blob/main/backend/app/services/notifier.py): `backend/app/services/notifier.py`

### Models and Suggestions

- [Reading classification](https://github.com/rishi0754eegzvbhxhnh/final-year-project/blob/main/backend/app/ml/service.py): `backend/app/ml/service.py`
- [Signal ranges](https://github.com/rishi0754eegzvbhxhnh/final-year-project/blob/main/backend/app/ml/signal_ranges.py): `backend/app/ml/signal_ranges.py`
- [Signal suggestions](https://github.com/rishi0754eegzvbhxhnh/final-year-project/blob/main/backend/app/ml/suggest.py): `backend/app/ml/suggest.py`
- [Analytics and model metrics](https://github.com/rishi0754eegzvbhxhnh/final-year-project/blob/main/backend/app/api/analytics.py): `backend/app/api/analytics.py`
- [Model training](https://github.com/rishi0754eegzvbhxhnh/final-year-project/blob/main/ml/train_all.py): `ml/train_all.py`

### Other components

- **Field user**
- **ESP32 / Simulator**

## Connections

- Field user → Web app: uses (evidence: `README.md`)
- ESP32 / Simulator → Ingest endpoints: uploads readings
- Web app → Phone probe: starts measuring
- Phone probe → Ingest endpoints: syncs batches
- Web app → Coverage map UI: views map
- Web app → Complaint UI: views complaints
- Web app → Operator desk: opens desk
- API application → Ingest endpoints: mounts router (evidence: `backend/app/main.py`)
- API application → Product endpoints: mounts routers (evidence: `backend/app/main.py`)
- Ingest endpoints → Authentication: requires device auth (evidence: `backend/app/api/ingest.py`)
- Ingest endpoints → Carrier lookup: looks up carrier (evidence: `backend/app/api/ingest.py`)
- Ingest endpoints → Reading ingestion: passes readings (evidence: `backend/app/api/ingest.py`)
- Reading ingestion → Reading classification: classifies readings (evidence: `backend/app/services/ingest.py`)
- Reading classification → Signal ranges: uses fallback bands (evidence: `backend/app/ml/service.py`)
- Reading ingestion → Application database: stores readings (evidence: `backend/app/services/ingest.py`)
- Reading ingestion → Live events: publishes readings (evidence: `backend/app/services/ingest.py`)
- Coverage queries → Application database: queries readings (evidence: `backend/app/api/coverage.py`)
- Coverage queries → Live events: streams updates (evidence: `backend/app/api/coverage.py`)
- Reading ingestion → Zone state engine: triggers evaluation
- Zone state engine → Application database: reads zone history (evidence: `backend/app/services/zone_engine.py`)
- Zone state engine → Runtime settings: loads thresholds (evidence: `backend/app/services/zone_engine.py`)
- Zone state engine → Complaint lifecycle: transitions complaints (evidence: `backend/app/services/zone_engine.py`)
- Complaint lifecycle → Application database: persists lifecycle (evidence: `backend/app/services/complaint_service.py`)
- Complaint lifecycle → Live events: emits events (evidence: `backend/app/services/complaint_service.py`)
- Complaint lifecycle → Notifications: sends notices (evidence: `backend/app/services/complaint_service.py`)
- Complaint lifecycle → Complaint evidence: uses evidence
- Product endpoints → Signal suggestions: serves suggestions
- Product endpoints → Analytics and model metrics: serves analytics
- Model training → Reading classification: trains classifier
- Field user → ESP32 / Simulator: optional deployment (evidence: `README.md`)
