# abhimahto/ai-powered-rockfall-prediction-and-alert-system-for-open-pit-mines- architecture

> Architecture diagram of the GitHub repository abhimahto/ai-powered-rockfall-prediction-and-alert-system-for-open-pit-mines-, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/abhimahto/ai-powered-rockfall-prediction-and-alert-system-for-open-pit-mines-
- Repository: https://github.com/abhimahto/ai-powered-rockfall-prediction-and-alert-system-for-open-pit-mines-

## Overview

RockGuard AI is a mine-safety dashboard with a Flask prediction backend. Safety managers sign in, review mine and environmental risk, submit images or webcam frames for analysis, and view predictions and alerts. The README documents an ONNX detector with an OpenCV fallback, sensor-based safety calculations, mitigation plans, and SMS/WhatsApp alerts. The available backend excerpt confirms detection and SQLite logging, but not every described calculation or integration; those connections are therefore limited to documented capabilities and are marked optional where appropriate.

Main entry points: [`frontend/src/App.jsx`](https://github.com/abhimahto/ai-powered-rockfall-prediction-and-alert-system-for-open-pit-mines-/blob/main/frontend/src/App.jsx) (App and routes), [`backend/app.py`](https://github.com/abhimahto/ai-powered-rockfall-prediction-and-alert-system-for-open-pit-mines-/blob/main/backend/app.py) (Flask API), [`frontend/src/contexts/AuthContext.jsx`](https://github.com/abhimahto/ai-powered-rockfall-prediction-and-alert-system-for-open-pit-mines-/blob/main/frontend/src/contexts/AuthContext.jsx) (Auth context), [`frontend/src/components/ImageUploadAnalysis.jsx`](https://github.com/abhimahto/ai-powered-rockfall-prediction-and-alert-system-for-open-pit-mines-/blob/main/frontend/src/components/ImageUploadAnalysis.jsx) (Image analysis)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and dashboard"]
  node_app["App and routes<br/>[App.jsx]"]
  node_auth["Auth context<br/>[AuthContext.jsx]"]
  node_login["Login<br/>[Login.jsx]"]
  node_dashboard["Risk dashboard<br/>[Dashboard.jsx]"]
  node_indian["India mine dashboard"]
  node_riskmap["Risk map<br/>[RiskMap.jsx]"]
  node_mine_data["Mine risk data<br/>[indianMinesData.js]"]
end

subgraph group_analysis["Monitoring and analysis"]
  node_image_upload["Image analysis"]
  node_webcam["Live webcam<br/>[LiveWebcam.jsx]"]
  node_environment["Environmental monitor"]
  node_prediction["Safety prediction"]
end

subgraph group_response["Risk response"]
  node_alerts["Alert system<br/>[AlertSystem.jsx]"]
  node_alarm["Pit-hole alarm<br/>[PitHoleAlarm.jsx]"]
  node_notifications["SMS and WhatsApp"]
  node_reports["Report generator"]
end

subgraph group_backend["Prediction backend"]
  node_backend_api["Flask API<br/>[app.py]"]
  node_detector["Visual risk detector<br/>[app.py]"]
  node_sqlite[("SQLite logs<br/>[app.py]")]
end

node_manager(("Safety manager"))
node_camera(("Camera or webcam"))
node_sensor(("Mine sensors"))

node_manager -->|"uses"| node_app
node_app -->|"provides auth"| node_auth
node_app -->|"routes to"| node_login
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_indian
node_app -->|"routes to"| node_riskmap
node_app -->|"routes to"| node_image_upload
node_app -->|"routes to"| node_webcam
node_app -->|"routes to"| node_prediction
node_app -->|"routes to"| node_environment
node_app -->|"routes to"| node_alarm
node_app -->|"routes to"| node_notifications
node_login -->|"authenticates via"| node_auth
node_auth -->|"persists session"| node_manager
node_indian -->|"reads"| node_mine_data
node_camera -->|"streams frames"| node_webcam
node_camera -->|"provides image"| node_image_upload
node_webcam -->|"posts frame"| node_backend_api
node_image_upload -->|"posts image"| node_backend_api
node_backend_api -->|"invokes detection"| node_detector
node_detector -->|"returns detections"| node_backend_api
node_backend_api -->|"logs alerts and sensors"| node_sqlite
node_sensor -.->|"telemetry logs"| node_sqlite
node_prediction -->|"requests prediction"| node_backend_api
node_environment -.->|"fetches monitoring data"| node_backend_api
node_dashboard -->|"presents mine risk"| node_riskmap
node_alerts -.->|"reads alert records"| node_sqlite
node_alarm -->|"surfaces warnings"| node_alerts
node_notifications -.->|"delivers alerts"| node_manager
node_reports -->|"presents reports"| node_manager

click node_app "https://github.com/abhimahto/ai-powered-rockfall-prediction-and-alert-system-for-open-pit-mines-/blob/main/frontend/src/App.jsx"
click node_auth "https://github.com/abhimahto/ai-powered-rockfall-prediction-and-alert-system-for-open-pit-mines-/blob/main/frontend/src/contexts/AuthContext.jsx"
click node_login "https://github.com/abhimahto/ai-powered-rockfall-prediction-and-alert-system-for-open-pit-mines-/blob/main/frontend/src/components/Login.jsx"
click node_dashboard "https://github.com/abhimahto/ai-powered-rockfall-prediction-and-alert-system-for-open-pit-mines-/blob/main/frontend/src/components/Dashboard.jsx"
click node_indian "https://github.com/abhimahto/ai-powered-rockfall-prediction-and-alert-system-for-open-pit-mines-/blob/main/frontend/src/components/IndianRockfallDashboard.jsx"
click node_riskmap "https://github.com/abhimahto/ai-powered-rockfall-prediction-and-alert-system-for-open-pit-mines-/blob/main/frontend/src/components/RiskMap.jsx"
click node_mine_data "https://github.com/abhimahto/ai-powered-rockfall-prediction-and-alert-system-for-open-pit-mines-/blob/main/frontend/src/data/indianMinesData.js"
click node_image_upload "https://github.com/abhimahto/ai-powered-rockfall-prediction-and-alert-system-for-open-pit-mines-/blob/main/frontend/src/components/ImageUploadAnalysis.jsx"
click node_webcam "https://github.com/abhimahto/ai-powered-rockfall-prediction-and-alert-system-for-open-pit-mines-/blob/main/frontend/src/components/LiveWebcam.jsx"
click node_environment "https://github.com/abhimahto/ai-powered-rockfall-prediction-and-alert-system-for-open-pit-mines-/blob/main/frontend/src/components/EnvironmentalMonitor.jsx"
click node_prediction "https://github.com/abhimahto/ai-powered-rockfall-prediction-and-alert-system-for-open-pit-mines-/blob/main/frontend/src/components/PredictionModel.jsx"
click node_backend_api "https://github.com/abhimahto/ai-powered-rockfall-prediction-and-alert-system-for-open-pit-mines-/blob/main/backend/app.py"
click node_detector "https://github.com/abhimahto/ai-powered-rockfall-prediction-and-alert-system-for-open-pit-mines-/blob/main/backend/app.py"
click node_sqlite "https://github.com/abhimahto/ai-powered-rockfall-prediction-and-alert-system-for-open-pit-mines-/blob/main/backend/app.py"
click node_alerts "https://github.com/abhimahto/ai-powered-rockfall-prediction-and-alert-system-for-open-pit-mines-/blob/main/frontend/src/components/AlertSystem.jsx"
click node_alarm "https://github.com/abhimahto/ai-powered-rockfall-prediction-and-alert-system-for-open-pit-mines-/blob/main/frontend/src/components/PitHoleAlarm.jsx"
click node_notifications "https://github.com/abhimahto/ai-powered-rockfall-prediction-and-alert-system-for-open-pit-mines-/blob/main/frontend/src/components/SMSWhatsAppAlerts.jsx"
click node_reports "https://github.com/abhimahto/ai-powered-rockfall-prediction-and-alert-system-for-open-pit-mines-/blob/main/frontend/src/components/ReportGenerator.jsx"

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_login,node_dashboard,node_indian,node_riskmap,node_mine_data toneBlue
class node_image_upload,node_webcam,node_environment,node_prediction toneAmber
class node_alerts,node_alarm,node_notifications,node_reports toneMint
class node_backend_api,node_detector,node_sqlite toneRose
class node_manager,node_camera,node_sensor toneIndigo
```

## Components

### Access and dashboard

- [App and routes](https://github.com/abhimahto/ai-powered-rockfall-prediction-and-alert-system-for-open-pit-mines-/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Auth context](https://github.com/abhimahto/ai-powered-rockfall-prediction-and-alert-system-for-open-pit-mines-/blob/main/frontend/src/contexts/AuthContext.jsx): `frontend/src/contexts/AuthContext.jsx`
- [Login](https://github.com/abhimahto/ai-powered-rockfall-prediction-and-alert-system-for-open-pit-mines-/blob/main/frontend/src/components/Login.jsx): `frontend/src/components/Login.jsx`
- [Risk dashboard](https://github.com/abhimahto/ai-powered-rockfall-prediction-and-alert-system-for-open-pit-mines-/blob/main/frontend/src/components/Dashboard.jsx): `frontend/src/components/Dashboard.jsx`
- [India mine dashboard](https://github.com/abhimahto/ai-powered-rockfall-prediction-and-alert-system-for-open-pit-mines-/blob/main/frontend/src/components/IndianRockfallDashboard.jsx): `frontend/src/components/IndianRockfallDashboard.jsx`
- [Risk map](https://github.com/abhimahto/ai-powered-rockfall-prediction-and-alert-system-for-open-pit-mines-/blob/main/frontend/src/components/RiskMap.jsx): `frontend/src/components/RiskMap.jsx`
- [Mine risk data](https://github.com/abhimahto/ai-powered-rockfall-prediction-and-alert-system-for-open-pit-mines-/blob/main/frontend/src/data/indianMinesData.js): `frontend/src/data/indianMinesData.js`

### Monitoring and analysis

- [Image analysis](https://github.com/abhimahto/ai-powered-rockfall-prediction-and-alert-system-for-open-pit-mines-/blob/main/frontend/src/components/ImageUploadAnalysis.jsx): `frontend/src/components/ImageUploadAnalysis.jsx`
- [Live webcam](https://github.com/abhimahto/ai-powered-rockfall-prediction-and-alert-system-for-open-pit-mines-/blob/main/frontend/src/components/LiveWebcam.jsx): `frontend/src/components/LiveWebcam.jsx`
- [Environmental monitor](https://github.com/abhimahto/ai-powered-rockfall-prediction-and-alert-system-for-open-pit-mines-/blob/main/frontend/src/components/EnvironmentalMonitor.jsx): `frontend/src/components/EnvironmentalMonitor.jsx`
- [Safety prediction](https://github.com/abhimahto/ai-powered-rockfall-prediction-and-alert-system-for-open-pit-mines-/blob/main/frontend/src/components/PredictionModel.jsx): `frontend/src/components/PredictionModel.jsx`

### Risk response

- [Alert system](https://github.com/abhimahto/ai-powered-rockfall-prediction-and-alert-system-for-open-pit-mines-/blob/main/frontend/src/components/AlertSystem.jsx): `frontend/src/components/AlertSystem.jsx`
- [Pit-hole alarm](https://github.com/abhimahto/ai-powered-rockfall-prediction-and-alert-system-for-open-pit-mines-/blob/main/frontend/src/components/PitHoleAlarm.jsx): `frontend/src/components/PitHoleAlarm.jsx`
- [SMS and WhatsApp](https://github.com/abhimahto/ai-powered-rockfall-prediction-and-alert-system-for-open-pit-mines-/blob/main/frontend/src/components/SMSWhatsAppAlerts.jsx): `frontend/src/components/SMSWhatsAppAlerts.jsx`
- [Report generator](https://github.com/abhimahto/ai-powered-rockfall-prediction-and-alert-system-for-open-pit-mines-/blob/main/frontend/src/components/ReportGenerator.jsx): `frontend/src/components/ReportGenerator.jsx`

### Prediction backend

- [Flask API](https://github.com/abhimahto/ai-powered-rockfall-prediction-and-alert-system-for-open-pit-mines-/blob/main/backend/app.py): `backend/app.py`
- [Visual risk detector](https://github.com/abhimahto/ai-powered-rockfall-prediction-and-alert-system-for-open-pit-mines-/blob/main/backend/app.py): `backend/app.py`
- [SQLite logs](https://github.com/abhimahto/ai-powered-rockfall-prediction-and-alert-system-for-open-pit-mines-/blob/main/backend/app.py): `backend/app.py`

### Other components

- **Safety manager**
- **Camera or webcam**
- **Mine sensors**

## Connections

- Safety manager → App and routes: uses
- App and routes → Auth context: provides auth
- App and routes → Login: routes to
- App and routes → Risk dashboard: routes to
- App and routes → India mine dashboard: routes to
- App and routes → Risk map: routes to
- App and routes → Image analysis: routes to
- App and routes → Live webcam: routes to
- App and routes → Safety prediction: routes to
- App and routes → Environmental monitor: routes to
- App and routes → Pit-hole alarm: routes to
- App and routes → SMS and WhatsApp: routes to
- Login → Auth context: authenticates via
- Auth context → Safety manager: persists session
- India mine dashboard → Mine risk data: reads
- Camera or webcam → Live webcam: streams frames
- Camera or webcam → Image analysis: provides image
- Live webcam → Flask API: posts frame
- Image analysis → Flask API: posts image
- Flask API → Visual risk detector: invokes detection
- Visual risk detector → Flask API: returns detections
- Flask API → SQLite logs: logs alerts and sensors
- Mine sensors → SQLite logs: telemetry logs
- Safety prediction → Flask API: requests prediction
- Environmental monitor → Flask API: fetches monitoring data
- Risk dashboard → Risk map: presents mine risk
- Alert system → SQLite logs: reads alert records
- Pit-hole alarm → Alert system: surfaces warnings
- SMS and WhatsApp → Safety manager: delivers alerts
- Report generator → Safety manager: presents reports
