# pramodrajsubedi/seismic-event-risk-intelligence-system architecture

> Architecture diagram of the GitHub repository pramodrajsubedi/seismic-event-risk-intelligence-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pramodrajsubedi/seismic-event-risk-intelligence-system
- Repository: https://github.com/pramodrajsubedi/seismic-event-risk-intelligence-system

## Overview

This repository is a seismic-risk intelligence dashboard backed by a USGS-fed SQLite catalogue and an aftershock-risk classifier. The principal workflow is dashboard access, optional data setup, earthquake ingestion and regional/sequence enrichment, model training, then live prediction and historical analysis. The graph preserves the documented live map, predictor, analytics, SQL, EDA, and SHAP capabilities. Some dashboard and training excerpts are partial, so uncertain query execution and internal wiring are omitted.

Main entry points: [`src/app.py`](https://github.com/pramodrajsubedi/seismic-event-risk-intelligence-system/blob/main/src/app.py) (Streamlit dashboard), [`src/database.py`](https://github.com/pramodrajsubedi/seismic-event-risk-intelligence-system/blob/main/src/database.py) (SQLite database), [`src/setup_data.py`](https://github.com/pramodrajsubedi/seismic-event-risk-intelligence-system/blob/main/src/setup_data.py) (Data setup), [`src/train.py`](https://github.com/pramodrajsubedi/seismic-event-risk-intelligence-system/blob/main/src/train.py) (Model training)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Earthquake data"]
  node_setup["Data setup<br/>[setup_data.py]"]
  node_ingest["Catalog ingestion<br/>[ingest.py]"]
  node_regions["Region assignment<br/>[seed_region.py]"]
  node_database[("SQLite database<br/>[database.py]")]
end

subgraph group_science["Seismic analysis"]
  node_sequences["Sequence builder<br/>[aftershock.py]"]
  node_sqlanalytics["SQL analyses<br/>[gutenberg.sql]"]
  node_eda["EDA notebook<br/>[eda.ipynb]"]
end

subgraph group_ml["Risk modeling"]
  node_training["Model training<br/>[train.py]"]
  node_artifacts["Model artifacts<br/>[model.pkl]"]
  node_scaler["Feature scaler<br/>[scaler.pkl]"]
  node_features["Feature names<br/>[feature_names.pkl]"]
end

subgraph group_product["Dashboard"]
  node_app["Streamlit dashboard<br/>[app.py]"]
end

node_visitor(("Dashboard user"))
node_usgs{{"USGS catalog"}}

node_visitor -->|"uses"| node_app
node_app -.->|"initializes if needed"| node_setup
node_setup -->|"fetches events"| node_ingest
node_ingest -->|"requests catalog"| node_usgs
node_setup -->|"initializes and writes"| node_database
node_setup -->|"assigns regions"| node_regions
node_setup -->|"builds sequences"| node_sequences
node_regions -->|"updates regions"| node_database
node_sequences -->|"reads events; writes sequences"| node_database
node_ingest -->|"inserts events"| node_database
node_app -->|"fetches live events"| node_usgs
node_app -->|"reads historical data"| node_database
node_app -->|"loads classifier"| node_artifacts
node_app -->|"loads scaler"| node_scaler
node_app -->|"loads feature order"| node_features
node_training -->|"reads training data"| node_database
node_training -->|"saves classifier"| node_artifacts
node_training -->|"saves scaler"| node_scaler
node_training -->|"saves feature order"| node_features

click node_app "https://github.com/pramodrajsubedi/seismic-event-risk-intelligence-system/blob/main/src/app.py"
click node_setup "https://github.com/pramodrajsubedi/seismic-event-risk-intelligence-system/blob/main/src/setup_data.py"
click node_ingest "https://github.com/pramodrajsubedi/seismic-event-risk-intelligence-system/blob/main/src/ingest.py"
click node_regions "https://github.com/pramodrajsubedi/seismic-event-risk-intelligence-system/blob/main/src/seed_region.py"
click node_sequences "https://github.com/pramodrajsubedi/seismic-event-risk-intelligence-system/blob/main/src/aftershock.py"
click node_database "https://github.com/pramodrajsubedi/seismic-event-risk-intelligence-system/blob/main/src/database.py"
click node_sqlanalytics "https://github.com/pramodrajsubedi/seismic-event-risk-intelligence-system/blob/main/queiries/gutenberg.sql"
click node_eda "https://github.com/pramodrajsubedi/seismic-event-risk-intelligence-system/blob/main/notebooks/eda.ipynb"
click node_training "https://github.com/pramodrajsubedi/seismic-event-risk-intelligence-system/blob/main/src/train.py"
click node_artifacts "https://github.com/pramodrajsubedi/seismic-event-risk-intelligence-system/blob/main/models/model.pkl"
click node_scaler "https://github.com/pramodrajsubedi/seismic-event-risk-intelligence-system/blob/main/models/scaler.pkl"
click node_features "https://github.com/pramodrajsubedi/seismic-event-risk-intelligence-system/blob/main/models/feature_names.pkl"

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_setup,node_ingest,node_regions,node_database,node_visitor toneBlue
class node_sequences,node_sqlanalytics,node_eda toneAmber
class node_training,node_artifacts,node_scaler,node_features toneMint
class node_app toneRose
class node_usgs toneIndigo
```

## Components

### Earthquake data

- [Data setup](https://github.com/pramodrajsubedi/seismic-event-risk-intelligence-system/blob/main/src/setup_data.py): `src/setup_data.py`
- [Catalog ingestion](https://github.com/pramodrajsubedi/seismic-event-risk-intelligence-system/blob/main/src/ingest.py): `src/ingest.py`
- [Region assignment](https://github.com/pramodrajsubedi/seismic-event-risk-intelligence-system/blob/main/src/seed_region.py): `src/seed_region.py`
- [SQLite database](https://github.com/pramodrajsubedi/seismic-event-risk-intelligence-system/blob/main/src/database.py): `src/database.py`

### Seismic analysis

- [Sequence builder](https://github.com/pramodrajsubedi/seismic-event-risk-intelligence-system/blob/main/src/aftershock.py): `src/aftershock.py`
- [SQL analyses](https://github.com/pramodrajsubedi/seismic-event-risk-intelligence-system/blob/main/queiries/gutenberg.sql): `queiries/gutenberg.sql`
- [EDA notebook](https://github.com/pramodrajsubedi/seismic-event-risk-intelligence-system/blob/main/notebooks/eda.ipynb): `notebooks/eda.ipynb`

### Risk modeling

- [Model training](https://github.com/pramodrajsubedi/seismic-event-risk-intelligence-system/blob/main/src/train.py): `src/train.py`
- [Model artifacts](https://github.com/pramodrajsubedi/seismic-event-risk-intelligence-system/blob/main/models/model.pkl): `models/model.pkl`
- [Feature scaler](https://github.com/pramodrajsubedi/seismic-event-risk-intelligence-system/blob/main/models/scaler.pkl): `models/scaler.pkl`
- [Feature names](https://github.com/pramodrajsubedi/seismic-event-risk-intelligence-system/blob/main/models/feature_names.pkl): `models/feature_names.pkl`

### Dashboard

- [Streamlit dashboard](https://github.com/pramodrajsubedi/seismic-event-risk-intelligence-system/blob/main/src/app.py): `src/app.py`

### Other components

- **Dashboard user**
- **USGS catalog**

## Connections

- Dashboard user → Streamlit dashboard: uses
- Streamlit dashboard → Data setup: initializes if needed
- Data setup → Catalog ingestion: fetches events
- Catalog ingestion → USGS catalog: requests catalog
- Data setup → SQLite database: initializes and writes
- Data setup → Region assignment: assigns regions
- Data setup → Sequence builder: builds sequences
- Region assignment → SQLite database: updates regions
- Sequence builder → SQLite database: reads events; writes sequences
- Catalog ingestion → SQLite database: inserts events
- Streamlit dashboard → USGS catalog: fetches live events
- Streamlit dashboard → SQLite database: reads historical data
- Streamlit dashboard → Model artifacts: loads classifier
- Streamlit dashboard → Feature scaler: loads scaler
- Streamlit dashboard → Feature names: loads feature order
- Model training → SQLite database: reads training data
- Model training → Model artifacts: saves classifier
- Model training → Feature scaler: saves scaler
- Model training → Feature names: saves feature order
