# aibootcamp13/mlops-cloud-project-mlops_6 architecture

> Architecture diagram of the GitHub repository aibootcamp13/mlops-cloud-project-mlops_6, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aibootcamp13/mlops-cloud-project-mlops_6
- Repository: https://github.com/aibootcamp13/mlops-cloud-project-mlops_6

## Overview

##### Project type and purpose
- This is an MLOps-driven, full-stack movie-rating prediction service.
- It implements an end-to-end workflow: data ingestion from TMDB, ETL/preprocessing, model training & storage, orchestration via Airflow, and real-time inference & UI via FastAPI.
- The README calls out: TMDB API data collection, MinIO for storage, Airflow for orchestration, FastAPI for serving, and Docker Compose for containerized deployment.

##### File structure
- Top level:
- airflow/dags/pipeline.py → defines Airflow DAGs (ETL and training jobs).
- src/
– dataset/ (house_pricing.py, movie_rating.py)
– preprocessing/ (tmdb_collector.py)
– model/ (movie_rating_predictor.py, house_price_predictor.py)
– inference/ (inference.py)
– utils/ (config, constants, generic helpers)
- fastapi_app/
– main.py, movie_rating*.py → REST endpoints + template rendering
– templates/index.html → UI gallery
– default.csv/.pkl → sample dataset & model for quick start
- docker-compose.yml + Dockerfile(.fastapi) → orchestrate containers
- .env → environment variables (MinIO credentials, TMDB key, etc.)

##### README for additional insights
- Describes technology stack: Python 3.10, TMDB API, MinIO (S3), Airflow 2.x, FastAPI, Docker Compose.
- Mentions MLOps goals: automated data refresh, model update & sharing via MinIO, end-to-end orchestration.

##### Elements
- Clear component labels (e.g., “Airflow Scheduler”, “Preprocessing Service”)
- Rectangles for services/containers
- Cloud symbols for external APIs
- Annotations for protocols or file paths (e.g., “s3://models/movie_rating.pkl”, “HTTP POST /predict”)

##### Detail
- Don’t just show “Backend” and “Frontend”—break down to Airflow DAG, ETL task, model trainer, artifact store, inference worker, API server, UI template.
- Configuration/secrets management (.env, src/utils/config.py).
- How Docker Compose wires all containers together and injects environment variables.
- Periodic scheduling in Airflow versus on-demand inference in FastAPI.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Docker Compose Network"
        direction TB

        subgraph "Batch/Offline Zone"
            direction TB
            TMDB["External Data Source\nTMDB API"]:::external
            Airflow["Airflow Scheduler & Workers"]:::compute
            ETL["Preprocessing Service\n(tmdb_collector.py)"]:::compute
            Dataset["Dataset Module\n(movie_rating.py\nhouse_pricing.py)"]:::compute
            Trainer["Model Training Module\n(movie_rating_predictor.py\nhouse_price_predictor.py)"]:::compute
            MinIO["Model Artifacts Storage\nMinIO S3 Bucket"]:::storage
        end

        subgraph "Online/Serving Zone"
            direction TB
            UI["User Browser"]:::external
            FastAPI["FastAPI Application"]:::compute
            Inference["Inference Module\n(inference.py)"]:::compute
            Template["UI Template\n(index.html)"]:::compute
            Sample["Sample Data & Model\n(default.csv, default.pkl)"]:::storage
        end

        Config["Config & Secrets\n(.env, src/utils/*)"]:::config

        TMDB -->|"trigger DAG"| Airflow
        Airflow -->|"run ETL task"| ETL
        ETL -->|"cleaned data"| Dataset
        Dataset -->|"train model"| Trainer
        Trainer -->|"save s3://models/movie_rating.pkl"| MinIO

        FastAPI -->|"pull model on startup"| MinIO
        UI -->|"HTTP GET /"| FastAPI
        FastAPI -->|"render UI"| Template
        FastAPI -->|"HTTP POST /predict"| Inference
        Sample -->|"fallback data/model"| FastAPI

        Config --> Airflow
        Config --> FastAPI

    end

    click TMDB "https://github.com/aibootcamp13/mlops-cloud-project-mlops_6/blob/main/src/preprocessing/tmdb_collector.py"
    click Airflow "https://github.com/aibootcamp13/mlops-cloud-project-mlops_6/blob/main/airflow/dags/pipeline.py"
    click ETL "https://github.com/aibootcamp13/mlops-cloud-project-mlops_6/blob/main/src/preprocessing/tmdb_collector.py"
    click Dataset "https://github.com/aibootcamp13/mlops-cloud-project-mlops_6/blob/main/src/dataset/movie_rating.py"
    click Dataset "https://github.com/aibootcamp13/mlops-cloud-project-mlops_6/blob/main/src/dataset/house_pricing.py"
    click Trainer "https://github.com/aibootcamp13/mlops-cloud-project-mlops_6/blob/main/src/model/movie_rating_predictor.py"
    click Trainer "https://github.com/aibootcamp13/mlops-cloud-project-mlops_6/blob/main/src/model/house_price_predictor.py"
    click MinIO "https://github.com/aibootcamp13/mlops-cloud-project-mlops_6/blob/main/docker-compose.yml"
    click FastAPI "https://github.com/aibootcamp13/mlops-cloud-project-mlops_6/blob/main/fastapi_app/main.py"
    click FastAPI "https://github.com/aibootcamp13/mlops-cloud-project-mlops_6/blob/main/fastapi_app/movie_rating.py"
    click FastAPI "https://github.com/aibootcamp13/mlops-cloud-project-mlops_6/blob/main/fastapi_app/movie_rating_predictor.py"
    click Template "https://github.com/aibootcamp13/mlops-cloud-project-mlops_6/blob/main/fastapi_app/templates/index.html"
    click Sample "https://github.com/aibootcamp13/mlops-cloud-project-mlops_6/blob/main/fastapi_app/default.csv"
    click Sample "https://github.com/aibootcamp13/mlops-cloud-project-mlops_6/blob/main/fastapi_app/default.pkl"
    click Config "https://github.com/aibootcamp13/mlops-cloud-project-mlops_6/blob/main/.env"

    classDef compute fill:#D6EAF8,stroke:#3498DB,color:#1B4F72
    classDef storage fill:#D5F5E3,stroke:#28B463,color:#1D8348
    classDef external fill:#FAD7A0,stroke:#EB984E,color:#7E5109
    classDef config fill:#F5B7B1,stroke:#CD6155,color:#78281F
```
