# lefevrk/oc-confirmez-vos-competences-en-mlops architecture

> Architecture diagram of the GitHub repository lefevrk/oc-confirmez-vos-competences-en-mlops, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lefevrk/oc-confirmez-vos-competences-en-mlops
- Repository: https://github.com/lefevrk/oc-confirmez-vos-competences-en-mlops

## Overview

This repository deploys a credit-scoring service, rather than training the model: a client or the Gradio demo submits a 50-feature application, the API validates it, runs the loaded champion model, records the outcome, and returns a score and decision. Separate operational capabilities expose health and metrics, and provide generated drift reports. The graph follows shown application wiring and scoring calls; some startup adapter wiring and monitoring-service connections are documented but their runtime configuration was not sampled.

Main entry points: [`src/api/app.py`](https://github.com/lefevrk/oc-confirmez-vos-competences-en-mlops/blob/main/src/api/app.py) (FastAPI application), [`src/api/modules/scoring/services/predict.py`](https://github.com/lefevrk/oc-confirmez-vos-competences-en-mlops/blob/main/src/api/modules/scoring/services/predict.py) (Scoring use case), [`src/api/modules/scoring/presentation/router.py`](https://github.com/lefevrk/oc-confirmez-vos-competences-en-mlops/blob/main/src/api/modules/scoring/presentation/router.py) (Prediction endpoint), [`src/ui/blocks.py`](https://github.com/lefevrk/oc-confirmez-vos-competences-en-mlops/blob/main/src/ui/blocks.py) (Gradio demo)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and scoring"]
  node_app["FastAPI application<br/>[app.py]"]
  node_config["Runtime settings<br/>[config.py]"]
  node_validation["Request schemas<br/>[schemas.py]"]
  node_scoring_router["Prediction endpoint<br/>[router.py]"]
  node_usecase["Scoring use case<br/>[predict.py]"]
  node_entities["Scoring entities<br/>[entities.py]"]
  node_model_port["Model contract<br/>[model.py]"]
  node_recorder_port["Recorder contract"]
  node_error_handling["Error handling<br/>[error_handling.py]"]
end

subgraph group_adapters["Model and persistence"]
  node_mlflow["Champion model adapter<br/>[mlflow_model.py]"]
  node_postgres["Prediction recorder<br/>[tracking.py]"]
  node_prediction_store[("PostgreSQL store<br/>[models.py]")]
end

subgraph group_operations["Operations and drift"]
  node_health["Health endpoints<br/>[router.py]"]
  node_monitoring_router["Drift report endpoint<br/>[router.py]"]
  node_metrics["Prometheus metrics<br/>[metrics.py]"]
  node_logging["Structured logging<br/>[logging.py]"]
  node_middleware["HTTP observability<br/>[middleware.py]"]
  node_drift_analysis["Drift analysis<br/>[drift_analysis.py]"]
  node_drift_report["Drift report generation"]
  node_profiling["Inference profiling<br/>[bottleneck.py]"]
end

subgraph group_demo["Interactive demo"]
  node_demo["Gradio demo<br/>[blocks.py]"]
end

node_client(("Scoring client"))
node_prometheus["Prometheus and Grafana"]
node_mlflow_service[("MLflow registry")]

node_client -->|"submits requests"| node_app
node_app -->|"registers routes"| node_health
node_app -->|"registers routes"| node_scoring_router
node_app -->|"registers routes"| node_monitoring_router
node_app -->|"installs middleware"| node_middleware
node_app -->|"registers handlers"| node_error_handling
node_app -->|"mounts demo"| node_demo
node_scoring_router -->|"validates payload"| node_validation
node_scoring_router -->|"calls scoring"| node_usecase
node_scoring_router -->|"records scoring metrics"| node_metrics
node_usecase -->|"calls model"| node_model_port
node_usecase -->|"records outcomes"| node_recorder_port
node_usecase -->|"creates events"| node_entities
node_demo -->|"builds form fields"| node_validation
node_demo -->|"posts predictions"| node_app
node_postgres -->|"writes events"| node_prediction_store
node_drift_report -->|"runs analysis"| node_drift_analysis
node_monitoring_router -->|"serves generated report"| node_drift_report
node_metrics -.->|"exposes metrics"| node_prometheus
node_mlflow -->|"loads champion"| node_mlflow_service
node_app -->|"loads settings"| node_config
node_profiling -->|"profiles inference"| node_usecase

click node_app "https://github.com/lefevrk/oc-confirmez-vos-competences-en-mlops/blob/main/src/api/app.py"
click node_config "https://github.com/lefevrk/oc-confirmez-vos-competences-en-mlops/blob/main/src/api/common/config.py"
click node_validation "https://github.com/lefevrk/oc-confirmez-vos-competences-en-mlops/blob/main/src/api/modules/scoring/presentation/schemas.py"
click node_scoring_router "https://github.com/lefevrk/oc-confirmez-vos-competences-en-mlops/blob/main/src/api/modules/scoring/presentation/router.py"
click node_usecase "https://github.com/lefevrk/oc-confirmez-vos-competences-en-mlops/blob/main/src/api/modules/scoring/services/predict.py"
click node_entities "https://github.com/lefevrk/oc-confirmez-vos-competences-en-mlops/blob/main/src/api/modules/scoring/domain/entities.py"
click node_model_port "https://github.com/lefevrk/oc-confirmez-vos-competences-en-mlops/blob/main/src/api/modules/scoring/ports/model.py"
click node_recorder_port "https://github.com/lefevrk/oc-confirmez-vos-competences-en-mlops/blob/main/src/api/modules/scoring/ports/prediction_recorder.py"
click node_error_handling "https://github.com/lefevrk/oc-confirmez-vos-competences-en-mlops/blob/main/src/api/common/error_handling.py"
click node_health "https://github.com/lefevrk/oc-confirmez-vos-competences-en-mlops/blob/main/src/api/modules/health/router.py"
click node_monitoring_router "https://github.com/lefevrk/oc-confirmez-vos-competences-en-mlops/blob/main/src/api/modules/monitoring/router.py"
click node_metrics "https://github.com/lefevrk/oc-confirmez-vos-competences-en-mlops/blob/main/src/api/infra/observability/metrics.py"
click node_logging "https://github.com/lefevrk/oc-confirmez-vos-competences-en-mlops/blob/main/src/api/infra/observability/logging.py"
click node_middleware "https://github.com/lefevrk/oc-confirmez-vos-competences-en-mlops/blob/main/src/api/infra/observability/middleware.py"
click node_drift_analysis "https://github.com/lefevrk/oc-confirmez-vos-competences-en-mlops/blob/main/scripts/drift_analysis.py"
click node_drift_report "https://github.com/lefevrk/oc-confirmez-vos-competences-en-mlops/blob/main/scripts/generate_drift_report.py"
click node_profiling "https://github.com/lefevrk/oc-confirmez-vos-competences-en-mlops/blob/main/scripts/profiling/bottleneck.py"
click node_mlflow "https://github.com/lefevrk/oc-confirmez-vos-competences-en-mlops/blob/main/src/api/infra/mlflow_model.py"
click node_postgres "https://github.com/lefevrk/oc-confirmez-vos-competences-en-mlops/blob/main/src/api/infra/postgres/tracking.py"
click node_prediction_store "https://github.com/lefevrk/oc-confirmez-vos-competences-en-mlops/blob/main/src/api/infra/postgres/models.py"
click node_demo "https://github.com/lefevrk/oc-confirmez-vos-competences-en-mlops/blob/main/src/ui/blocks.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_app,node_config,node_validation,node_scoring_router,node_usecase,node_entities,node_model_port,node_recorder_port,node_error_handling,node_client toneBlue
class node_mlflow,node_postgres,node_prediction_store,node_mlflow_service toneAmber
class node_health,node_monitoring_router,node_metrics,node_logging,node_middleware,node_drift_analysis,node_drift_report,node_profiling toneMint
class node_demo toneRose
class node_prometheus toneIndigo
```

## Components

### API and scoring

- [FastAPI application](https://github.com/lefevrk/oc-confirmez-vos-competences-en-mlops/blob/main/src/api/app.py): `src/api/app.py`
- [Runtime settings](https://github.com/lefevrk/oc-confirmez-vos-competences-en-mlops/blob/main/src/api/common/config.py): `src/api/common/config.py`
- [Request schemas](https://github.com/lefevrk/oc-confirmez-vos-competences-en-mlops/blob/main/src/api/modules/scoring/presentation/schemas.py): `src/api/modules/scoring/presentation/schemas.py`
- [Prediction endpoint](https://github.com/lefevrk/oc-confirmez-vos-competences-en-mlops/blob/main/src/api/modules/scoring/presentation/router.py): `src/api/modules/scoring/presentation/router.py`
- [Scoring use case](https://github.com/lefevrk/oc-confirmez-vos-competences-en-mlops/blob/main/src/api/modules/scoring/services/predict.py): `src/api/modules/scoring/services/predict.py`
- [Scoring entities](https://github.com/lefevrk/oc-confirmez-vos-competences-en-mlops/blob/main/src/api/modules/scoring/domain/entities.py): `src/api/modules/scoring/domain/entities.py`
- [Model contract](https://github.com/lefevrk/oc-confirmez-vos-competences-en-mlops/blob/main/src/api/modules/scoring/ports/model.py): `src/api/modules/scoring/ports/model.py`
- [Recorder contract](https://github.com/lefevrk/oc-confirmez-vos-competences-en-mlops/blob/main/src/api/modules/scoring/ports/prediction_recorder.py): `src/api/modules/scoring/ports/prediction_recorder.py`
- [Error handling](https://github.com/lefevrk/oc-confirmez-vos-competences-en-mlops/blob/main/src/api/common/error_handling.py): `src/api/common/error_handling.py`

### Model and persistence

- [Champion model adapter](https://github.com/lefevrk/oc-confirmez-vos-competences-en-mlops/blob/main/src/api/infra/mlflow_model.py): `src/api/infra/mlflow_model.py`
- [Prediction recorder](https://github.com/lefevrk/oc-confirmez-vos-competences-en-mlops/blob/main/src/api/infra/postgres/tracking.py): `src/api/infra/postgres/tracking.py`
- [PostgreSQL store](https://github.com/lefevrk/oc-confirmez-vos-competences-en-mlops/blob/main/src/api/infra/postgres/models.py): `src/api/infra/postgres/models.py`

### Operations and drift

- [Health endpoints](https://github.com/lefevrk/oc-confirmez-vos-competences-en-mlops/blob/main/src/api/modules/health/router.py): `src/api/modules/health/router.py`
- [Drift report endpoint](https://github.com/lefevrk/oc-confirmez-vos-competences-en-mlops/blob/main/src/api/modules/monitoring/router.py): `src/api/modules/monitoring/router.py`
- [Prometheus metrics](https://github.com/lefevrk/oc-confirmez-vos-competences-en-mlops/blob/main/src/api/infra/observability/metrics.py): `src/api/infra/observability/metrics.py`
- [Structured logging](https://github.com/lefevrk/oc-confirmez-vos-competences-en-mlops/blob/main/src/api/infra/observability/logging.py): `src/api/infra/observability/logging.py`
- [HTTP observability](https://github.com/lefevrk/oc-confirmez-vos-competences-en-mlops/blob/main/src/api/infra/observability/middleware.py): `src/api/infra/observability/middleware.py`
- [Drift analysis](https://github.com/lefevrk/oc-confirmez-vos-competences-en-mlops/blob/main/scripts/drift_analysis.py): `scripts/drift_analysis.py`
- [Drift report generation](https://github.com/lefevrk/oc-confirmez-vos-competences-en-mlops/blob/main/scripts/generate_drift_report.py): `scripts/generate_drift_report.py`
- [Inference profiling](https://github.com/lefevrk/oc-confirmez-vos-competences-en-mlops/blob/main/scripts/profiling/bottleneck.py): `scripts/profiling/bottleneck.py`

### Interactive demo

- [Gradio demo](https://github.com/lefevrk/oc-confirmez-vos-competences-en-mlops/blob/main/src/ui/blocks.py): `src/ui/blocks.py`

### Other components

- **Scoring client**
- **Prometheus and Grafana**
- **MLflow registry**

## Connections

- Scoring client → FastAPI application: submits requests (evidence: `README.md`)
- FastAPI application → Health endpoints: registers routes (evidence: `src/api/app.py`)
- FastAPI application → Prediction endpoint: registers routes (evidence: `src/api/app.py`)
- FastAPI application → Drift report endpoint: registers routes (evidence: `src/api/app.py`)
- FastAPI application → HTTP observability: installs middleware (evidence: `src/api/app.py`)
- FastAPI application → Error handling: registers handlers (evidence: `src/api/app.py`)
- FastAPI application → Gradio demo: mounts demo (evidence: `src/api/app.py`)
- Prediction endpoint → Request schemas: validates payload (evidence: `src/api/modules/scoring/presentation/router.py`)
- Prediction endpoint → Scoring use case: calls scoring (evidence: `src/api/modules/scoring/presentation/router.py`)
- Prediction endpoint → Prometheus metrics: records scoring metrics (evidence: `src/api/modules/scoring/presentation/router.py`)
- Scoring use case → Model contract: calls model (evidence: `src/api/modules/scoring/services/predict.py`)
- Scoring use case → Recorder contract: records outcomes (evidence: `src/api/modules/scoring/services/predict.py`)
- Scoring use case → Scoring entities: creates events (evidence: `src/api/modules/scoring/services/predict.py`)
- Gradio demo → Request schemas: builds form fields (evidence: `src/ui/blocks.py`)
- Gradio demo → FastAPI application: posts predictions (evidence: `src/ui/blocks.py`)
- Prediction recorder → PostgreSQL store: writes events (evidence: `src/api/infra/postgres/tracking.py`)
- Drift report generation → Drift analysis: runs analysis (evidence: `scripts/generate_drift_report.py`)
- Drift report endpoint → Drift report generation: serves generated report (evidence: `src/api/modules/monitoring/router.py`)
- Prometheus metrics → Prometheus and Grafana: exposes metrics (evidence: `README.md`)
- Champion model adapter → MLflow registry: loads champion (evidence: `src/api/infra/mlflow_model.py`)
- FastAPI application → Runtime settings: loads settings (evidence: `src/api/app.py`)
- Inference profiling → Scoring use case: profiles inference (evidence: `scripts/profiling/profile_predict.py`)
