# twarita11/ayurvedic-etongue-ml architecture

> Architecture diagram of the GitHub repository twarita11/ayurvedic-etongue-ml, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-09-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/twarita11/ayurvedic-etongue-ml
- Repository: https://github.com/twarita11/ayurvedic-etongue-ml

## Overview

##### Project type and purpose
- This is a specialized full-stack ML pipeline for analyzing NIR sensor data from Ayurvedic medicines.
- Purpose: preprocess raw sensor CSVs, engineer features, train/serve an ensemble of ML models (RF, SVM, NN), and expose REST endpoints for dilution, medicine classification, and effectiveness estimation. There is also a visualization layer (notebooks and real-time plots).

##### File structure
- Top level:
- `data/` – stores raw & processed CSV data
- `models/` – serialized model artifacts (pickles, .joblib)
- `notebooks/` – data exploration & analysis in Jupyter
- `src/` – production code organized by concern
– `data/` – loading & preprocessing logic
– `features/` – temperature compensation & feature engineering
– `models/` – ensemble training & inference code
– `visualization/` – plotting utilities for dashboards
– `api/` – FastAPI app exposing prediction endpoints
- Config/build files: `requirements.txt`, `README.md`, `INSTALL.md`
- Tests directory (implied, though not in file_tree): `tests/`

##### Extract architecture insights from README
- Core ML pipeline stages: reading → cleaning/validation → feature engineering → model training/inference
- Ensemble of three models
- REST API with three POST endpoints
- Notebook-driven exploratory analysis and plotting

##### Detail without overthinking
- How modules call one another (e.g., API → src/data → src/features → src/models).
- Where tests and notebooks fit in: tests validate each module; notebooks provide exploratory insights.
- Document any configuration or dependency flows if space permits.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Offline ML Pipeline"
        RawData["Raw Data (CSV)"]:::store
        Preprocessing["Preprocessing Service"]:::compute
        FeatureEng["Feature Engineering Module"]:::compute
        ModelTrain["Model Training & Inference (Ensemble)"]:::compute
        ModelStore["Model Artifacts"]:::store
        DocsGuide["Data Collection Guide"]:::doc
        Config["requirements.txt"]:::doc
        Readme["README.md"]:::doc
        Install["INSTALL.md"]:::doc
    end

    subgraph "Online Prediction Service"
        Client["External Client"]:::external
        API["FastAPI API Layer"]:::api
        RealPre["Real-time Preprocessing"]:::compute
        RealFeature["Real-time Feature Engineering"]:::compute
        Inference["Inference via Ensemble"]:::compute
    end

    subgraph "Visualization & Exploratory"
        Notebook["Notebook Interface"]:::notebook
        Plots["Visualization & Plotting Utilities"]:::compute
    end

    %% Offline pipeline flow
    RawData -->|reads| Preprocessing
    Preprocessing -->|processes| FeatureEng
    FeatureEng -->|trains/inferences| ModelTrain
    ModelTrain -->|saves artifacts| ModelStore

    %% Online service flow
    Client -->|requests| API
    API -->|preprocess| RealPre
    RealPre -->|feature engineering| RealFeature
    RealFeature -->|infer| Inference
    Inference -->|response| API
    Inference -->|loads/saves| ModelStore

    %% Visualization & exploratory
    Notebook -->|loads data| RawData
    Notebook -->|loads models| ModelStore
    Plots -->|queries| API

    %% Click Events
    click Preprocessing "https://github.com/twarita11/ayurvedic-etongue-ml/blob/main/src/data/preprocessing.py"
    click FeatureEng "https://github.com/twarita11/ayurvedic-etongue-ml/blob/main/src/features/engineering.py"
    click ModelTrain "https://github.com/twarita11/ayurvedic-etongue-ml/blob/main/src/models/ensemble.py"
    click API "https://github.com/twarita11/ayurvedic-etongue-ml/blob/main/src/api/endpoints.py"
    click Plots "https://github.com/twarita11/ayurvedic-etongue-ml/blob/main/src/visualization/plots.py"
    click Notebook "https://github.com/twarita11/ayurvedic-etongue-ml/blob/main/notebooks/ayurvedic_analysis.ipynb"
    click DocsGuide "https://github.com/twarita11/ayurvedic-etongue-ml/blob/main/docs/data_collection_guide.md"
    click Config "https://github.com/twarita11/ayurvedic-etongue-ml/blob/main/requirements.txt"
    click Readme "https://github.com/twarita11/ayurvedic-etongue-ml/blob/main/README.md"
    click Install "https://github.com/twarita11/ayurvedic-etongue-ml/blob/main/INSTALL.md"

    %% Styles
    classDef store fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef compute fill:#90EE90,stroke:#000,stroke-width:1px
    classDef api fill:#98FB98,stroke:#000,stroke-width:1px
    classDef external fill:#FFA500,stroke:#000,stroke-width:1px
    classDef doc fill:#D3D3D3,stroke:#000,stroke-width:1px
    classDef notebook fill:#DDA0DD,stroke:#000,stroke-width:1px
```
