# siddharth2024-bot/shield architecture

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

- Interactive diagram: https://gitdiagram.com/siddharth2024-bot/shield
- Repository: https://github.com/siddharth2024-bot/shield

## Overview

SHIELD (CrimeSentinel) accepts transaction details and produces a district prediction and ranked ATM watchlist. The API’s /predict and /demo routes invoke the prediction pipeline; the pipeline predicts districts, scores ATMs in each, and returns an alert report. Separate modules generate synthetic case and ATM data and train the district model. The dashboard and rule-based explainer are present, but the excerpts do not establish how either connects to the API or prediction flow; the README is empty.

Main entry points: [`Pipeline/predicttrace.py`](https://github.com/siddharth2024-bot/shield/blob/master/Pipeline/predicttrace.py) (Prediction Pipeline), [`Pipeline/atm_scorer.py`](https://github.com/siddharth2024-bot/shield/blob/master/Pipeline/atm_scorer.py) (ATM Risk Scoring), [`API/main.py`](https://github.com/siddharth2024-bot/shield/blob/master/API/main.py) (SHIELD API), [`Data/generate_atm_database.py`](https://github.com/siddharth2024-bot/shield/blob/master/Data/generate_atm_database.py) (ATM Data Generator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User Interface"]
  node_dashboard["Dashboard"]
  node_api["SHIELD API<br/>[main.py]"]
end

subgraph group_prediction["Prediction and Risk"]
  node_pipeline["Prediction Pipeline<br/>[predicttrace.py]"]
  node_district_model["District Prediction<br/>[predicttrace.py]"]
  node_atm_scorer["ATM Risk Scoring<br/>[atm_scorer.py]"]
  node_explainer["Rule-Based Explainer<br/>[explainer.py]"]
end

subgraph group_data_model["Data and Model"]
  node_case_generator["Case Data Generator"]
  node_atm_generator["ATM Data Generator"]
  node_fraud_cases[("Fraud Cases<br/>[fraud_cases.csv]")]
  node_atm_master[("ATM Master Data<br/>[atm_master.csv]")]
  node_atm_activity[("ATM Activity<br/>[atm_activity.csv]")]
  node_trainer["Model Training<br/>[train_model.py]"]
  node_model_artifacts[("Model and Encoders")]
end

node_operator(("Analyst"))

node_operator -.->|"uses"| node_dashboard
node_dashboard -.->|"calls API"| node_api
node_operator -->|"submits transaction"| node_api
node_api -->|"runs prediction"| node_pipeline
node_pipeline -->|"predicts districts"| node_district_model
node_pipeline -->|"ranks ATMs"| node_atm_scorer
node_case_generator -->|"writes cases"| node_fraud_cases
node_atm_generator -->|"writes master"| node_atm_master
node_atm_generator -->|"writes activity"| node_atm_activity
node_trainer -->|"reads cases"| node_fraud_cases
node_trainer -->|"saves model"| node_model_artifacts
node_district_model -->|"loads model"| node_model_artifacts
node_atm_scorer -->|"reads ATM data"| node_atm_master
node_atm_scorer -->|"reads history"| node_atm_activity

click node_dashboard "https://github.com/siddharth2024-bot/shield/blob/master/Frontend/shield_dashboard.html"
click node_api "https://github.com/siddharth2024-bot/shield/blob/master/API/main.py"
click node_pipeline "https://github.com/siddharth2024-bot/shield/blob/master/Pipeline/predicttrace.py"
click node_district_model "https://github.com/siddharth2024-bot/shield/blob/master/Pipeline/predicttrace.py"
click node_atm_scorer "https://github.com/siddharth2024-bot/shield/blob/master/Pipeline/atm_scorer.py"
click node_explainer "https://github.com/siddharth2024-bot/shield/blob/master/Pipeline/explainer.py"
click node_case_generator "https://github.com/siddharth2024-bot/shield/blob/master/Data/generate_fraud_cases.py"
click node_atm_generator "https://github.com/siddharth2024-bot/shield/blob/master/Data/generate_atm_database.py"
click node_fraud_cases "https://github.com/siddharth2024-bot/shield/blob/master/Data/fraud_cases.csv"
click node_atm_master "https://github.com/siddharth2024-bot/shield/blob/master/Data/atm_master.csv"
click node_atm_activity "https://github.com/siddharth2024-bot/shield/blob/master/Data/atm_activity.csv"
click node_trainer "https://github.com/siddharth2024-bot/shield/blob/master/Model/train_model.py"
click node_model_artifacts "https://github.com/siddharth2024-bot/shield/tree/master/Model"

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_dashboard,node_api toneBlue
class node_pipeline,node_district_model,node_atm_scorer,node_explainer toneAmber
class node_case_generator,node_atm_generator,node_fraud_cases,node_atm_master,node_atm_activity,node_trainer,node_model_artifacts toneMint
class node_operator toneIndigo
```

## Components

### User Interface

- [Dashboard](https://github.com/siddharth2024-bot/shield/blob/master/Frontend/shield_dashboard.html): `Frontend/shield_dashboard.html`
- [SHIELD API](https://github.com/siddharth2024-bot/shield/blob/master/API/main.py): `API/main.py`

### Prediction and Risk

- [Prediction Pipeline](https://github.com/siddharth2024-bot/shield/blob/master/Pipeline/predicttrace.py): `Pipeline/predicttrace.py`
- [District Prediction](https://github.com/siddharth2024-bot/shield/blob/master/Pipeline/predicttrace.py): `Pipeline/predicttrace.py`
- [ATM Risk Scoring](https://github.com/siddharth2024-bot/shield/blob/master/Pipeline/atm_scorer.py): `Pipeline/atm_scorer.py`
- [Rule-Based Explainer](https://github.com/siddharth2024-bot/shield/blob/master/Pipeline/explainer.py): `Pipeline/explainer.py`

### Data and Model

- [Case Data Generator](https://github.com/siddharth2024-bot/shield/blob/master/Data/generate_fraud_cases.py): `Data/generate_fraud_cases.py`
- [ATM Data Generator](https://github.com/siddharth2024-bot/shield/blob/master/Data/generate_atm_database.py): `Data/generate_atm_database.py`
- [Fraud Cases](https://github.com/siddharth2024-bot/shield/blob/master/Data/fraud_cases.csv): `Data/fraud_cases.csv`
- [ATM Master Data](https://github.com/siddharth2024-bot/shield/blob/master/Data/atm_master.csv): `Data/atm_master.csv`
- [ATM Activity](https://github.com/siddharth2024-bot/shield/blob/master/Data/atm_activity.csv): `Data/atm_activity.csv`
- [Model Training](https://github.com/siddharth2024-bot/shield/blob/master/Model/train_model.py): `Model/train_model.py`
- [Model and Encoders](https://github.com/siddharth2024-bot/shield/tree/master/Model): `Model`

### Other components

- **Analyst**

## Connections

- Analyst → Dashboard: uses
- Dashboard → SHIELD API: calls API
- Analyst → SHIELD API: submits transaction (evidence: `API/main.py`)
- SHIELD API → Prediction Pipeline: runs prediction (evidence: `API/main.py`)
- Prediction Pipeline → District Prediction: predicts districts (evidence: `Pipeline/predicttrace.py`)
- Prediction Pipeline → ATM Risk Scoring: ranks ATMs (evidence: `Pipeline/predicttrace.py`)
- Case Data Generator → Fraud Cases: writes cases (evidence: `Data/generate_fraud_cases.py`)
- ATM Data Generator → ATM Master Data: writes master (evidence: `Data/generate_atm_database.py`)
- ATM Data Generator → ATM Activity: writes activity (evidence: `Data/generate_atm_database.py`)
- Model Training → Fraud Cases: reads cases (evidence: `Model/train_model.py`)
- Model Training → Model and Encoders: saves model (evidence: `Model/train_model.py`)
- District Prediction → Model and Encoders: loads model (evidence: `Pipeline/predicttrace.py`)
- ATM Risk Scoring → ATM Master Data: reads ATM data (evidence: `Pipeline/atm_scorer.py`)
- ATM Risk Scoring → ATM Activity: reads history (evidence: `Pipeline/atm_scorer.py`)
