How wissalkabous/credit_approval_system works
Credit Approval System serves applicant credit decisions through a FastAPI API and embedded web form, returning an approval decision, confidence, and risk band. The documented flow validates requests, preprocesses features, predicts, formats results, and logs prediction events in the background. Training is a separate product stage that prepares data, fits and evaluates the classifier, and persists model artifacts. Source excerpts show the core ML and dependency-injection relationships; some API and training wiring is documented in the README rather than shown in full.
Main entry points: predictor.py Prediction orchestration · container.py Dependency container · main.py FastAPI routes · model.py Credit classifier
Components 19
Applicant access
- Web form
api/main.py - FastAPI routes
api/main.py - Request schemas
api/schemas.py
Prediction service
- Feature preprocessing
src/data_loader.py - Prediction orchestration
src/predictor.py - Credit classifier
src/model.py - Decision and risk
src/predictor.py - Prediction logging
src/logger.py
Model training
- Training entry point
train.py - Applicant dataset
data/raw/credit_data.csv - Model metadata
models/credit_model_info.json
Shared infrastructure
- Model persistence
src/repository.py - Dependency container
src/container.py - Layer contracts
src/interfaces.py - Logging implementations
src/logger.py - Timing and validation
src/decorators.py - Functional utilities
src/functional.py
Other components
- Applicant
- API client
Connections 28
- Applicant → Web form: enters details
README.md - Web form → FastAPI routes: submits request
README.md - API client → FastAPI routes: posts prediction
README.md - FastAPI routes → Request schemas: validates request
api/main.py - FastAPI routes → Prediction orchestration: requests prediction
- Prediction orchestration → Feature preprocessing: scales features
src/predictor.py - Prediction orchestration → Credit classifier: requests prediction
src/predictor.py - Prediction orchestration → Decision and risk: formats decision
src/predictor.py - FastAPI routes → Decision and risk: returns response
README.md - FastAPI routes → Prediction logging: logs asynchronously
README.md - Training entry point → Dependency container: creates services
train.py - Training entry point → Applicant dataset: loads data
README.md - Training entry point → Feature preprocessing: prepares features
README.md - Training entry point → Credit classifier: trains and evaluates
README.md - Credit classifier → Model persistence: saves model
src/model.py - Model persistence → Model metadata: persists metadata
src/repository.py - Dependency container → Feature preprocessing: creates processor
src/container.py - Dependency container → Credit classifier: creates model
src/container.py - Dependency container → Prediction orchestration: creates predictor
src/container.py - Dependency container → Model persistence: registers repository
src/container.py - Dependency container → Logging implementations: registers logger
src/container.py - Feature preprocessing → Timing and validation: uses decorators
src/data_loader.py - Credit classifier → Timing and validation: uses decorators
src/model.py - Prediction orchestration → Timing and validation: uses decorators
src/predictor.py - Feature preprocessing → Layer contracts: implements contract
src/data_loader.py - Credit classifier → Layer contracts: implements contract
src/model.py - Prediction orchestration → Layer contracts: implements contract
src/predictor.py - Model persistence → Layer contracts: implements contract
src/repository.py