# sandeshnepal106/al-based-rockfall-prediction-and-alert-system-for-open-pit-mines architecture

> Architecture diagram of the GitHub repository sandeshnepal106/al-based-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-11-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sandeshnepal106/al-based-rockfall-prediction-and-alert-system-for-open-pit-mines
- Repository: https://github.com/sandeshnepal106/al-based-rockfall-prediction-and-alert-system-for-open-pit-mines

## Overview

The product is a research-prototype rockfall-risk dashboard. Its main workflow is image upload, location selection, latest-upload lookup, Python prediction, and map/risk display. The graph also preserves the documented model-training workflow. The README documents prediction orchestration and integrations; the sampled source does not expose the full prediction controller implementation, so that link is documented rather than inferred from unsampled code.

Main entry points: [`vite-project/src/App.jsx`](https://github.com/sandeshnepal106/al-based-rockfall-prediction-and-alert-system-for-open-pit-mines/blob/main/vite-project/src/App.jsx) (Dashboard state), [`server/routes/locationRoutes.js`](https://github.com/sandeshnepal106/al-based-rockfall-prediction-and-alert-system-for-open-pit-mines/blob/main/server/routes/locationRoutes.js) (Location routes), [`server/server.js`](https://github.com/sandeshnepal106/al-based-rockfall-prediction-and-alert-system-for-open-pit-mines/blob/main/server/server.js) (Express server), [`server/routes/imageRoutes.js`](https://github.com/sandeshnepal106/al-based-rockfall-prediction-and-alert-system-for-open-pit-mines/blob/main/server/routes/imageRoutes.js) (Image upload route)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dashboard["Web dashboard"]
  node_app["Dashboard state<br/>[App.jsx]"]
  node_header["Header<br/>[header.jsx]"]
  node_uploadui["Image upload UI<br/>[fileupload.jsx]"]
  node_preview["Image preview<br/>[imagepreview.jsx]"]
  node_locationui["Location search UI<br/>[locationsearch.jsx]"]
  node_mapui["Risk map<br/>[riskmap.jsx]"]
  node_mapview["Map view<br/>[map.jsx]"]
end

subgraph group_api["Express API"]
  node_api_server["Express server<br/>[server.js]"]
  node_upload_route["Image upload route<br/>[imageRoutes.js]"]
  node_location_route["Location routes<br/>[locationRoutes.js]"]
  node_upload_controller["Upload handler<br/>[imageController.js]"]
  node_location_controller["Location resolver"]
  node_latest_middleware["Latest image lookup<br/>[getImage.js]"]
  node_prediction_handler["Prediction orchestration<br/>[getLatestInfo.js]"]
end

subgraph group_prediction["Prediction and training"]
  node_predictor["Risk predictor"]
  node_model["Trained model<br/>[model.pkl]"]
  node_training["Model training<br/>[train_model.ipynb]"]
  node_training_data["Rockfall dataset"]
end

subgraph group_persistence["Image storage"]
  node_upload_middleware["Cloudinary upload<br/>[multer.js]"]
  node_image_model[("Image records<br/>[imageModel.js]")]
  node_mongodb["MongoDB connection<br/>[mongodb.js]"]
  node_cloudinary["Cloudinary client<br/>[cloudinary.js]"]
end

node_user(("Site user"))
node_nominatim["Nominatim"]
node_weather["WeatherAPI"]
node_python_process["Python process"]

node_user -->|"uses"| node_app
node_app -->|"renders"| node_header
node_app -->|"renders"| node_uploadui
node_app -->|"renders"| node_preview
node_app -->|"renders"| node_locationui
node_app -->|"renders"| node_mapui
node_app -->|"uploads and requests"| node_api_server
node_app -->|"passes risk data"| node_mapui
node_mapui -.->|"displays location"| node_mapview
node_api_server -->|"mounts"| node_upload_route
node_api_server -->|"mounts"| node_location_route
node_api_server -->|"connects"| node_mongodb
node_upload_route -->|"processes upload"| node_upload_middleware
node_upload_route -->|"dispatches to"| node_upload_controller
node_upload_middleware -->|"stores images"| node_cloudinary
node_upload_controller -->|"saves record"| node_image_model
node_location_route -->|"loads latest image"| node_latest_middleware
node_location_route -->|"dispatches to"| node_location_controller
node_location_route -->|"dispatches prediction"| node_prediction_handler
node_latest_middleware -->|"reads latest record"| node_image_model
node_location_controller -->|"updates coordinates"| node_image_model
node_location_controller -->|"searches locations"| node_nominatim
node_location_route -->|"searches suggestions"| node_nominatim
node_prediction_handler -->|"runs predictor"| node_python_process
node_python_process -->|"executes"| node_predictor
node_predictor -->|"loads model"| node_model
node_predictor -->|"retrieves weather"| node_weather
node_training -->|"loads data"| node_training_data
node_training -->|"serializes pipeline"| node_model

click node_app "https://github.com/sandeshnepal106/al-based-rockfall-prediction-and-alert-system-for-open-pit-mines/blob/main/vite-project/src/App.jsx"
click node_header "https://github.com/sandeshnepal106/al-based-rockfall-prediction-and-alert-system-for-open-pit-mines/blob/main/vite-project/src/components/header.jsx"
click node_uploadui "https://github.com/sandeshnepal106/al-based-rockfall-prediction-and-alert-system-for-open-pit-mines/blob/main/vite-project/src/components/fileupload.jsx"
click node_preview "https://github.com/sandeshnepal106/al-based-rockfall-prediction-and-alert-system-for-open-pit-mines/blob/main/vite-project/src/components/imagepreview.jsx"
click node_locationui "https://github.com/sandeshnepal106/al-based-rockfall-prediction-and-alert-system-for-open-pit-mines/blob/main/vite-project/src/components/locationsearch.jsx"
click node_mapui "https://github.com/sandeshnepal106/al-based-rockfall-prediction-and-alert-system-for-open-pit-mines/blob/main/vite-project/src/components/riskmap.jsx"
click node_mapview "https://github.com/sandeshnepal106/al-based-rockfall-prediction-and-alert-system-for-open-pit-mines/blob/main/vite-project/src/components/map.jsx"
click node_api_server "https://github.com/sandeshnepal106/al-based-rockfall-prediction-and-alert-system-for-open-pit-mines/blob/main/server/server.js"
click node_upload_route "https://github.com/sandeshnepal106/al-based-rockfall-prediction-and-alert-system-for-open-pit-mines/blob/main/server/routes/imageRoutes.js"
click node_location_route "https://github.com/sandeshnepal106/al-based-rockfall-prediction-and-alert-system-for-open-pit-mines/blob/main/server/routes/locationRoutes.js"
click node_upload_controller "https://github.com/sandeshnepal106/al-based-rockfall-prediction-and-alert-system-for-open-pit-mines/blob/main/server/controller/imageController.js"
click node_location_controller "https://github.com/sandeshnepal106/al-based-rockfall-prediction-and-alert-system-for-open-pit-mines/blob/main/server/controller/locationController.js"
click node_latest_middleware "https://github.com/sandeshnepal106/al-based-rockfall-prediction-and-alert-system-for-open-pit-mines/blob/main/server/middleware/getImage.js"
click node_prediction_handler "https://github.com/sandeshnepal106/al-based-rockfall-prediction-and-alert-system-for-open-pit-mines/blob/main/server/controller/getLatestInfo.js"
click node_upload_middleware "https://github.com/sandeshnepal106/al-based-rockfall-prediction-and-alert-system-for-open-pit-mines/blob/main/server/middleware/multer.js"
click node_image_model "https://github.com/sandeshnepal106/al-based-rockfall-prediction-and-alert-system-for-open-pit-mines/blob/main/server/models/imageModel.js"
click node_mongodb "https://github.com/sandeshnepal106/al-based-rockfall-prediction-and-alert-system-for-open-pit-mines/blob/main/server/config/mongodb.js"
click node_cloudinary "https://github.com/sandeshnepal106/al-based-rockfall-prediction-and-alert-system-for-open-pit-mines/blob/main/server/config/cloudinary.js"
click node_predictor "https://github.com/sandeshnepal106/al-based-rockfall-prediction-and-alert-system-for-open-pit-mines/blob/main/python_service/predict_rockfall.py"
click node_model "https://github.com/sandeshnepal106/al-based-rockfall-prediction-and-alert-system-for-open-pit-mines/blob/main/ml_training/model.pkl"
click node_training "https://github.com/sandeshnepal106/al-based-rockfall-prediction-and-alert-system-for-open-pit-mines/blob/main/ml_training/train_model.ipynb"
click node_training_data "https://github.com/sandeshnepal106/al-based-rockfall-prediction-and-alert-system-for-open-pit-mines/blob/main/ml_training/yosemodiFinal_with_rockfall.csv"

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_header,node_uploadui,node_preview,node_locationui,node_mapui,node_mapview,node_user toneBlue
class node_api_server,node_upload_route,node_location_route,node_upload_controller,node_location_controller,node_latest_middleware,node_prediction_handler toneAmber
class node_predictor,node_model,node_training,node_training_data,node_weather toneMint
class node_upload_middleware,node_image_model,node_mongodb,node_cloudinary toneRose
class node_nominatim,node_python_process toneIndigo
```

## Components

### Web dashboard

- [Dashboard state](https://github.com/sandeshnepal106/al-based-rockfall-prediction-and-alert-system-for-open-pit-mines/blob/main/vite-project/src/App.jsx): `vite-project/src/App.jsx`
- [Header](https://github.com/sandeshnepal106/al-based-rockfall-prediction-and-alert-system-for-open-pit-mines/blob/main/vite-project/src/components/header.jsx): `vite-project/src/components/header.jsx`
- [Image upload UI](https://github.com/sandeshnepal106/al-based-rockfall-prediction-and-alert-system-for-open-pit-mines/blob/main/vite-project/src/components/fileupload.jsx): `vite-project/src/components/fileupload.jsx`
- [Image preview](https://github.com/sandeshnepal106/al-based-rockfall-prediction-and-alert-system-for-open-pit-mines/blob/main/vite-project/src/components/imagepreview.jsx): `vite-project/src/components/imagepreview.jsx`
- [Location search UI](https://github.com/sandeshnepal106/al-based-rockfall-prediction-and-alert-system-for-open-pit-mines/blob/main/vite-project/src/components/locationsearch.jsx): `vite-project/src/components/locationsearch.jsx`
- [Risk map](https://github.com/sandeshnepal106/al-based-rockfall-prediction-and-alert-system-for-open-pit-mines/blob/main/vite-project/src/components/riskmap.jsx): `vite-project/src/components/riskmap.jsx`
- [Map view](https://github.com/sandeshnepal106/al-based-rockfall-prediction-and-alert-system-for-open-pit-mines/blob/main/vite-project/src/components/map.jsx): `vite-project/src/components/map.jsx`

### Express API

- [Express server](https://github.com/sandeshnepal106/al-based-rockfall-prediction-and-alert-system-for-open-pit-mines/blob/main/server/server.js): `server/server.js`
- [Image upload route](https://github.com/sandeshnepal106/al-based-rockfall-prediction-and-alert-system-for-open-pit-mines/blob/main/server/routes/imageRoutes.js): `server/routes/imageRoutes.js`
- [Location routes](https://github.com/sandeshnepal106/al-based-rockfall-prediction-and-alert-system-for-open-pit-mines/blob/main/server/routes/locationRoutes.js): `server/routes/locationRoutes.js`
- [Upload handler](https://github.com/sandeshnepal106/al-based-rockfall-prediction-and-alert-system-for-open-pit-mines/blob/main/server/controller/imageController.js): `server/controller/imageController.js`
- [Location resolver](https://github.com/sandeshnepal106/al-based-rockfall-prediction-and-alert-system-for-open-pit-mines/blob/main/server/controller/locationController.js): `server/controller/locationController.js`
- [Latest image lookup](https://github.com/sandeshnepal106/al-based-rockfall-prediction-and-alert-system-for-open-pit-mines/blob/main/server/middleware/getImage.js): `server/middleware/getImage.js`
- [Prediction orchestration](https://github.com/sandeshnepal106/al-based-rockfall-prediction-and-alert-system-for-open-pit-mines/blob/main/server/controller/getLatestInfo.js): `server/controller/getLatestInfo.js`

### Prediction and training

- [Risk predictor](https://github.com/sandeshnepal106/al-based-rockfall-prediction-and-alert-system-for-open-pit-mines/blob/main/python_service/predict_rockfall.py): `python_service/predict_rockfall.py`
- [Trained model](https://github.com/sandeshnepal106/al-based-rockfall-prediction-and-alert-system-for-open-pit-mines/blob/main/ml_training/model.pkl): `ml_training/model.pkl`
- [Model training](https://github.com/sandeshnepal106/al-based-rockfall-prediction-and-alert-system-for-open-pit-mines/blob/main/ml_training/train_model.ipynb): `ml_training/train_model.ipynb`
- [Rockfall dataset](https://github.com/sandeshnepal106/al-based-rockfall-prediction-and-alert-system-for-open-pit-mines/blob/main/ml_training/yosemodiFinal_with_rockfall.csv): `ml_training/yosemodiFinal_with_rockfall.csv`

### Image storage

- [Cloudinary upload](https://github.com/sandeshnepal106/al-based-rockfall-prediction-and-alert-system-for-open-pit-mines/blob/main/server/middleware/multer.js): `server/middleware/multer.js`
- [Image records](https://github.com/sandeshnepal106/al-based-rockfall-prediction-and-alert-system-for-open-pit-mines/blob/main/server/models/imageModel.js): `server/models/imageModel.js`
- [MongoDB connection](https://github.com/sandeshnepal106/al-based-rockfall-prediction-and-alert-system-for-open-pit-mines/blob/main/server/config/mongodb.js): `server/config/mongodb.js`
- [Cloudinary client](https://github.com/sandeshnepal106/al-based-rockfall-prediction-and-alert-system-for-open-pit-mines/blob/main/server/config/cloudinary.js): `server/config/cloudinary.js`

### Other components

- **Site user**
- **Nominatim**
- **WeatherAPI**
- **Python process**

## Connections

- Site user → Dashboard state: uses (evidence: `README.md`)
- Dashboard state → Header: renders (evidence: `vite-project/src/App.jsx`)
- Dashboard state → Image upload UI: renders (evidence: `vite-project/src/App.jsx`)
- Dashboard state → Image preview: renders (evidence: `vite-project/src/App.jsx`)
- Dashboard state → Location search UI: renders (evidence: `vite-project/src/App.jsx`)
- Dashboard state → Risk map: renders (evidence: `vite-project/src/App.jsx`)
- Dashboard state → Express server: uploads and requests (evidence: `vite-project/src/App.jsx`)
- Dashboard state → Risk map: passes risk data (evidence: `vite-project/src/App.jsx`)
- Risk map → Map view: displays location
- Express server → Image upload route: mounts (evidence: `server/server.js`)
- Express server → Location routes: mounts (evidence: `server/server.js`)
- Express server → MongoDB connection: connects (evidence: `server/server.js`)
- Image upload route → Cloudinary upload: processes upload (evidence: `server/routes/imageRoutes.js`)
- Image upload route → Upload handler: dispatches to (evidence: `server/routes/imageRoutes.js`)
- Cloudinary upload → Cloudinary client: stores images (evidence: `server/middleware/multer.js`)
- Upload handler → Image records: saves record (evidence: `server/controller/imageController.js`)
- Location routes → Latest image lookup: loads latest image (evidence: `server/routes/locationRoutes.js`)
- Location routes → Location resolver: dispatches to (evidence: `server/routes/locationRoutes.js`)
- Location routes → Prediction orchestration: dispatches prediction (evidence: `server/routes/locationRoutes.js`)
- Latest image lookup → Image records: reads latest record (evidence: `server/middleware/getImage.js`)
- Location resolver → Image records: updates coordinates (evidence: `server/controller/locationController.js`)
- Location resolver → Nominatim: searches locations (evidence: `server/controller/locationController.js`)
- Location routes → Nominatim: searches suggestions (evidence: `server/routes/locationRoutes.js`)
- Prediction orchestration → Python process: runs predictor (evidence: `README.md`)
- Python process → Risk predictor: executes (evidence: `README.md`)
- Risk predictor → Trained model: loads model (evidence: `README.md`)
- Risk predictor → WeatherAPI: retrieves weather (evidence: `README.md`)
- Model training → Rockfall dataset: loads data (evidence: `README.md`)
- Model training → Trained model: serializes pipeline (evidence: `README.md`)
