Logo Lanfrica

kmwangemi/afya-guard-backend

Domaine:

healthcare

Type de record:

software
Créateur:
kmw
Hôte:
Backend API for Afya Guard - Kenya's AI-powered healthcare fraud detection system for Social Health Authority (SHA). Detects phantom patients, upcoding, duplicate claims, and fraudulent providers using machine learning, saving billions in public healthcare funds. Built with FastAPI, PostgreSQL, Redis, scikit-learn, Celery and XGBoost. # Afya Guard — Backend API > Kenya's AI-powered healthcare fraud detection system for the Social Health Authority (SHA). Afya Guard protects public healthcare funds by detecting phantom patients, duplicate claims, upcoding, and fraudulent provider activity in real time — before payments are made. Built for scale, explainability, and compliance with Kenya's Data Protection Act. --- ## What It Does | Fraud Pattern | Detection Method | |---|---| | **Phantom patients** | Member validity checks, coverage verification, DOB anomalies | | **Duplicate claims** | 7-day rolling window deduplication across member + diagnosis + provider | | **Upcoding** | SHA tariff reference comparison, inpatient-only code detection | | **Provider anomalies** | Peer group benchmarking, statistical z-score deviation | | **Behavioural patterns** | Member frequency abuse, bulk submissions, weekend spikes | Every flagged claim includes a full SHAP-style explanation — so analysts understand *why* a claim was flagged, not just *that* it was. --- ## Tech Stack | Layer | Technology | |---|---| | API framework | FastAPI + Uvicorn | | Database | PostgreSQL (Neon serverless) | | ORM & migrations | SQLAlchemy 2.0 + Alembic | | ML engine | XGBoost + scikit-learn + SHAP | | Task queue | Celery + Redis | | Auth | JWT (python-jose) + bcrypt (passlib) | | Package manager | uv | --- ## Prerequisites Before you start, make sure you have: - Python **3.11+** - PostgreSQL running locally (or a Neon connection string) - Redis running locally (for Celery background tasks) - `uv` installed (see Step 1) --- ## Local Setup ### 1. Install uv `uv` is a fast Python package and virtual environment manager. If you don't have it: ```bash pip install uv ``` Verify the installation: ```bash uv --version ``` --- ### 2. Clone the repository and install dependencies ```bash git clone github.com cd afya-guard-backend uv sync ``` `uv sync` reads `pyproject.toml`, creates …

Languages

Licenses