How krishnaofficl/fraud-risk-scoring-api works
FraudScope is an asynchronous API and browser portal for authenticated vehicle-loan risk evaluation. The main workflow validates an applicant, runs the loaded ML pipeline, classifies the probability, and persists a user-scoped audit record; users can query or soft-delete history and inspect model metadata. Separate branches cover account authentication, health probes, and request observability. The README documents these capabilities; unsampled route and health implementations are represented at their tree paths, with relationships included only where the README or excerpts establish them.
Main entry points: main.py FastAPI application · scoring.py Scoring and audit routes · auth.py Authentication routes · session.py Async database sessions
Components 20
API and portal
- FastAPI application
app/main.py - Web portal assets
app/static/app.js
Identity
- Authentication routes
app/routers/auth.py - Auth payload schemas
app/schemas/auth.py - Password and JWT security
app/core/security.py - User profile routes
app/routers/users.py
Risk evaluation
- Scoring and audit routes
app/routers/scoring.py - Applicant and result schemas
app/schemas/scoring.py - Loaded ML pipeline
app/main.py - Serialized model artifact
artifacts/model_pipeline.joblib
Persistence and operations
- User records
app/models/user.py - Scoring audit records
app/models/scoring.py - Model version records
app/models/model_version.py - Health probes
app/routers/health.py - Async database sessions
app/db/session.py - Request logging and correlation
app/core/logging.py - Error handling
app/core/error_handlers.py - Runtime settings
app/core/config.py - PostgreSQL
Other components
- Browser or API client
Connections 28
- Browser or API client → FastAPI application: sends requests
README.md - FastAPI application → Web portal assets: serves assets
app/main.py - FastAPI application → Authentication routes: mounts routes
app/main.py - FastAPI application → User profile routes: mounts routes
app/main.py - FastAPI application → Scoring and audit routes: mounts routes
app/main.py - FastAPI application → Health probes: mounts routes
app/main.py - Authentication routes → Auth payload schemas: validates payloads
app/routers/auth.py - Authentication routes → Password and JWT security: hashes and issues tokens
app/routers/auth.py - Authentication routes → User records: reads and creates
app/routers/auth.py - User profile routes → Password and JWT security: authenticates user
app/routers/users.py - Password and JWT security → User records: loads user
app/core/security.py - Authentication routes → Async database sessions: gets session
app/routers/auth.py - Scoring and audit routes → Applicant and result schemas: validates and shapes
app/routers/scoring.py - Scoring and audit routes → Password and JWT security: requires user
app/routers/scoring.py - Scoring and audit routes → Loaded ML pipeline: runs inference
app/routers/scoring.py - FastAPI application → Loaded ML pipeline: loads at startup
app/main.py - FastAPI application → Serialized model artifact: loads artifact
app/main.py - Scoring and audit routes → Scoring audit records: writes and queries
app/routers/scoring.py - Scoring and audit routes → Model version records: queries version
app/routers/scoring.py - FastAPI application → Model version records: seeds version
app/main.py - Scoring and audit routes → Async database sessions: gets session
app/routers/scoring.py - Health probes → Async database sessions: checks database
README.md - Health probes → Loaded ML pipeline: checks loaded model
README.md - Async database sessions → PostgreSQL: connects
app/db/session.py - FastAPI application → Request logging and correlation: configures middleware
app/main.py - FastAPI application → Error handling: registers handlers
app/main.py - FastAPI application → Async database sessions: uses startup session
app/main.py - FastAPI application → Runtime settings: reads settings
app/main.py