# ambarish-224/end-to-end-insurance-premium-prediction architecture

> Architecture diagram of the GitHub repository ambarish-224/end-to-end-insurance-premium-prediction, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ambarish-224/end-to-end-insurance-premium-prediction
- Repository: https://github.com/ambarish-224/end-to-end-insurance-premium-prediction

## Overview

##### Project type and purpose
- This is an end-to-end Machine Learning application for Insurance Premium Prediction. It consists of:
- A modular ML training pipeline (data ingestion → validation → transformation → training → evaluation → model pusher)
- A file-based artifact and model registry
- A lightweight inference web UI (Streamlit)
- Containerization (Docker) and CI/CD (GitHub Actions) for automated training and deployment

##### File structure
- Top-level:
- Dataset/insurance.csv – raw data source
- Insurance/ – Python package for all pipeline components, config, entities, exceptions, logger, utils
– Insurance/components – data_ingestion.py, data_validation.py, data_transformation.py, model_trainer.py, model_evaluation.py, model_pusher.py
– Insurance/pipeline – training_pipeline.py and batch_prediction.py orchestrators
– Insurance/config.py, entity/, exception/, logger/, utils.py, predictor.py
- artifact/ – timestamped folders holding intermediate files (feature_store, datasets, transformed arrays, reports, pickled models)
- saved_models/ – model registry for deployment (model.pkl, transformer.pkl, target_encoder.pkl)
- streamlit_app.py, main.py, demo.py – entrypoints for serving and testing
- configs/config.yaml – pipeline configuration
- Dockerfile, .github/workflows/main.yaml – container and CI/CD setup

##### README for additional insights
- Confirms a six-stage ML pipeline
- Mentions technologies: Python 3.7, Docker, Streamlit, CI/CD

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Storage"
        RawData["Raw CSV\nDataset/insurance.csv"]:::storage
        ArtifactStore["Artifact Store\nartifact/"]:::storage
        ModelRegistry["Deployed Model Registry\nsaved_models/"]:::storage
    end

    subgraph "ML Training Pipeline"
        ingestion["Data Ingestion"]:::pipeline
        validation["Data Validation"]:::pipeline
        transformation["Data Transformation"]:::pipeline
        training["Model Training"]:::pipeline
        evaluation["Model Evaluation"]:::pipeline
        pusher["Model Pusher"]:::pipeline
    end

    subgraph "Orchestrators"
        TrainingOrch["Training Pipeline\nOrchestrator"]:::pipeline
        BatchPredOrch["Batch Prediction\nOrchestrator"]:::pipeline
    end

    subgraph "Inference Layer"
        Predictor["Inference Predictor\nInsurance/predictor.py"]:::pipeline
        Streamlit["Streamlit UI\nstreamlit_app.py"]:::entry
        CLI["CLI/API Entrypoints\nmain.py\ndemo.py"]:::entry
    end

    subgraph "Config & Logging"
        ConfigDefs["configs/config.yaml\nInsurance/config.py"]:::cross
        Entities["artifact_entity.py\nconfig_entity.py"]:::cross
        ExceptionHandling["Insurance/exception.py\nInsurance/exception/"]:::cross
        Logging["Insurance/logger/"]:::cross
        Utils["Insurance/utils.py"]:::cross
    end

    subgraph "DevOps"
        Docker["Dockerfile"]:::devops
        CI["GitHub Actions\n.github/workflows/main.yaml"]:::devops
    end

    RawData --> ingestion
    ingestion --> ArtifactStore
    ArtifactStore --> validation
    validation --> ArtifactStore
    ArtifactStore --> transformation
    transformation --> ArtifactStore
    ArtifactStore --> training
    training --> ArtifactStore
    ArtifactStore --> evaluation
    evaluation -->|"if pass"| pusher
    pusher --> ModelRegistry

    ModelRegistry --> Predictor
    Predictor --> Streamlit
    Predictor --> CLI

    TrainingOrch --> ingestion
    TrainingOrch --> validation
    TrainingOrch --> transformation
    TrainingOrch --> training
    TrainingOrch --> evaluation
    TrainingOrch --> pusher

    BatchPredOrch --> ArtifactStore
    BatchPredOrch --> Predictor

    ConfigDefs --> ingestion
    ConfigDefs --> Predictor
    Entities --> ingestion
    Logging --> ingestion
    Utils --> ingestion

    CI --> Docker
    CI --> TrainingOrch
    CI --> Streamlit
    Docker --> Streamlit

    classDef pipeline fill:#ADD8E6,stroke:#333
    classDef storage fill:#90EE90,stroke:#333
    classDef entry fill:#FFA500,stroke:#333
    classDef devops fill:#D3D3C,stroke:#333
    classDef cross fill:#D8BFD8,stroke:#333

    click RawData "https://github.com/ambarish-224/end-to-end-insurance-premium-prediction/blob/main/Dataset/insurance.csv"
    click ArtifactStore "https://github.com/ambarish-224/end-to-end-insurance-premium-prediction/tree/main/artifact/"
    click ModelRegistry "https://github.com/ambarish-224/end-to-end-insurance-premium-prediction/tree/main/saved_models/"
    click ingestion "https://github.com/ambarish-224/end-to-end-insurance-premium-prediction/blob/main/Insurance/components/data_ingestion.py"
    click validation "https://github.com/ambarish-224/end-to-end-insurance-premium-prediction/blob/main/Insurance/components/data_validation.py"
    click transformation "https://github.com/ambarish-224/end-to-end-insurance-premium-prediction/blob/main/Insurance/components/data_transformation.py"
    click training "https://github.com/ambarish-224/end-to-end-insurance-premium-prediction/blob/main/Insurance/components/model_trainer.py"
    click evaluation "https://github.com/ambarish-224/end-to-end-insurance-premium-prediction/blob/main/Insurance/components/model_evaluation.py"
    click pusher "https://github.com/ambarish-224/end-to-end-insurance-premium-prediction/blob/main/Insurance/components/model_pusher.py"
    click TrainingOrch "https://github.com/ambarish-224/end-to-end-insurance-premium-prediction/blob/main/Insurance/pipeline/training_pipeline.py"
    click BatchPredOrch "https://github.com/ambarish-224/end-to-end-insurance-premium-prediction/blob/main/Insurance/pipeline/batch_prediction.py"
    click ConfigDefs "https://github.com/ambarish-224/end-to-end-insurance-premium-prediction/blob/main/configs/config.yaml"
    click ExceptionHandling "https://github.com/ambarish-224/end-to-end-insurance-premium-prediction/blob/main/Insurance/exception.py"
    click Logging "https://github.com/ambarish-224/end-to-end-insurance-premium-prediction/tree/main/Insurance/logger/"
    click Utils "https://github.com/ambarish-224/end-to-end-insurance-premium-prediction/blob/main/Insurance/utils.py"
    click Predictor "https://github.com/ambarish-224/end-to-end-insurance-premium-prediction/blob/main/Insurance/predictor.py"
    click Streamlit "https://github.com/ambarish-224/end-to-end-insurance-premium-prediction/blob/main/streamlit_app.py"
    click CLI "https://github.com/ambarish-224/end-to-end-insurance-premium-prediction/blob/main/main.py"
    click Docker "https://github.com/ambarish-224/end-to-end-insurance-premium-prediction/tree/main/Dockerfile"
    click CI "https://github.com/ambarish-224/end-to-end-insurance-premium-prediction/blob/main/.github/workflows/main.yaml"
```
