# fauziiifau/qc_ai_service architecture

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

- Interactive diagram: https://gitdiagram.com/fauziiifau/qc_ai_service
- Repository: https://github.com/fauziiifau/qc_ai_service

## Overview

This is a small FastAPI defect-recommendation service. A client submits a process and defect type; the endpoint validates them, builds the model input, and returns the model’s recommendation. The source shows the model artifact being loaded at startup and invoked for prediction; its internal structure is not visible, and the README is empty.

Main entry points: [`main.py`](https://github.com/fauziiifau/qc_ai_service/blob/main/main.py) (Prediction endpoint), [`model_defect_v2.pkl`](https://github.com/fauziiifau/qc_ai_service/blob/main/model_defect_v2.pkl) (Trained model)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_client(("API client"))
node_api["Prediction endpoint<br/>[main.py]"]
node_validation["Input validation<br/>[main.py]"]
node_frame["Input dataframe<br/>[main.py]"]
node_pipeline["Model pipeline<br/>[main.py]"]
node_artifact["Trained model"]
node_result["Recommendation response<br/>[main.py]"]

node_client -->|"submits request"| node_api
node_api -->|"validates input"| node_validation
node_api -->|"builds input"| node_frame
node_api -->|"predicts"| node_pipeline
node_api -->|"returns recommendation"| node_result
node_pipeline -->|"loads at startup"| node_artifact

click node_api "https://github.com/fauziiifau/qc_ai_service/blob/main/main.py"
click node_validation "https://github.com/fauziiifau/qc_ai_service/blob/main/main.py"
click node_frame "https://github.com/fauziiifau/qc_ai_service/blob/main/main.py"
click node_pipeline "https://github.com/fauziiifau/qc_ai_service/blob/main/main.py"
click node_artifact "https://github.com/fauziiifau/qc_ai_service/blob/main/model_defect_v2.pkl"
click node_result "https://github.com/fauziiifau/qc_ai_service/blob/main/main.py"

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_client toneBlue
class node_api,node_validation,node_frame,node_result toneTeal
class node_pipeline,node_artifact toneIndigo
```

## Components

### Other components

- **API client**
- [Prediction endpoint](https://github.com/fauziiifau/qc_ai_service/blob/main/main.py): `main.py`
- [Input validation](https://github.com/fauziiifau/qc_ai_service/blob/main/main.py): `main.py`
- [Input dataframe](https://github.com/fauziiifau/qc_ai_service/blob/main/main.py): `main.py`
- [Model pipeline](https://github.com/fauziiifau/qc_ai_service/blob/main/main.py): `main.py`
- [Trained model](https://github.com/fauziiifau/qc_ai_service/blob/main/model_defect_v2.pkl): `model_defect_v2.pkl`
- [Recommendation response](https://github.com/fauziiifau/qc_ai_service/blob/main/main.py): `main.py`

## Connections

- API client → Prediction endpoint: submits request
- Prediction endpoint → Input validation: validates input
- Prediction endpoint → Input dataframe: builds input
- Prediction endpoint → Model pipeline: predicts
- Prediction endpoint → Recommendation response: returns recommendation
- Model pipeline → Trained model: loads at startup
