# hassentchoketch/mena-labor-market-informality architecture

> Architecture diagram of the GitHub repository hassentchoketch/mena-labor-market-informality, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hassentchoketch/mena-labor-market-informality
- Repository: https://github.com/hassentchoketch/mena-labor-market-informality

## Overview

##### Project type and purpose
- This is a full-stack machine-learning classification application (“MENA-Labor-Market-Informality-ML-Classifier”) with:
- A training pipeline (data ingestion → transformation → model training)
- A prediction pipeline (loads preprocessor + model artifacts)
- A Flask (or similar) web/API layer exposing HTML templates and endpoints
- Artifact storage (model.pkl, preprocessor.pkl, CSVs)
- Logging

##### File structure
Top-level:
- app.py – web server entrypoint (Flask/FastAPI)
- src/ – core ML code
– components/ (data_ingestion.py, data_transformation.py, model_trainer.py)
– pipeline/ (train_pipeline.py, predict_pipeline.py)
– utils.py, logger.py, exception.py
- templates/ – home.html, index.html (UI/views)
- artifacts/ – saved data splits, trained model & preprocessor
- notebook/ – exploratory analysis
- logs/ – runtime logs
- requirements.txt, setup.py

##### README (minimal)
- Confirms purpose: ML classifier for informality in MENA labor market

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Data Layer"
        DataRaw(("Raw Data\nartifacts/data.csv")):::data
        DataTrain(("Train Split\nartifacts/train.csv")):::data
        DataTest(("Test Split\nartifacts/test.csv")):::data
        ModelPKL(("Model Artifact\nartifacts/model.pkl")):::data
        PreprocPKL(("Preprocessor Artifact\nartifacts/preprocessor.pkl")):::data
    end

    subgraph "ML Pipeline Layer"
        Ingest["Data Ingestion\nsrc/components/data_ingestion.py"]:::compute
        Transform["Data Transformation\nsrc/components/data_transformation.py"]:::compute
        Trainer["Model Trainer\nsrc/components/model_trainer.py"]:::compute
        TrainOrch["Training Pipeline\nsrc/pipeline/train_pipeline.py"]:::compute
        PredictOrch["Prediction Pipeline\nsrc/pipeline/predict_pipeline.py"]:::compute
        Utils["Utilities\nsrc/utils.py"]:::compute
        Exception["Exception Handling\nsrc/exception.py"]:::compute
    end

    subgraph "API Layer"
        API["Flask App\napp.py"]:::api
    end

    subgraph "Presentation Layer"
        UIHome["home.html\ntemplates/home.html"]:::ui
        UIIndex["index.html\ntemplates/index.html"]:::ui
    end

    subgraph "Logging Service"
        Logger["Logger Service\nsrc/logger.py"]:::logs
        LogFiles["Log Files\nlogs/"]:::logs
    end

    DataRaw -->|"read by"| Ingest
    Ingest -->|"outputs"| DataTrain
    Ingest -->|"outputs"| DataTest
    DataTrain -->|"transformed by"| Transform
    Transform -->|"features to"| Trainer
    Trainer -->|"produces"| ModelPKL
    Trainer -->|"produces"| PreprocPKL

    TrainOrch -->|"orchestrates"| Ingest
    TrainOrch -->|"orchestrates"| Transform
    TrainOrch -->|"orchestrates"| Trainer

    PredictOrch -->|"loads"| PreprocPKL
    PredictOrch -->|"loads"| ModelPKL

    API -->|"calls"| PredictOrch
    API -->|"serves"| UIHome
    API -->|"serves"| UIIndex
    PredictOrch -->|"returns"| API

    Ingest -.->|"logs"| Logger
    Transform -.->|"logs"| Logger
    Trainer -.->|"logs"| Logger
    API -.->|"logs"| Logger
    PredictOrch -.->|"logs"| Logger

    Logger -->|"writes to"| LogFiles

    Exception -->|"handles errors"| Ingest
    Exception -->|"handles errors"| Transform
    Exception -->|"handles errors"| Trainer
    Exception -->|"handles errors"| TrainOrch
    Exception -->|"handles errors"| PredictOrch
    Exception -->|"handles errors"| API

    classDef data fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef compute fill:#90EE90,stroke:#333,stroke-width:1px
    classDef api fill:#FFA500,stroke:#333,stroke-width:1px
    classDef ui fill:#FFFFE0,stroke:#333,stroke-width:1px
    classDef logs fill:#D3D3D3,stroke:#333,stroke-width:1px

    click DataRaw "https://github.com/hassentchoketch/mena-labor-market-informality/blob/main/artifacts/data.csv"
    click DataTrain "https://github.com/hassentchoketch/mena-labor-market-informality/blob/main/artifacts/train.csv"
    click DataTest "https://github.com/hassentchoketch/mena-labor-market-informality/blob/main/artifacts/test.csv"
    click ModelPKL "https://github.com/hassentchoketch/mena-labor-market-informality/blob/main/artifacts/model.pkl"
    click PreprocPKL "https://github.com/hassentchoketch/mena-labor-market-informality/blob/main/artifacts/preprocessor.pkl"
    click Ingest "https://github.com/hassentchoketch/mena-labor-market-informality/blob/main/src/components/data_ingestion.py"
    click Transform "https://github.com/hassentchoketch/mena-labor-market-informality/blob/main/src/components/data_transformation.py"
    click Trainer "https://github.com/hassentchoketch/mena-labor-market-informality/blob/main/src/components/model_trainer.py"
    click TrainOrch "https://github.com/hassentchoketch/mena-labor-market-informality/blob/main/src/pipeline/train_pipeline.py"
    click PredictOrch "https://github.com/hassentchoketch/mena-labor-market-informality/blob/main/src/pipeline/predict_pipeline.py"
    click API "https://github.com/hassentchoketch/mena-labor-market-informality/blob/main/app.py"
    click UIHome "https://github.com/hassentchoketch/mena-labor-market-informality/blob/main/templates/home.html"
    click UIIndex "https://github.com/hassentchoketch/mena-labor-market-informality/blob/main/templates/index.html"
    click Logger "https://github.com/hassentchoketch/mena-labor-market-informality/blob/main/src/logger.py"
    click LogFiles "https://github.com/hassentchoketch/mena-labor-market-informality/tree/main/logs/"
    click Exception "https://github.com/hassentchoketch/mena-labor-market-informality/blob/main/src/exception.py"
    click Utils "https://github.com/hassentchoketch/mena-labor-market-informality/blob/main/src/utils.py"
```
