# sevastyanovilya/credit_scoring architecture

> Architecture diagram of the GitHub repository sevastyanovilya/credit_scoring, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-11-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sevastyanovilya/credit_scoring
- Repository: https://github.com/sevastyanovilya/credit_scoring

## Overview

##### Project type and purpose
- This is a lightweight full-stack ML scoring service.
- Purpose: train a predictive model on historical data (train.py → model.pkl), serve real-time scoring via an HTTP API (service.py), and provide an interactive front-end using Streamlit (app.py).

##### File structure
- Top level:
- README.md – project overview and launch instructions
- requirements.txt – runtime dependencies (FastAPI/uvicorn, Streamlit, pandas, scikit-learn, etc.)
- train.py – data ingestion (data/scoring.csv) → model training → model.pkl
- service.py – FastAPI application exposing a `/score` endpoint, loads model.pkl
- app.py – Streamlit front-end that calls the service’s API
- data/scoring.csv – raw training data
- model.pkl – serialized trained model
- Patterns:
- Separation of concerns: data & training vs. scoring service vs. user interface
- Simple two-tier architecture (frontend ↔ backend) plus offline training component

##### README for additional insights
- The README confirms:
- How to install dependencies
- How to launch the API (`uvicorn service:app`)
- How to launch the UI (`streamlit run app.py`)

##### Elements
- Clear labels:
- Data Store, Training, API Service, Front-End UI, End User
- Rectangles for components (blue = data & training, green = service, orange = UI)

##### Putting it all together
- Layout recommendation:
- Use consistent iconography:

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Training Pipeline
    subgraph "Training Pipeline"
        direction TB
        DataCSV["data/scoring.csv"]:::storage
        Train["train.py"]:::training
        Model["model.pkl"]:::storage
        DataCSV -->|"train"| Train
        Train -->|"serialize"| Model
    end

    %% Runtime Scoring Service
    subgraph "Runtime Scoring Service"
        direction TB
        Service["service.py (FastAPI + uvicorn)"]:::service
        Model -->|"load model"| Service
    end

    %% Presentation Layer
    subgraph "Presentation Layer"
        direction TB
        UI["app.py (Streamlit)"]:::ui
    end

    %% External Actor
    User["End User"]:::external

    %% Interactions
    User -->|"uses UI"| UI
    UI -->|"POST /score"| Service
    Service -->|"JSON response"| UI
    User -->|"direct API call"| Service

    %% Click Events
    click DataCSV "https://github.com/sevastyanovilya/credit_scoring/blob/main/data/scoring.csv"
    click Train "https://github.com/sevastyanovilya/credit_scoring/blob/main/train.py"
    click Model "https://github.com/sevastyanovilya/credit_scoring/blob/main/model.pkl"
    click Service "https://github.com/sevastyanovilya/credit_scoring/blob/main/service.py"
    click UI "https://github.com/sevastyanovilya/credit_scoring/blob/main/app.py"

    %% Styles
    classDef storage fill:#E3F2FD,stroke:#90CAF9,stroke-width:2px;
    classDef training fill:#BBDEFB,stroke:#42A5F5,stroke-width:2px;
    classDef service fill:#C8E6C9,stroke:#66BB6A,stroke-width:2px;
    classDef ui fill:#FFE0B2,stroke:#FFB74D,stroke-width:2px;
    classDef external fill:#E0E0E0,stroke:#9E9E9E,stroke-width:2px;
```
