# neto-santana-22/hidroscan architecture

> Architecture diagram of the GitHub repository neto-santana-22/hidroscan, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/neto-santana-22/hidroscan
- Repository: https://github.com/neto-santana-22/hidroscan

## Overview

Hidroscan is a water-monitoring and resource-management system: residents and staff use a role-based web interface to review readings, alerts, requests, and operational work. The backend models properties and devices, records meter readings, detects consumption anomalies, and supports valve commands, occurrences, work orders, and reports. The excerpts show key service-level calls and data access; most page-to-API wiring and several backend routes were not sampled, so those links are omitted rather than inferred.

Main entry points: [`frontend/src/layouts/MainLayout.tsx`](https://github.com/neto-santana-22/hidroscan/blob/main/frontend/src/layouts/MainLayout.tsx) (Role-based pages), [`occurrences/services.py`](https://github.com/neto-santana-22/hidroscan/blob/main/occurrences/services.py) (Occurrence workflow), [`reports/services.py`](https://github.com/neto-santana-22/hidroscan/blob/main/reports/services.py) (Report generation), [`frontend/src/App.tsx`](https://github.com/neto-santana-22/hidroscan/blob/main/frontend/src/App.tsx) (App and login)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web interface"]
  node_app["App and login<br/>[App.tsx]"]
  node_auth["Demo authentication<br/>[AuthContext.tsx]"]
  node_layout["Role-based pages<br/>[MainLayout.tsx]"]
  node_monitorpage["Monitoring page<br/>[MonitoringPage.tsx]"]
  node_resident["Resident pages"]
  node_consumptionpage["Consumption page"]
  node_requests_page["Resident requests page"]
  node_techalerts["Technician alerts page"]
  node_techequipment["Equipment page"]
  node_techhistory["Technician history"]
  node_techorders["Work orders page"]
end

subgraph group_identity["Accounts and access"]
  node_users[("Users and verification<br/>[models.py]")]
  node_account_service["Account services<br/>[services.py]"]
end

subgraph group_water["Water monitoring"]
  node_property_device[("Properties and devices<br/>[models.py]")]
  node_device_service["Device and audit services<br/>[services.py]"]
  node_readings[("Meter readings<br/>[models.py]")]
  node_reading_service["Reading registration<br/>[services.py]"]
  node_audit[("Audit log<br/>[models.py]")]
end

subgraph group_operations["Operations"]
  node_valves["Valve commands<br/>[services.py]"]
  node_occurrence_service["Occurrence workflow<br/>[services.py]"]
  node_occurrences[("Occurrences<br/>[models.py]")]
  node_requests[("Resident requests<br/>[models.py]")]
  node_workorders[("Work orders<br/>[models.py]")]
end

subgraph group_insights["Alerts and reporting"]
  node_alerts[("Alerts<br/>[models.py]")]
  node_alert_engine["Anomaly evaluation<br/>[engine.py]"]
  node_reports["Report generation<br/>[services.py]"]
end

node_user(("Resident or staff"))
node_email(("Email service"))

node_user -->|"submits login"| node_app
node_app -->|"calls login"| node_auth
node_app -->|"renders when authenticated"| node_layout
node_layout -->|"routes to"| node_monitorpage
node_layout -->|"routes to"| node_resident
node_layout -->|"routes to"| node_consumptionpage
node_layout -->|"routes to"| node_requests_page
node_layout -->|"routes to"| node_techalerts
node_layout -->|"routes to"| node_techequipment
node_layout -->|"routes to"| node_techhistory
node_layout -->|"routes to"| node_techorders
node_account_service -->|"creates and verifies"| node_users
node_account_service -->|"sends verification"| node_email
node_device_service -->|"creates device"| node_property_device
node_device_service -->|"writes audit"| node_audit
node_reading_service -->|"locks device"| node_property_device
node_reading_service -->|"records reading"| node_readings
node_alert_engine -->|"creates or updates"| node_alerts
node_occurrence_service -->|"creates and updates"| node_occurrences
node_occurrence_service -->|"records audit"| node_audit
node_occurrence_service -->|"resolves linked alert"| node_alerts
node_valves -->|"updates valve state"| node_property_device
node_valves -->|"records command"| node_audit
node_reports -->|"queries readings"| node_readings
node_reports -->|"queries alerts"| node_alerts
node_reports -->|"queries occurrences"| node_occurrences

click node_app "https://github.com/neto-santana-22/hidroscan/blob/main/frontend/src/App.tsx"
click node_auth "https://github.com/neto-santana-22/hidroscan/blob/main/frontend/src/contexts/AuthContext.tsx"
click node_layout "https://github.com/neto-santana-22/hidroscan/blob/main/frontend/src/layouts/MainLayout.tsx"
click node_monitorpage "https://github.com/neto-santana-22/hidroscan/blob/main/frontend/src/pages/MonitoringPage.tsx"
click node_resident "https://github.com/neto-santana-22/hidroscan/blob/main/frontend/src/pages/ResidentOverviewPage.tsx"
click node_consumptionpage "https://github.com/neto-santana-22/hidroscan/blob/main/frontend/src/pages/ResidentConsumptionPage.tsx"
click node_requests_page "https://github.com/neto-santana-22/hidroscan/blob/main/frontend/src/pages/ResidentRequestsPage.tsx"
click node_techalerts "https://github.com/neto-santana-22/hidroscan/blob/main/frontend/src/pages/TechnicianAlertsPage.tsx"
click node_techequipment "https://github.com/neto-santana-22/hidroscan/blob/main/frontend/src/pages/TechnicianEquipmentPage.tsx"
click node_techhistory "https://github.com/neto-santana-22/hidroscan/blob/main/frontend/src/pages/TechnicianHistoryPage.tsx"
click node_techorders "https://github.com/neto-santana-22/hidroscan/blob/main/frontend/src/pages/TechnicianOrdersPage.tsx"
click node_users "https://github.com/neto-santana-22/hidroscan/blob/main/accounts/models.py"
click node_account_service "https://github.com/neto-santana-22/hidroscan/blob/main/accounts/services.py"
click node_property_device "https://github.com/neto-santana-22/hidroscan/blob/main/hidroscan/models.py"
click node_device_service "https://github.com/neto-santana-22/hidroscan/blob/main/hidroscan/services.py"
click node_readings "https://github.com/neto-santana-22/hidroscan/blob/main/monitoring/models.py"
click node_reading_service "https://github.com/neto-santana-22/hidroscan/blob/main/monitoring/services.py"
click node_valves "https://github.com/neto-santana-22/hidroscan/blob/main/control/services.py"
click node_occurrence_service "https://github.com/neto-santana-22/hidroscan/blob/main/occurrences/services.py"
click node_occurrences "https://github.com/neto-santana-22/hidroscan/blob/main/occurrences/models.py"
click node_requests "https://github.com/neto-santana-22/hidroscan/blob/main/resident_requests/models.py"
click node_workorders "https://github.com/neto-santana-22/hidroscan/blob/main/workorders/models.py"
click node_alerts "https://github.com/neto-santana-22/hidroscan/blob/main/alerts/models.py"
click node_alert_engine "https://github.com/neto-santana-22/hidroscan/blob/main/alerts/engine.py"
click node_reports "https://github.com/neto-santana-22/hidroscan/blob/main/reports/services.py"
click node_audit "https://github.com/neto-santana-22/hidroscan/blob/main/hidroscan/models.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_app,node_auth,node_layout,node_monitorpage,node_resident,node_consumptionpage,node_requests_page,node_techalerts,node_techequipment,node_techhistory,node_techorders toneBlue
class node_users,node_account_service toneAmber
class node_property_device,node_device_service,node_readings,node_reading_service,node_audit toneMint
class node_valves,node_occurrence_service,node_occurrences,node_requests,node_workorders toneRose
class node_alerts,node_alert_engine,node_reports,node_user,node_email toneIndigo
```

## Components

### Web interface

- [App and login](https://github.com/neto-santana-22/hidroscan/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Demo authentication](https://github.com/neto-santana-22/hidroscan/blob/main/frontend/src/contexts/AuthContext.tsx): `frontend/src/contexts/AuthContext.tsx`
- [Role-based pages](https://github.com/neto-santana-22/hidroscan/blob/main/frontend/src/layouts/MainLayout.tsx): `frontend/src/layouts/MainLayout.tsx`
- [Monitoring page](https://github.com/neto-santana-22/hidroscan/blob/main/frontend/src/pages/MonitoringPage.tsx): `frontend/src/pages/MonitoringPage.tsx`
- [Resident pages](https://github.com/neto-santana-22/hidroscan/blob/main/frontend/src/pages/ResidentOverviewPage.tsx): `frontend/src/pages/ResidentOverviewPage.tsx`
- [Consumption page](https://github.com/neto-santana-22/hidroscan/blob/main/frontend/src/pages/ResidentConsumptionPage.tsx): `frontend/src/pages/ResidentConsumptionPage.tsx`
- [Resident requests page](https://github.com/neto-santana-22/hidroscan/blob/main/frontend/src/pages/ResidentRequestsPage.tsx): `frontend/src/pages/ResidentRequestsPage.tsx`
- [Technician alerts page](https://github.com/neto-santana-22/hidroscan/blob/main/frontend/src/pages/TechnicianAlertsPage.tsx): `frontend/src/pages/TechnicianAlertsPage.tsx`
- [Equipment page](https://github.com/neto-santana-22/hidroscan/blob/main/frontend/src/pages/TechnicianEquipmentPage.tsx): `frontend/src/pages/TechnicianEquipmentPage.tsx`
- [Technician history](https://github.com/neto-santana-22/hidroscan/blob/main/frontend/src/pages/TechnicianHistoryPage.tsx): `frontend/src/pages/TechnicianHistoryPage.tsx`
- [Work orders page](https://github.com/neto-santana-22/hidroscan/blob/main/frontend/src/pages/TechnicianOrdersPage.tsx): `frontend/src/pages/TechnicianOrdersPage.tsx`

### Accounts and access

- [Users and verification](https://github.com/neto-santana-22/hidroscan/blob/main/accounts/models.py): `accounts/models.py`
- [Account services](https://github.com/neto-santana-22/hidroscan/blob/main/accounts/services.py): `accounts/services.py`

### Water monitoring

- [Properties and devices](https://github.com/neto-santana-22/hidroscan/blob/main/hidroscan/models.py): `hidroscan/models.py`
- [Device and audit services](https://github.com/neto-santana-22/hidroscan/blob/main/hidroscan/services.py): `hidroscan/services.py`
- [Meter readings](https://github.com/neto-santana-22/hidroscan/blob/main/monitoring/models.py): `monitoring/models.py`
- [Reading registration](https://github.com/neto-santana-22/hidroscan/blob/main/monitoring/services.py): `monitoring/services.py`
- [Audit log](https://github.com/neto-santana-22/hidroscan/blob/main/hidroscan/models.py): `hidroscan/models.py`

### Operations

- [Valve commands](https://github.com/neto-santana-22/hidroscan/blob/main/control/services.py): `control/services.py`
- [Occurrence workflow](https://github.com/neto-santana-22/hidroscan/blob/main/occurrences/services.py): `occurrences/services.py`
- [Occurrences](https://github.com/neto-santana-22/hidroscan/blob/main/occurrences/models.py): `occurrences/models.py`
- [Resident requests](https://github.com/neto-santana-22/hidroscan/blob/main/resident_requests/models.py): `resident_requests/models.py`
- [Work orders](https://github.com/neto-santana-22/hidroscan/blob/main/workorders/models.py): `workorders/models.py`

### Alerts and reporting

- [Alerts](https://github.com/neto-santana-22/hidroscan/blob/main/alerts/models.py): `alerts/models.py`
- [Anomaly evaluation](https://github.com/neto-santana-22/hidroscan/blob/main/alerts/engine.py): `alerts/engine.py`
- [Report generation](https://github.com/neto-santana-22/hidroscan/blob/main/reports/services.py): `reports/services.py`

### Other components

- **Resident or staff**
- **Email service**

## Connections

- Resident or staff → App and login: submits login (evidence: `frontend/src/App.tsx`)
- App and login → Demo authentication: calls login (evidence: `frontend/src/App.tsx`)
- App and login → Role-based pages: renders when authenticated (evidence: `frontend/src/App.tsx`)
- Role-based pages → Monitoring page: routes to (evidence: `frontend/src/layouts/MainLayout.tsx`)
- Role-based pages → Resident pages: routes to (evidence: `frontend/src/layouts/MainLayout.tsx`)
- Role-based pages → Consumption page: routes to (evidence: `frontend/src/layouts/MainLayout.tsx`)
- Role-based pages → Resident requests page: routes to (evidence: `frontend/src/layouts/MainLayout.tsx`)
- Role-based pages → Technician alerts page: routes to (evidence: `frontend/src/layouts/MainLayout.tsx`)
- Role-based pages → Equipment page: routes to (evidence: `frontend/src/layouts/MainLayout.tsx`)
- Role-based pages → Technician history: routes to (evidence: `frontend/src/layouts/MainLayout.tsx`)
- Role-based pages → Work orders page: routes to (evidence: `frontend/src/layouts/MainLayout.tsx`)
- Account services → Users and verification: creates and verifies (evidence: `accounts/services.py`)
- Account services → Email service: sends verification (evidence: `accounts/services.py`)
- Device and audit services → Properties and devices: creates device (evidence: `hidroscan/services.py`)
- Device and audit services → Audit log: writes audit (evidence: `hidroscan/services.py`)
- Reading registration → Properties and devices: locks device (evidence: `monitoring/services.py`)
- Reading registration → Meter readings: records reading (evidence: `monitoring/services.py`)
- Anomaly evaluation → Alerts: creates or updates (evidence: `alerts/engine.py`)
- Occurrence workflow → Occurrences: creates and updates (evidence: `occurrences/services.py`)
- Occurrence workflow → Audit log: records audit (evidence: `occurrences/services.py`)
- Occurrence workflow → Alerts: resolves linked alert (evidence: `occurrences/services.py`)
- Valve commands → Properties and devices: updates valve state (evidence: `control/services.py`)
- Valve commands → Audit log: records command (evidence: `control/services.py`)
- Report generation → Meter readings: queries readings (evidence: `reports/services.py`)
- Report generation → Alerts: queries alerts (evidence: `reports/services.py`)
- Report generation → Occurrences: queries occurrences (evidence: `reports/services.py`)
