Description
Expose the trained anomaly detection models (DeepSVDD + InductiveGraphSAGE) through
a REST API so the web dashboard can display real fraud predictions.
Endpoints
POST /api/v1/fraud/score — Score one or more accounts
- Input:
{"accounts": ["GABC...", "GDEF..."], "edges": [...]}
- Output:
{"scores": {"GABC...": 0.85, "GDEF...": 0.12}}
GET /api/v1/fraud/alerts — Recent fraud alerts (paginated, filterable by risk level)
GET /api/v1/fraud/stats — Aggregated fraud statistics (total alerts, high/med/low, risk over time)
Implementation Details
- Load model checkpoints from the model registry on startup
- Implement a model caching layer to avoid reloading on every request
- Handle the case where models are not yet trained (return 503 or graceful message)
- Input validation via Pydantic schemas
Acceptance Criteria
/fraud/score returns scores in <500ms for batches up to 50 accounts
/fraud/alerts returns data matching FraudStats type in the frontend
- Model loading is cached and doesn't block the server startup if models are absent
- Graceful error handling for missing or corrupted model checkpoints
Dependencies
Labels
enhancement, api, ml, fraud-detection
Description
Expose the trained anomaly detection models (DeepSVDD + InductiveGraphSAGE) through
a REST API so the web dashboard can display real fraud predictions.
Endpoints
POST /api/v1/fraud/score— Score one or more accounts{"accounts": ["GABC...", "GDEF..."], "edges": [...]}{"scores": {"GABC...": 0.85, "GDEF...": 0.12}}GET /api/v1/fraud/alerts— Recent fraud alerts (paginated, filterable by risk level)GET /api/v1/fraud/stats— Aggregated fraud statistics (total alerts, high/med/low, risk over time)Implementation Details
Acceptance Criteria
/fraud/scorereturns scores in <500ms for batches up to 50 accounts/fraud/alertsreturns data matchingFraudStatstype in the frontendDependencies
astroml/pipeline/scoring.pyandastroml/models/deep_svdd.pyLabels
enhancement,api,ml,fraud-detection