# rohit-coder-py/shipsense-shipping-delay-prediction-pytorch architecture

> Architecture diagram of the GitHub repository rohit-coder-py/shipsense-shipping-delay-prediction-pytorch, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rohit-coder-py/shipsense-shipping-delay-prediction-pytorch
- Repository: https://github.com/rohit-coder-py/shipsense-shipping-delay-prediction-pytorch

## Overview

ShipSense is a Streamlit application for estimating late-delivery risk from shipment attributes. Users enter one shipment or upload a CSV; the app prepares features, runs a trained PyTorch model, and presents probabilities and risk labels. Separate app capabilities provide dataset insights and model information. The source excerpts establish the model-loading and batch-scoring path; the README documents the broader single-input workflow. Some UI and training-data details are documented but not shown in sampled implementation code.

Main entry points: [`app.py`](https://github.com/rohit-coder-py/shipsense-shipping-delay-prediction-pytorch/blob/main/app.py) (Streamlit app), [`src/preprocessing.py`](https://github.com/rohit-coder-py/shipsense-shipping-delay-prediction-pytorch/blob/main/src/preprocessing.py) (Feature preprocessing), [`src/inference.py`](https://github.com/rohit-coder-py/shipsense-shipping-delay-prediction-pytorch/blob/main/src/inference.py) (Inference), [`src/utils.py`](https://github.com/rohit-coder-py/shipsense-shipping-delay-prediction-pytorch/blob/main/src/utils.py) (Risk presentation helpers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_application["Streamlit application"]
  node_app["Streamlit app<br/>[app.py]"]
  node_single["Single prediction<br/>[app.py]"]
  node_batch["CSV prediction<br/>[app.py]"]
  node_insights_ui["Insights &amp; EDA<br/>[app.py]"]
  node_model_info["Model info<br/>[app.py]"]
end

subgraph group_prediction["Prediction pipeline"]
  node_preprocessing["Feature preprocessing<br/>[preprocessing.py]"]
  node_inference["Inference<br/>[inference.py]"]
  node_network["Neural network<br/>[model.py]"]
end

subgraph group_assets["Data and model assets"]
  node_shipment_data["Cleaned shipment data"]
  node_model_artifacts["Trained model and transforms"]
  node_eda_charts["EDA charts"]
end

subgraph group_insights["Insights and guidance"]
  node_risk["Risk presentation helpers<br/>[utils.py]"]
end

node_user(("Shipment user"))

node_user -->|"uses"| node_app
node_app -->|"offers"| node_single
node_app -->|"offers"| node_batch
node_app -->|"offers"| node_insights_ui
node_app -->|"offers"| node_model_info
node_single -->|"prepares features"| node_preprocessing
node_batch -->|"encodes and scales"| node_preprocessing
node_batch -->|"scores rows"| node_inference
node_inference -->|"runs forward pass"| node_network
node_inference -->|"loads feature settings"| node_preprocessing
node_preprocessing -->|"loads transforms"| node_model_artifacts
node_inference -->|"loads weights"| node_model_artifacts
node_single -->|"labels result"| node_risk
node_batch -->|"labels scores"| node_risk
node_insights_ui -->|"loads summary helpers"| node_risk
node_risk -->|"reads dataset"| node_shipment_data
node_insights_ui -->|"displays charts"| node_eda_charts
node_model_info -->|"shows model settings"| node_preprocessing

click node_app "https://github.com/rohit-coder-py/shipsense-shipping-delay-prediction-pytorch/blob/main/app.py"
click node_single "https://github.com/rohit-coder-py/shipsense-shipping-delay-prediction-pytorch/blob/main/app.py"
click node_batch "https://github.com/rohit-coder-py/shipsense-shipping-delay-prediction-pytorch/blob/main/app.py"
click node_insights_ui "https://github.com/rohit-coder-py/shipsense-shipping-delay-prediction-pytorch/blob/main/app.py"
click node_model_info "https://github.com/rohit-coder-py/shipsense-shipping-delay-prediction-pytorch/blob/main/app.py"
click node_preprocessing "https://github.com/rohit-coder-py/shipsense-shipping-delay-prediction-pytorch/blob/main/src/preprocessing.py"
click node_inference "https://github.com/rohit-coder-py/shipsense-shipping-delay-prediction-pytorch/blob/main/src/inference.py"
click node_network "https://github.com/rohit-coder-py/shipsense-shipping-delay-prediction-pytorch/blob/main/src/model.py"
click node_risk "https://github.com/rohit-coder-py/shipsense-shipping-delay-prediction-pytorch/blob/main/src/utils.py"
click node_shipment_data "https://github.com/rohit-coder-py/shipsense-shipping-delay-prediction-pytorch/blob/main/data/shipment_dataset_cleaned.csv"
click node_model_artifacts "https://github.com/rohit-coder-py/shipsense-shipping-delay-prediction-pytorch/tree/main/models"
click node_eda_charts "https://github.com/rohit-coder-py/shipsense-shipping-delay-prediction-pytorch/tree/main/graphs"

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_single,node_batch,node_insights_ui,node_model_info,node_user toneBlue
class node_preprocessing,node_inference,node_network toneAmber
class node_shipment_data,node_model_artifacts,node_eda_charts toneMint
class node_risk toneRose
```

## Components

### Streamlit application

- [Streamlit app](https://github.com/rohit-coder-py/shipsense-shipping-delay-prediction-pytorch/blob/main/app.py): `app.py`
- [Single prediction](https://github.com/rohit-coder-py/shipsense-shipping-delay-prediction-pytorch/blob/main/app.py): `app.py`
- [CSV prediction](https://github.com/rohit-coder-py/shipsense-shipping-delay-prediction-pytorch/blob/main/app.py): `app.py`
- [Insights & EDA](https://github.com/rohit-coder-py/shipsense-shipping-delay-prediction-pytorch/blob/main/app.py): `app.py`
- [Model info](https://github.com/rohit-coder-py/shipsense-shipping-delay-prediction-pytorch/blob/main/app.py): `app.py`

### Prediction pipeline

- [Feature preprocessing](https://github.com/rohit-coder-py/shipsense-shipping-delay-prediction-pytorch/blob/main/src/preprocessing.py): `src/preprocessing.py`
- [Inference](https://github.com/rohit-coder-py/shipsense-shipping-delay-prediction-pytorch/blob/main/src/inference.py): `src/inference.py`
- [Neural network](https://github.com/rohit-coder-py/shipsense-shipping-delay-prediction-pytorch/blob/main/src/model.py): `src/model.py`

### Data and model assets

- [Cleaned shipment data](https://github.com/rohit-coder-py/shipsense-shipping-delay-prediction-pytorch/blob/main/data/shipment_dataset_cleaned.csv): `data/shipment_dataset_cleaned.csv`
- [Trained model and transforms](https://github.com/rohit-coder-py/shipsense-shipping-delay-prediction-pytorch/tree/main/models): `models`
- [EDA charts](https://github.com/rohit-coder-py/shipsense-shipping-delay-prediction-pytorch/tree/main/graphs): `graphs`

### Insights and guidance

- [Risk presentation helpers](https://github.com/rohit-coder-py/shipsense-shipping-delay-prediction-pytorch/blob/main/src/utils.py): `src/utils.py`

### Other components

- **Shipment user**

## Connections

- Shipment user → Streamlit app: uses (evidence: `README.md`)
- Streamlit app → Single prediction: offers (evidence: `README.md`)
- Streamlit app → CSV prediction: offers (evidence: `README.md`)
- Streamlit app → Insights & EDA: offers (evidence: `README.md`)
- Streamlit app → Model info: offers (evidence: `README.md`)
- Single prediction → Feature preprocessing: prepares features (evidence: `README.md`)
- CSV prediction → Feature preprocessing: encodes and scales (evidence: `app.py`)
- CSV prediction → Inference: scores rows (evidence: `app.py`)
- Inference → Neural network: runs forward pass (evidence: `src/inference.py`)
- Inference → Feature preprocessing: loads feature settings (evidence: `src/inference.py`)
- Feature preprocessing → Trained model and transforms: loads transforms (evidence: `src/preprocessing.py`)
- Inference → Trained model and transforms: loads weights (evidence: `src/inference.py`)
- Single prediction → Risk presentation helpers: labels result (evidence: `app.py`)
- CSV prediction → Risk presentation helpers: labels scores (evidence: `app.py`)
- Insights & EDA → Risk presentation helpers: loads summary helpers (evidence: `app.py`)
- Risk presentation helpers → Cleaned shipment data: reads dataset (evidence: `src/utils.py`)
- Insights & EDA → EDA charts: displays charts (evidence: `app.py`)
- Model info → Feature preprocessing: shows model settings (evidence: `app.py`)
