# vkous/projet7-openclassrooms architecture

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

- Interactive diagram: https://gitdiagram.com/vkous/projet7-openclassrooms
- Repository: https://github.com/vkous/projet7-openclassrooms

## Overview

This repository implements a credit-default scoring product: a customer ID enters through a Flask API, which returns a prediction and probability; a Streamlit dashboard presents that result and adds explanations, customer comparisons, and what-if scoring. The prediction module also contains LIME-based explanation and feature-translation logic. Preprocessing is a separate, substantial data-preparation script, while the repository includes serialized model artifacts. The shown code does not establish how preprocessing produced those artifacts or which artifact matches its hard-coded model paths.

Main entry points: [`toolbox/predict.py`](https://github.com/vkous/projet7-openclassrooms/blob/master/toolbox/predict.py) (Prediction engine), [`dashboard.py`](https://github.com/vkous/projet7-openclassrooms/blob/master/dashboard.py) (Scoring dashboard), [`app.py`](https://github.com/vkous/projet7-openclassrooms/blob/master/app.py) (Scoring API), [`toolbox/preprocess.py`](https://github.com/vkous/projet7-openclassrooms/blob/master/toolbox/preprocess.py) (Feature preparation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User interfaces"]
  node_api["Scoring API<br/>[app.py]"]
  node_dashboard["Scoring dashboard<br/>[dashboard.py]"]
end

subgraph group_scoring["Scoring runtime"]
  node_prediction["Prediction engine<br/>[predict.py]"]
  node_model_files[("Serialized models")]
  node_stacked_model[("Stacked model artifact")]
  node_gradient_model[("Gradient model artifact")]
end

subgraph group_insight["Decision support"]
  node_explanation["LIME explanations<br/>[predict.py]"]
  node_neighbor["Similar-customer comparison<br/>[predict.py]"]
  node_feature_text["Feature translation<br/>[predict.py]"]
  node_whatif["What-if scoring<br/>[predict.py]"]
end

subgraph group_preparation["Data preparation"]
  node_preprocess["Feature preparation<br/>[preprocess.py]"]
  node_training_data[("Credit application data")]
end

node_manager(("Credit manager"))

node_manager -->|"enters client ID"| node_dashboard
node_dashboard -->|"requests score"| node_api
node_api -->|"calls prediction"| node_prediction
node_dashboard -->|"requests explanation"| node_explanation
node_dashboard -->|"recalculates score"| node_whatif
node_dashboard -->|"translates features"| node_feature_text
node_explanation -->|"compares neighbors"| node_neighbor
node_explanation -->|"uses prediction function"| node_prediction
node_whatif -->|"calls prediction"| node_prediction
node_preprocess -->|"reads and transforms"| node_training_data
node_prediction -.-> node_model_files
node_prediction -.-> node_stacked_model
node_prediction -.-> node_gradient_model

click node_api "https://github.com/vkous/projet7-openclassrooms/blob/master/app.py"
click node_dashboard "https://github.com/vkous/projet7-openclassrooms/blob/master/dashboard.py"
click node_prediction "https://github.com/vkous/projet7-openclassrooms/blob/master/toolbox/predict.py"
click node_model_files "https://github.com/vkous/projet7-openclassrooms/blob/master/models/RFC_Sample_Weights_Total.obj"
click node_stacked_model "https://github.com/vkous/projet7-openclassrooms/blob/master/models/Stacked_GradientBoosting_Sample_Weights_Total_export_natif.obj"
click node_gradient_model "https://github.com/vkous/projet7-openclassrooms/blob/master/models/GradientBoosting_Sample_Weights_Total_export_natif.obj"
click node_explanation "https://github.com/vkous/projet7-openclassrooms/blob/master/toolbox/predict.py"
click node_neighbor "https://github.com/vkous/projet7-openclassrooms/blob/master/toolbox/predict.py"
click node_feature_text "https://github.com/vkous/projet7-openclassrooms/blob/master/toolbox/predict.py"
click node_whatif "https://github.com/vkous/projet7-openclassrooms/blob/master/toolbox/predict.py"
click node_preprocess "https://github.com/vkous/projet7-openclassrooms/blob/master/toolbox/preprocess.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_api,node_dashboard toneBlue
class node_prediction,node_model_files,node_stacked_model,node_gradient_model toneAmber
class node_explanation,node_neighbor,node_feature_text,node_whatif toneMint
class node_preprocess,node_training_data toneRose
class node_manager toneIndigo
```

## Components

### User interfaces

- [Scoring API](https://github.com/vkous/projet7-openclassrooms/blob/master/app.py): `app.py`
- [Scoring dashboard](https://github.com/vkous/projet7-openclassrooms/blob/master/dashboard.py): `dashboard.py`

### Scoring runtime

- [Prediction engine](https://github.com/vkous/projet7-openclassrooms/blob/master/toolbox/predict.py): `toolbox/predict.py`
- [Serialized models](https://github.com/vkous/projet7-openclassrooms/blob/master/models/RFC_Sample_Weights_Total.obj): `models/RFC_Sample_Weights_Total.obj`
- [Stacked model artifact](https://github.com/vkous/projet7-openclassrooms/blob/master/models/Stacked_GradientBoosting_Sample_Weights_Total_export_natif.obj): `models/Stacked_GradientBoosting_Sample_Weights_Total_export_natif.obj`
- [Gradient model artifact](https://github.com/vkous/projet7-openclassrooms/blob/master/models/GradientBoosting_Sample_Weights_Total_export_natif.obj): `models/GradientBoosting_Sample_Weights_Total_export_natif.obj`

### Decision support

- [LIME explanations](https://github.com/vkous/projet7-openclassrooms/blob/master/toolbox/predict.py): `toolbox/predict.py`
- [Similar-customer comparison](https://github.com/vkous/projet7-openclassrooms/blob/master/toolbox/predict.py): `toolbox/predict.py`
- [Feature translation](https://github.com/vkous/projet7-openclassrooms/blob/master/toolbox/predict.py): `toolbox/predict.py`
- [What-if scoring](https://github.com/vkous/projet7-openclassrooms/blob/master/toolbox/predict.py): `toolbox/predict.py`

### Data preparation

- [Feature preparation](https://github.com/vkous/projet7-openclassrooms/blob/master/toolbox/preprocess.py): `toolbox/preprocess.py`
- **Credit application data**

### Other components

- **Credit manager**

## Connections

- Credit manager → Scoring dashboard: enters client ID (evidence: `dashboard.py`)
- Scoring dashboard → Scoring API: requests score (evidence: `dashboard.py`)
- Scoring API → Prediction engine: calls prediction (evidence: `app.py`)
- Scoring dashboard → LIME explanations: requests explanation (evidence: `dashboard.py`)
- Scoring dashboard → What-if scoring: recalculates score (evidence: `dashboard.py`)
- Scoring dashboard → Feature translation: translates features (evidence: `dashboard.py`)
- LIME explanations → Similar-customer comparison: compares neighbors (evidence: `toolbox/predict.py`)
- LIME explanations → Prediction engine: uses prediction function (evidence: `toolbox/predict.py`)
- What-if scoring → Prediction engine: calls prediction (evidence: `toolbox/predict.py`)
- Feature preparation → Credit application data: reads and transforms (evidence: `toolbox/preprocess.py`)
- Prediction engine → Serialized models
- Prediction engine → Stacked model artifact
- Prediction engine → Gradient model artifact
