# astroduckmega/credit_card_approval_prediction architecture

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

- Interactive diagram: https://gitdiagram.com/astroduckmega/credit_card_approval_prediction
- Repository: https://github.com/astroduckmega/credit_card_approval_prediction

## Overview

Ledger is a credit-card approval estimator: applicants fill out a browser form, the Flask API transforms their profile and runs a trained classifier, then returns an approval label and probability for the UI to display. The product also exposes model metrics and form options, and keeps recent submissions in process memory for review and reload. The documented synthetic-data and retraining workflow is included. Source excerpts show the API and model pipeline; README statements support the UI and dataset connections where source was not sampled.

Main entry points: [`app.py`](https://github.com/astroduckmega/credit_card_approval_prediction/blob/main/app.py) (Flask API), [`model/train_model.py`](https://github.com/astroduckmega/credit_card_approval_prediction/blob/main/model/train_model.py) (Model training and evaluation), [`static/js/script.js`](https://github.com/astroduckmega/credit_card_approval_prediction/blob/main/static/js/script.js) (Form and dashboard), [`data/credit_card_approval.csv`](https://github.com/astroduckmega/credit_card_approval_prediction/blob/main/data/credit_card_approval.csv) (Approval dataset)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Applicant experience"]
  node_webui["Application UI<br/>[index.html]"]
  node_browser["Form and dashboard<br/>[script.js]"]
end

subgraph group_serving["Prediction service"]
  node_flask["Flask API<br/>[app.py]"]
  node_history["Submission history<br/>[app.py]"]
end

subgraph group_ml["Model lifecycle"]
  node_feature_engineering["Feature engineering<br/>[train_model.py]"]
  node_classifier["Approval classifier"]
  node_form_metadata["Form metadata<br/>[feature_meta.json]"]
  node_evaluation["Model metrics<br/>[metrics.json]"]
  node_training["Model training and evaluation<br/>[train_model.py]"]
end

subgraph group_data["Training data"]
  node_generator["Synthetic data generator<br/>[generate_data.py]"]
  node_training_data["Approval dataset"]
end

node_applicant(("Applicant"))

node_applicant -->|"enters profile"| node_browser
node_webui -->|"renders"| node_browser
node_browser -->|"requests prediction"| node_flask
node_flask -->|"engineers features"| node_feature_engineering
node_flask -->|"loads and predicts"| node_classifier
node_flask -->|"reads options"| node_form_metadata
node_flask -->|"reads metrics"| node_evaluation
node_flask -->|"records submissions"| node_history
node_browser -->|"loads history"| node_flask
node_flask -->|"returns result"| node_browser
node_generator -->|"generates rows"| node_training_data
node_training_data -->|"trains from"| node_training
node_training -->|"engineers features"| node_feature_engineering
node_training -->|"exports pipeline"| node_classifier
node_training -->|"exports options"| node_form_metadata
node_training -->|"exports metrics"| node_evaluation

click node_webui "https://github.com/astroduckmega/credit_card_approval_prediction/blob/main/templates/index.html"
click node_browser "https://github.com/astroduckmega/credit_card_approval_prediction/blob/main/static/js/script.js"
click node_flask "https://github.com/astroduckmega/credit_card_approval_prediction/blob/main/app.py"
click node_feature_engineering "https://github.com/astroduckmega/credit_card_approval_prediction/blob/main/model/train_model.py"
click node_classifier "https://github.com/astroduckmega/credit_card_approval_prediction/blob/main/model/credit_model.joblib"
click node_form_metadata "https://github.com/astroduckmega/credit_card_approval_prediction/blob/main/model/feature_meta.json"
click node_evaluation "https://github.com/astroduckmega/credit_card_approval_prediction/blob/main/model/metrics.json"
click node_history "https://github.com/astroduckmega/credit_card_approval_prediction/blob/main/app.py"
click node_generator "https://github.com/astroduckmega/credit_card_approval_prediction/blob/main/data/generate_data.py"
click node_training_data "https://github.com/astroduckmega/credit_card_approval_prediction/blob/main/data/credit_card_approval.csv"
click node_training "https://github.com/astroduckmega/credit_card_approval_prediction/blob/main/model/train_model.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_webui,node_browser toneBlue
class node_flask,node_history toneAmber
class node_feature_engineering,node_classifier,node_form_metadata,node_evaluation,node_training toneMint
class node_generator,node_training_data toneRose
class node_applicant toneIndigo
```

## Components

### Applicant experience

- [Application UI](https://github.com/astroduckmega/credit_card_approval_prediction/blob/main/templates/index.html): `templates/index.html`
- [Form and dashboard](https://github.com/astroduckmega/credit_card_approval_prediction/blob/main/static/js/script.js): `static/js/script.js`

### Prediction service

- [Flask API](https://github.com/astroduckmega/credit_card_approval_prediction/blob/main/app.py): `app.py`
- [Submission history](https://github.com/astroduckmega/credit_card_approval_prediction/blob/main/app.py): `app.py`

### Model lifecycle

- [Feature engineering](https://github.com/astroduckmega/credit_card_approval_prediction/blob/main/model/train_model.py): `model/train_model.py`
- [Approval classifier](https://github.com/astroduckmega/credit_card_approval_prediction/blob/main/model/credit_model.joblib): `model/credit_model.joblib`
- [Form metadata](https://github.com/astroduckmega/credit_card_approval_prediction/blob/main/model/feature_meta.json): `model/feature_meta.json`
- [Model metrics](https://github.com/astroduckmega/credit_card_approval_prediction/blob/main/model/metrics.json): `model/metrics.json`
- [Model training and evaluation](https://github.com/astroduckmega/credit_card_approval_prediction/blob/main/model/train_model.py): `model/train_model.py`

### Training data

- [Synthetic data generator](https://github.com/astroduckmega/credit_card_approval_prediction/blob/main/data/generate_data.py): `data/generate_data.py`
- [Approval dataset](https://github.com/astroduckmega/credit_card_approval_prediction/blob/main/data/credit_card_approval.csv): `data/credit_card_approval.csv`

### Other components

- **Applicant**

## Connections

- Applicant → Form and dashboard: enters profile (evidence: `README.md`)
- Application UI → Form and dashboard: renders (evidence: `README.md`)
- Form and dashboard → Flask API: requests prediction (evidence: `static/js/script.js`)
- Flask API → Feature engineering: engineers features (evidence: `app.py`)
- Flask API → Approval classifier: loads and predicts (evidence: `app.py`)
- Flask API → Form metadata: reads options (evidence: `app.py`)
- Flask API → Model metrics: reads metrics (evidence: `app.py`)
- Flask API → Submission history: records submissions (evidence: `app.py`)
- Form and dashboard → Flask API: loads history (evidence: `static/js/script.js`)
- Flask API → Form and dashboard: returns result (evidence: `README.md`)
- Synthetic data generator → Approval dataset: generates rows (evidence: `data/generate_data.py`)
- Approval dataset → Model training and evaluation: trains from (evidence: `README.md`)
- Model training and evaluation → Feature engineering: engineers features (evidence: `model/train_model.py`)
- Model training and evaluation → Approval classifier: exports pipeline (evidence: `model/train_model.py`)
- Model training and evaluation → Form metadata: exports options (evidence: `model/train_model.py`)
- Model training and evaluation → Model metrics: exports metrics (evidence: `model/train_model.py`)
