# rama-alsadeq/ecommerce-delay-prediction-mlops architecture

> Architecture diagram of the GitHub repository rama-alsadeq/ecommerce-delay-prediction-mlops, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rama-alsadeq/ecommerce-delay-prediction-mlops
- Repository: https://github.com/rama-alsadeq/ecommerce-delay-prediction-mlops

## Overview

This is an e-commerce delivery-delay ML project: it develops a primary late/on-time classifier and a separate delay-days regression task, with the classifier exposed through a FastAPI service. The production request path validates order features, applies saved feature rules and scaling, predicts with a registered model, and records monitoring data. The README describes broader data preparation, analysis, training, validation, and model-management capabilities; their detailed implementation is not shown in the sampled source, so those branches use documented relationships only.

Main entry points: [`app/main.py`](https://github.com/rama-alsadeq/ecommerce-delay-prediction-mlops/blob/main/app/main.py) (Prediction API), [`src/monitoring.py`](https://github.com/rama-alsadeq/ecommerce-delay-prediction-mlops/blob/main/src/monitoring.py) (Metrics and Drift), [`notebooks`](https://github.com/rama-alsadeq/ecommerce-delay-prediction-mlops/tree/main/notebooks) (Feature Engineering and Modeling), [`artifacts/production`](https://github.com/rama-alsadeq/ecommerce-delay-prediction-mlops/tree/main/artifacts/production) (Production Feature Artifacts)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_lifecycle["Data and Modeling"]
  node_tables[("Olist Tables")]
  node_join["Join Tables"]
  node_labels["Create Labels"]
  node_split["Dataset Split"]
  node_eda["Explore Data<br/>[4-EDA.ipynb]"]
  node_training["Feature Engineering and Modeling"]
end

subgraph group_quality["Data Quality"]
  node_qualitysuite["Feature Expectations"]
end

subgraph group_serving["Prediction Serving"]
  node_api["Prediction API<br/>[main.py]"]
  node_featurevalidation["Request Validation<br/>[validation.py]"]
  node_featureprep["Feature Preparation<br/>[features.py]"]
  node_scaling["Feature Scaling<br/>[preprocessing.py]"]
  node_predictor["Model Inference<br/>[predictor.py]"]
  node_featuredata["Feature Schema<br/>[data.py]"]
end

subgraph group_operations["Model Operations"]
  node_featureartifacts["Production Feature Artifacts"]
  node_registry[("MLflow Model Registry")]
end

subgraph group_observability["Monitoring"]
  node_monitor["Metrics and Drift<br/>[monitoring.py]"]
  node_predictionlog["Prediction Log<br/>[config.yaml]"]
  node_reference["Reference Distribution"]
end

node_apiuser(("API Client"))

node_apiuser -->|"submits requests"| node_api
node_api -->|"loads registered model"| node_registry
node_api -->|"validates features"| node_featurevalidation
node_featurevalidation -->|"checks feature schema"| node_featuredata
node_api -->|"prepares features"| node_featureprep
node_featureprep -->|"loads feature rules"| node_featureartifacts
node_api -->|"scales features"| node_scaling
node_scaling -->|"loads scaler"| node_featureartifacts
node_api -->|"runs inference"| node_predictor
node_api -->|"records requests and predictions"| node_monitor
node_api -->|"serves metrics"| node_monitor
node_monitor -->|"appends predictions"| node_predictionlog
node_monitor -->|"compares distribution"| node_reference
node_tables -->|"reads and aggregates"| node_join
node_join -->|"creates order-level data"| node_labels
node_labels -->|"splits labeled data"| node_split
node_split -->|"explores training data"| node_eda
node_eda -->|"guides feature and model work"| node_training
node_training -->|"saves preprocessing objects"| node_featureartifacts
node_training -.->|"tracks and registers models"| node_registry
node_qualitysuite -->|"checks final features"| node_featuredata

click node_join "https://github.com/rama-alsadeq/ecommerce-delay-prediction-mlops/blob/main/notebooks/1-Read%26join-tables.ipynb"
click node_labels "https://github.com/rama-alsadeq/ecommerce-delay-prediction-mlops/blob/main/notebooks/2-Create-the-lables.ipynb"
click node_split "https://github.com/rama-alsadeq/ecommerce-delay-prediction-mlops/blob/main/notebooks/3-Train-validation-test-split.ipynb"
click node_eda "https://github.com/rama-alsadeq/ecommerce-delay-prediction-mlops/blob/main/notebooks/4-EDA.ipynb"
click node_training "https://github.com/rama-alsadeq/ecommerce-delay-prediction-mlops/tree/main/notebooks"
click node_qualitysuite "https://github.com/rama-alsadeq/ecommerce-delay-prediction-mlops/blob/main/gx/define_expectations.py"
click node_api "https://github.com/rama-alsadeq/ecommerce-delay-prediction-mlops/blob/main/app/main.py"
click node_featurevalidation "https://github.com/rama-alsadeq/ecommerce-delay-prediction-mlops/blob/main/src/validation.py"
click node_featureprep "https://github.com/rama-alsadeq/ecommerce-delay-prediction-mlops/blob/main/src/features.py"
click node_scaling "https://github.com/rama-alsadeq/ecommerce-delay-prediction-mlops/blob/main/src/preprocessing.py"
click node_predictor "https://github.com/rama-alsadeq/ecommerce-delay-prediction-mlops/blob/main/src/predictor.py"
click node_featuredata "https://github.com/rama-alsadeq/ecommerce-delay-prediction-mlops/blob/main/src/data.py"
click node_featureartifacts "https://github.com/rama-alsadeq/ecommerce-delay-prediction-mlops/tree/main/artifacts/production"
click node_monitor "https://github.com/rama-alsadeq/ecommerce-delay-prediction-mlops/blob/main/src/monitoring.py"
click node_predictionlog "https://github.com/rama-alsadeq/ecommerce-delay-prediction-mlops/blob/main/config/config.yaml"
click node_reference "https://github.com/rama-alsadeq/ecommerce-delay-prediction-mlops/blob/main/artifacts/monitoring/reference_prediction_distribution.json"

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_tables,node_join,node_labels,node_split,node_eda,node_training,node_apiuser toneBlue
class node_qualitysuite toneAmber
class node_api,node_featurevalidation,node_featureprep,node_scaling,node_predictor,node_featuredata toneMint
class node_featureartifacts,node_registry toneRose
class node_monitor,node_predictionlog,node_reference toneIndigo
```

## Components

### Data and Modeling

- **Olist Tables**
- [Join Tables](https://github.com/rama-alsadeq/ecommerce-delay-prediction-mlops/blob/main/notebooks/1-Read%26join-tables.ipynb): `notebooks/1-Read&join-tables.ipynb`
- [Create Labels](https://github.com/rama-alsadeq/ecommerce-delay-prediction-mlops/blob/main/notebooks/2-Create-the-lables.ipynb): `notebooks/2-Create-the-lables.ipynb`
- [Dataset Split](https://github.com/rama-alsadeq/ecommerce-delay-prediction-mlops/blob/main/notebooks/3-Train-validation-test-split.ipynb): `notebooks/3-Train-validation-test-split.ipynb`
- [Explore Data](https://github.com/rama-alsadeq/ecommerce-delay-prediction-mlops/blob/main/notebooks/4-EDA.ipynb): `notebooks/4-EDA.ipynb`
- [Feature Engineering and Modeling](https://github.com/rama-alsadeq/ecommerce-delay-prediction-mlops/tree/main/notebooks): `notebooks`

### Data Quality

- [Feature Expectations](https://github.com/rama-alsadeq/ecommerce-delay-prediction-mlops/blob/main/gx/define_expectations.py): `gx/define_expectations.py`

### Prediction Serving

- [Prediction API](https://github.com/rama-alsadeq/ecommerce-delay-prediction-mlops/blob/main/app/main.py): `app/main.py`
- [Request Validation](https://github.com/rama-alsadeq/ecommerce-delay-prediction-mlops/blob/main/src/validation.py): `src/validation.py`
- [Feature Preparation](https://github.com/rama-alsadeq/ecommerce-delay-prediction-mlops/blob/main/src/features.py): `src/features.py`
- [Feature Scaling](https://github.com/rama-alsadeq/ecommerce-delay-prediction-mlops/blob/main/src/preprocessing.py): `src/preprocessing.py`
- [Model Inference](https://github.com/rama-alsadeq/ecommerce-delay-prediction-mlops/blob/main/src/predictor.py): `src/predictor.py`
- [Feature Schema](https://github.com/rama-alsadeq/ecommerce-delay-prediction-mlops/blob/main/src/data.py): `src/data.py`

### Model Operations

- [Production Feature Artifacts](https://github.com/rama-alsadeq/ecommerce-delay-prediction-mlops/tree/main/artifacts/production): `artifacts/production`
- **MLflow Model Registry**

### Monitoring

- [Metrics and Drift](https://github.com/rama-alsadeq/ecommerce-delay-prediction-mlops/blob/main/src/monitoring.py): `src/monitoring.py`
- [Prediction Log](https://github.com/rama-alsadeq/ecommerce-delay-prediction-mlops/blob/main/config/config.yaml): `config/config.yaml`
- [Reference Distribution](https://github.com/rama-alsadeq/ecommerce-delay-prediction-mlops/blob/main/artifacts/monitoring/reference_prediction_distribution.json): `artifacts/monitoring/reference_prediction_distribution.json`

### Other components

- **API Client**

## Connections

- API Client → Prediction API: submits requests (evidence: `app/main.py`)
- Prediction API → MLflow Model Registry: loads registered model (evidence: `app/main.py`)
- Prediction API → Request Validation: validates features (evidence: `app/main.py`)
- Request Validation → Feature Schema: checks feature schema (evidence: `src/validation.py`)
- Prediction API → Feature Preparation: prepares features (evidence: `app/main.py`)
- Feature Preparation → Production Feature Artifacts: loads feature rules (evidence: `src/features.py`)
- Prediction API → Feature Scaling: scales features (evidence: `app/main.py`)
- Feature Scaling → Production Feature Artifacts: loads scaler (evidence: `src/preprocessing.py`)
- Prediction API → Model Inference: runs inference (evidence: `app/main.py`)
- Prediction API → Metrics and Drift: records requests and predictions (evidence: `app/main.py`)
- Prediction API → Metrics and Drift: serves metrics (evidence: `app/main.py`)
- Metrics and Drift → Prediction Log: appends predictions (evidence: `src/monitoring.py`)
- Metrics and Drift → Reference Distribution: compares distribution
- Olist Tables → Join Tables: reads and aggregates (evidence: `README.md`)
- Join Tables → Create Labels: creates order-level data (evidence: `README.md`)
- Create Labels → Dataset Split: splits labeled data (evidence: `README.md`)
- Dataset Split → Explore Data: explores training data (evidence: `README.md`)
- Explore Data → Feature Engineering and Modeling: guides feature and model work (evidence: `README.md`)
- Feature Engineering and Modeling → Production Feature Artifacts: saves preprocessing objects (evidence: `README.md`)
- Feature Engineering and Modeling → MLflow Model Registry: tracks and registers models (evidence: `README.md`)
- Feature Expectations → Feature Schema: checks final features (evidence: `gx/define_expectations.py`)
