# sanskritisonee/shipment-sure architecture

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

- Interactive diagram: https://gitdiagram.com/sanskritisonee/shipment-sure
- Repository: https://github.com/sanskritisonee/shipment-sure

## Overview

Shipment Sure is an end-to-end shipment-delay prediction project, from data preparation and model training to an interactive Streamlit application. Planners enter shipment details or upload a CSV; the app loads the trained model and feature schema, predicts delay risk, and can show SHAP explanations. The README documents the upstream cleaning, EDA, and training stages, but their notebook implementations were not sampled, so those links reflect documented workflow rather than inspected calls.

Main entry points: [`app.py`](https://github.com/sanskritisonee/shipment-sure/blob/main/app.py) (Shipment UI), [`shipment_delay_model.pkl`](https://github.com/sanskritisonee/shipment-sure/blob/main/shipment_delay_model.pkl) (Delay model), [`modeltraining.ipynb`](https://github.com/sanskritisonee/shipment-sure/blob/main/modeltraining.ipynb) (Model training), [`datasets`](https://github.com/sanskritisonee/shipment-sure/tree/main/datasets) (Anomaly cleaning)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_preparation["Data preparation"]
  node_exploration["Data understanding"]
  node_cleaning["Anomaly cleaning"]
  node_eda["EDA and features<br/>[eda.ipynb]"]
end

subgraph group_training["Model training"]
  node_training_process["Model training"]
end

subgraph group_application["Prediction application"]
  node_ui["Shipment UI<br/>[app.py]"]
  node_input_features["Feature assembly<br/>[app.py]"]
  node_single_prediction["Single prediction<br/>[app.py]"]
  node_risk["Risk classification<br/>[app.py]"]
  node_explanation["SHAP explanation<br/>[app.py]"]
  node_batch_upload["CSV batch input<br/>[app.py]"]
  node_batch_prediction["Batch prediction<br/>[app.py]"]
  node_results["Prediction results<br/>[app.py]"]
end

subgraph group_artifacts["Model artifacts"]
  node_model["Delay model"]
  node_feature_schema["Feature schema<br/>[model_features.pkl]"]
end

node_planner(("Planner"))

node_planner -->|"enters shipment"| node_ui
node_planner -->|"uploads CSV"| node_batch_upload
node_ui -->|"collects details"| node_input_features
node_ui -->|"loads model"| node_model
node_ui -->|"loads schema"| node_feature_schema
node_input_features -->|"builds input"| node_single_prediction
node_single_prediction -->|"predicts with"| node_model
node_single_prediction -->|"classifies probability"| node_risk
node_single_prediction -.->|"explains with"| node_explanation
node_batch_upload -->|"validates CSV"| node_batch_prediction
node_batch_prediction -->|"predicts with"| node_model
node_batch_prediction -->|"adds predictions"| node_results
node_risk -->|"displays risk"| node_results
node_explanation -->|"displays impacts"| node_results
node_exploration -->|"informs cleaning"| node_cleaning
node_cleaning -->|"provides clean data"| node_eda
node_eda -->|"provides features"| node_training_process
node_training_process -->|"produces model"| node_model
node_training_process -->|"produces schema"| node_feature_schema

click node_exploration "https://github.com/sanskritisonee/shipment-sure/blob/main/dataexploration.ipynb"
click node_cleaning "https://github.com/sanskritisonee/shipment-sure/tree/main/datasets"
click node_eda "https://github.com/sanskritisonee/shipment-sure/blob/main/eda.ipynb"
click node_training_process "https://github.com/sanskritisonee/shipment-sure/blob/main/modeltraining.ipynb"
click node_model "https://github.com/sanskritisonee/shipment-sure/blob/main/shipment_delay_model.pkl"
click node_feature_schema "https://github.com/sanskritisonee/shipment-sure/blob/main/model_features.pkl"
click node_ui "https://github.com/sanskritisonee/shipment-sure/blob/main/app.py"
click node_input_features "https://github.com/sanskritisonee/shipment-sure/blob/main/app.py"
click node_single_prediction "https://github.com/sanskritisonee/shipment-sure/blob/main/app.py"
click node_risk "https://github.com/sanskritisonee/shipment-sure/blob/main/app.py"
click node_explanation "https://github.com/sanskritisonee/shipment-sure/blob/main/app.py"
click node_batch_upload "https://github.com/sanskritisonee/shipment-sure/blob/main/app.py"
click node_batch_prediction "https://github.com/sanskritisonee/shipment-sure/blob/main/app.py"
click node_results "https://github.com/sanskritisonee/shipment-sure/blob/main/app.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_exploration,node_cleaning,node_eda toneBlue
class node_training_process toneAmber
class node_ui,node_input_features,node_single_prediction,node_risk,node_explanation,node_batch_upload,node_batch_prediction,node_results toneMint
class node_model,node_feature_schema toneRose
class node_planner toneIndigo
```

## Components

### Data preparation

- [Data understanding](https://github.com/sanskritisonee/shipment-sure/blob/main/dataexploration.ipynb): `dataexploration.ipynb`
- [Anomaly cleaning](https://github.com/sanskritisonee/shipment-sure/tree/main/datasets): `datasets`
- [EDA and features](https://github.com/sanskritisonee/shipment-sure/blob/main/eda.ipynb): `eda.ipynb`

### Model training

- [Model training](https://github.com/sanskritisonee/shipment-sure/blob/main/modeltraining.ipynb): `modeltraining.ipynb`

### Prediction application

- [Shipment UI](https://github.com/sanskritisonee/shipment-sure/blob/main/app.py): `app.py`
- [Feature assembly](https://github.com/sanskritisonee/shipment-sure/blob/main/app.py): `app.py`
- [Single prediction](https://github.com/sanskritisonee/shipment-sure/blob/main/app.py): `app.py`
- [Risk classification](https://github.com/sanskritisonee/shipment-sure/blob/main/app.py): `app.py`
- [SHAP explanation](https://github.com/sanskritisonee/shipment-sure/blob/main/app.py): `app.py`
- [CSV batch input](https://github.com/sanskritisonee/shipment-sure/blob/main/app.py): `app.py`
- [Batch prediction](https://github.com/sanskritisonee/shipment-sure/blob/main/app.py): `app.py`
- [Prediction results](https://github.com/sanskritisonee/shipment-sure/blob/main/app.py): `app.py`

### Model artifacts

- [Delay model](https://github.com/sanskritisonee/shipment-sure/blob/main/shipment_delay_model.pkl): `shipment_delay_model.pkl`
- [Feature schema](https://github.com/sanskritisonee/shipment-sure/blob/main/model_features.pkl): `model_features.pkl`

### Other components

- **Planner**

## Connections

- Planner → Shipment UI: enters shipment (evidence: `README.md`)
- Planner → CSV batch input: uploads CSV (evidence: `README.md`)
- Shipment UI → Feature assembly: collects details (evidence: `app.py`)
- Shipment UI → Delay model: loads model (evidence: `app.py`)
- Shipment UI → Feature schema: loads schema (evidence: `app.py`)
- Feature assembly → Single prediction: builds input (evidence: `app.py`)
- Single prediction → Delay model: predicts with (evidence: `app.py`)
- Single prediction → Risk classification: classifies probability (evidence: `app.py`)
- Single prediction → SHAP explanation: explains with (evidence: `app.py`)
- CSV batch input → Batch prediction: validates CSV (evidence: `app.py`)
- Batch prediction → Delay model: predicts with (evidence: `app.py`)
- Batch prediction → Prediction results: adds predictions (evidence: `app.py`)
- Risk classification → Prediction results: displays risk (evidence: `app.py`)
- SHAP explanation → Prediction results: displays impacts (evidence: `app.py`)
- Data understanding → Anomaly cleaning: informs cleaning (evidence: `README.md`)
- Anomaly cleaning → EDA and features: provides clean data (evidence: `README.md`)
- EDA and features → Model training: provides features (evidence: `README.md`)
- Model training → Delay model: produces model (evidence: `README.md`)
- Model training → Feature schema: produces schema (evidence: `README.md`)
