# cjdearaujo/auto-mpg architecture

> Architecture diagram of the GitHub repository cjdearaujo/auto-mpg, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/cjdearaujo/auto-mpg
- Repository: https://github.com/cjdearaujo/auto-mpg

## Overview

This repository is an automated Auto MPG regression pipeline: a push triggers data validation, model training and baseline comparison, then application checks and conditional publication of a downloadable model package. The runtime code also provides a prediction interface for saved models. The source excerpts show data loading, training, and prediction behavior; workflow orchestration and packaging links below are based on the README, since the workflow file was not excerpted.

Main entry points: [`.github/workflows/ml-pipeline.yml`](https://github.com/cjdearaujo/auto-mpg/blob/main/.github/workflows/ml-pipeline.yml) (ML workflow), [`src/train.py`](https://github.com/cjdearaujo/auto-mpg/blob/main/src/train.py) (Train/validation split), [`src/data.py`](https://github.com/cjdearaujo/auto-mpg/blob/main/src/data.py) (Load and validate), [`src/predict.py`](https://github.com/cjdearaujo/auto-mpg/blob/main/src/predict.py) (Prediction interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["CI workflow"]
  node_workflow["ML workflow<br/>[ml-pipeline.yml]"]
  node_package["Model package<br/>[ml-pipeline.yml]"]
  node_artifact["Actions artifact<br/>[ml-pipeline.yml]"]
end

subgraph group_data["Data validation"]
  node_csv["Auto MPG data<br/>[mpg.csv]"]
  node_loader["Load and validate<br/>[data.py]"]
end

subgraph group_model["Training and evaluation"]
  node_split["Train/validation split<br/>[train.py]"]
  node_baseline["Mean baseline<br/>[train.py]"]
  node_candidate["Random forest pipeline<br/>[train.py]"]
  node_gate["MAE quality gate<br/>[train.py]"]
  node_metrics["Metrics report<br/>[train.py]"]
end

subgraph group_serving["Prediction"]
  node_model_file["Saved model<br/>[train.py]"]
  node_predict["Prediction interface<br/>[predict.py]"]
end

node_push(("Push to main"))

node_push -->|"triggers"| node_workflow
node_workflow -->|"runs validation"| node_loader
node_csv -->|"loads"| node_loader
node_workflow -->|"runs training"| node_split
node_split -->|"loads validated data"| node_loader
node_split -->|"splits data for"| node_baseline
node_split -->|"splits data for"| node_candidate
node_baseline -->|"reports MAE to"| node_gate
node_candidate -->|"reports MAE to"| node_gate
node_candidate -->|"saves"| node_model_file
node_gate -->|"writes report"| node_metrics
node_workflow -->|"packages script"| node_predict
node_predict -->|"loads for prediction"| node_model_file
node_workflow -->|"builds after checks"| node_package
node_package -->|"includes"| node_model_file
node_package -->|"includes"| node_metrics
node_workflow -->|"publishes on success"| node_artifact

click node_workflow "https://github.com/cjdearaujo/auto-mpg/blob/main/.github/workflows/ml-pipeline.yml"
click node_csv "https://github.com/cjdearaujo/auto-mpg/blob/main/data/mpg.csv"
click node_loader "https://github.com/cjdearaujo/auto-mpg/blob/main/src/data.py"
click node_split "https://github.com/cjdearaujo/auto-mpg/blob/main/src/train.py"
click node_baseline "https://github.com/cjdearaujo/auto-mpg/blob/main/src/train.py"
click node_candidate "https://github.com/cjdearaujo/auto-mpg/blob/main/src/train.py"
click node_gate "https://github.com/cjdearaujo/auto-mpg/blob/main/src/train.py"
click node_model_file "https://github.com/cjdearaujo/auto-mpg/blob/main/src/train.py"
click node_metrics "https://github.com/cjdearaujo/auto-mpg/blob/main/src/train.py"
click node_predict "https://github.com/cjdearaujo/auto-mpg/blob/main/src/predict.py"
click node_package "https://github.com/cjdearaujo/auto-mpg/blob/main/.github/workflows/ml-pipeline.yml"
click node_artifact "https://github.com/cjdearaujo/auto-mpg/blob/main/.github/workflows/ml-pipeline.yml"

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_workflow,node_package,node_artifact toneBlue
class node_csv,node_loader toneAmber
class node_split,node_baseline,node_candidate,node_gate,node_metrics toneMint
class node_model_file,node_predict toneRose
class node_push toneIndigo
```

## Components

### CI workflow

- [ML workflow](https://github.com/cjdearaujo/auto-mpg/blob/main/.github/workflows/ml-pipeline.yml): `.github/workflows/ml-pipeline.yml`
- [Model package](https://github.com/cjdearaujo/auto-mpg/blob/main/.github/workflows/ml-pipeline.yml): `.github/workflows/ml-pipeline.yml`
- [Actions artifact](https://github.com/cjdearaujo/auto-mpg/blob/main/.github/workflows/ml-pipeline.yml): `.github/workflows/ml-pipeline.yml`

### Data validation

- [Auto MPG data](https://github.com/cjdearaujo/auto-mpg/blob/main/data/mpg.csv): `data/mpg.csv`
- [Load and validate](https://github.com/cjdearaujo/auto-mpg/blob/main/src/data.py): `src/data.py`

### Training and evaluation

- [Train/validation split](https://github.com/cjdearaujo/auto-mpg/blob/main/src/train.py): `src/train.py`
- [Mean baseline](https://github.com/cjdearaujo/auto-mpg/blob/main/src/train.py): `src/train.py`
- [Random forest pipeline](https://github.com/cjdearaujo/auto-mpg/blob/main/src/train.py): `src/train.py`
- [MAE quality gate](https://github.com/cjdearaujo/auto-mpg/blob/main/src/train.py): `src/train.py`
- [Metrics report](https://github.com/cjdearaujo/auto-mpg/blob/main/src/train.py): `src/train.py`

### Prediction

- [Saved model](https://github.com/cjdearaujo/auto-mpg/blob/main/src/train.py): `src/train.py`
- [Prediction interface](https://github.com/cjdearaujo/auto-mpg/blob/main/src/predict.py): `src/predict.py`

### Other components

- **Push to main**

## Connections

- Push to main → ML workflow: triggers (evidence: `README.md`)
- ML workflow → Load and validate: runs validation (evidence: `README.md`)
- Auto MPG data → Load and validate: loads (evidence: `src/data.py`)
- ML workflow → Train/validation split: runs training (evidence: `README.md`)
- Train/validation split → Load and validate: loads validated data (evidence: `src/train.py`)
- Train/validation split → Mean baseline: splits data for (evidence: `src/train.py`)
- Train/validation split → Random forest pipeline: splits data for (evidence: `src/train.py`)
- Mean baseline → MAE quality gate: reports MAE to (evidence: `src/train.py`)
- Random forest pipeline → MAE quality gate: reports MAE to (evidence: `src/train.py`)
- Random forest pipeline → Saved model: saves (evidence: `src/train.py`)
- MAE quality gate → Metrics report: writes report (evidence: `src/train.py`)
- ML workflow → Prediction interface: packages script (evidence: `README.md`)
- Prediction interface → Saved model: loads for prediction (evidence: `src/predict.py`)
- ML workflow → Model package: builds after checks (evidence: `README.md`)
- Model package → Saved model: includes (evidence: `README.md`)
- Model package → Metrics report: includes (evidence: `README.md`)
- ML workflow → Actions artifact: publishes on success (evidence: `README.md`)
