# rohithkannas/tourist-safety-dashboard architecture

> Architecture diagram of the GitHub repository rohithkannas/tourist-safety-dashboard, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rohithkannas/tourist-safety-dashboard
- Repository: https://github.com/rohithkannas/tourist-safety-dashboard

## Overview

SafeGuard is an authority-facing tourist safety dashboard. The main workflow is officers signing in, monitoring tourist locations and SOS alerts, and taking follow-up actions; parallel capabilities cover zones, analytics, emergency services, audit, and e-FIR. The backend exposes authenticated Firebase-backed APIs, while a separate Flask/LSTM service provides risk predictions. Frontend implementation was not sampled, so its feature links rely on README documentation; the ML service-to-predictor and backend-to-Firestore links are supported by excerpts.

Main entry points: [`frontend/assets/js/api.js`](https://github.com/rohithkannas/tourist-safety-dashboard/blob/main/frontend/assets/js/api.js) (API client), [`frontend/dashboard.html`](https://github.com/rohithkannas/tourist-safety-dashboard/blob/main/frontend/dashboard.html) (Tourist dashboard), [`frontend/analytics.html`](https://github.com/rohithkannas/tourist-safety-dashboard/blob/main/frontend/analytics.html) (Risk analytics), [`frontend/login.html`](https://github.com/rohithkannas/tourist-safety-dashboard/blob/main/frontend/login.html) (Sign-in)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Safety dashboard"]
  node_login["Sign-in<br/>[login.html]"]
  node_dashboard["Tourist dashboard<br/>[dashboard.html]"]
  node_map["Live map<br/>[map.js]"]
  node_alerts["SOS alerts<br/>[alerts.html]"]
  node_zones["Geofence tools<br/>[geofence.html]"]
  node_analytics["Risk analytics<br/>[analytics.html]"]
  node_efir["E-FIR filing<br/>[efir.html]"]
  node_audit["Audit logs<br/>[audit.html]"]
  node_language["Language support<br/>[i18n.js]"]
  node_api["API client<br/>[api.js]"]
  node_auth["Authentication<br/>[auth.js]"]
end

subgraph group_backend["Application backend"]
  node_backend["REST API<br/>[index.js]"]
end

subgraph group_ml["Risk prediction"]
  node_mlapi["Prediction API<br/>[api_server.py]"]
  node_predictor["LSTM predictor<br/>[lstm_predictor.py]"]
end

subgraph group_services["External services"]
  node_firestore[("Application records")]
  node_firebaseauth["Firebase Auth"]
  node_mapbox["Mapbox maps"]
end

node_officer(("Safety officer"))

node_officer -->|"signs in"| node_login
node_officer -->|"monitors"| node_dashboard
node_dashboard -->|"views locations"| node_map
node_dashboard -.->|"requests data"| node_api
node_alerts -.->|"manages alerts"| node_api
node_zones -.->|"manages zones"| node_api
node_analytics -.->|"requests metrics"| node_api
node_audit -.->|"requests logs"| node_api
node_login -.->|"authenticates"| node_auth
node_auth -->|"uses"| node_firebaseauth
node_api -.->|"calls"| node_backend
node_backend -->|"reads and writes"| node_firestore
node_mlapi -->|"calls"| node_predictor
node_predictor -->|"fetches training data"| node_firestore
node_analytics -.->|"requests predictions"| node_mlapi
node_dashboard -->|"renders maps"| node_mapbox
node_language -->|"localizes interface"| node_dashboard
node_efir -->|"supports filing"| node_officer

click node_login "https://github.com/rohithkannas/tourist-safety-dashboard/blob/main/frontend/login.html"
click node_dashboard "https://github.com/rohithkannas/tourist-safety-dashboard/blob/main/frontend/dashboard.html"
click node_map "https://github.com/rohithkannas/tourist-safety-dashboard/blob/main/frontend/assets/js/map.js"
click node_alerts "https://github.com/rohithkannas/tourist-safety-dashboard/blob/main/frontend/alerts.html"
click node_zones "https://github.com/rohithkannas/tourist-safety-dashboard/blob/main/frontend/geofence.html"
click node_analytics "https://github.com/rohithkannas/tourist-safety-dashboard/blob/main/frontend/analytics.html"
click node_efir "https://github.com/rohithkannas/tourist-safety-dashboard/blob/main/frontend/efir.html"
click node_audit "https://github.com/rohithkannas/tourist-safety-dashboard/blob/main/frontend/audit.html"
click node_language "https://github.com/rohithkannas/tourist-safety-dashboard/blob/main/frontend/assets/js/i18n.js"
click node_api "https://github.com/rohithkannas/tourist-safety-dashboard/blob/main/frontend/assets/js/api.js"
click node_auth "https://github.com/rohithkannas/tourist-safety-dashboard/blob/main/frontend/assets/js/auth.js"
click node_backend "https://github.com/rohithkannas/tourist-safety-dashboard/blob/main/backend/index.js"
click node_mlapi "https://github.com/rohithkannas/tourist-safety-dashboard/blob/main/ml-service/api_server.py"
click node_predictor "https://github.com/rohithkannas/tourist-safety-dashboard/blob/main/ml-service/lstm_predictor.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_login,node_dashboard,node_map,node_alerts,node_zones,node_analytics,node_efir,node_audit,node_language,node_api,node_auth toneBlue
class node_backend toneAmber
class node_mlapi,node_predictor toneMint
class node_firestore,node_firebaseauth,node_mapbox toneRose
class node_officer toneIndigo
```

## Components

### Safety dashboard

- [Sign-in](https://github.com/rohithkannas/tourist-safety-dashboard/blob/main/frontend/login.html): `frontend/login.html`
- [Tourist dashboard](https://github.com/rohithkannas/tourist-safety-dashboard/blob/main/frontend/dashboard.html): `frontend/dashboard.html`
- [Live map](https://github.com/rohithkannas/tourist-safety-dashboard/blob/main/frontend/assets/js/map.js): `frontend/assets/js/map.js`
- [SOS alerts](https://github.com/rohithkannas/tourist-safety-dashboard/blob/main/frontend/alerts.html): `frontend/alerts.html`
- [Geofence tools](https://github.com/rohithkannas/tourist-safety-dashboard/blob/main/frontend/geofence.html): `frontend/geofence.html`
- [Risk analytics](https://github.com/rohithkannas/tourist-safety-dashboard/blob/main/frontend/analytics.html): `frontend/analytics.html`
- [E-FIR filing](https://github.com/rohithkannas/tourist-safety-dashboard/blob/main/frontend/efir.html): `frontend/efir.html`
- [Audit logs](https://github.com/rohithkannas/tourist-safety-dashboard/blob/main/frontend/audit.html): `frontend/audit.html`
- [Language support](https://github.com/rohithkannas/tourist-safety-dashboard/blob/main/frontend/assets/js/i18n.js): `frontend/assets/js/i18n.js`
- [API client](https://github.com/rohithkannas/tourist-safety-dashboard/blob/main/frontend/assets/js/api.js): `frontend/assets/js/api.js`
- [Authentication](https://github.com/rohithkannas/tourist-safety-dashboard/blob/main/frontend/assets/js/auth.js): `frontend/assets/js/auth.js`

### Application backend

- [REST API](https://github.com/rohithkannas/tourist-safety-dashboard/blob/main/backend/index.js): `backend/index.js`

### Risk prediction

- [Prediction API](https://github.com/rohithkannas/tourist-safety-dashboard/blob/main/ml-service/api_server.py): `ml-service/api_server.py`
- [LSTM predictor](https://github.com/rohithkannas/tourist-safety-dashboard/blob/main/ml-service/lstm_predictor.py): `ml-service/lstm_predictor.py`

### External services

- **Application records**
- **Firebase Auth**
- **Mapbox maps**

### Other components

- **Safety officer**

## Connections

- Safety officer → Sign-in: signs in (evidence: `README.md`)
- Safety officer → Tourist dashboard: monitors (evidence: `README.md`)
- Tourist dashboard → Live map: views locations (evidence: `README.md`)
- Tourist dashboard → API client: requests data
- SOS alerts → API client: manages alerts
- Geofence tools → API client: manages zones
- Risk analytics → API client: requests metrics
- Audit logs → API client: requests logs
- Sign-in → Authentication: authenticates
- Authentication → Firebase Auth: uses (evidence: `README.md`)
- API client → REST API: calls
- REST API → Application records: reads and writes (evidence: `backend/index.js`)
- Prediction API → LSTM predictor: calls (evidence: `ml-service/api_server.py`)
- LSTM predictor → Application records: fetches training data (evidence: `ml-service/lstm_predictor.py`)
- Risk analytics → Prediction API: requests predictions
- Tourist dashboard → Mapbox maps: renders maps (evidence: `README.md`)
- Language support → Tourist dashboard: localizes interface (evidence: `README.md`)
- E-FIR filing → Safety officer: supports filing (evidence: `README.md`)
