Skip to main content

A comprehensive ML framework for detecting financial fraud in healthcare claims

Project description

HealthFraudML — Open-Source Healthcare Fraud Detection Framework

HealthFraudML Banner

GitHub stars License: MIT Python 3.8+ Last Commit Open In Colab

Healthcare fraud costs the U.S. over $100 billion annually. HealthFraudML is a modular Python framework that brings machine learning to the front lines of fraud detection — from claims-level ML models to patient-facing billing audits with auto-generated dispute letters.


What Can It Do?

from healthfraudml import BillingAuditor

# Audit a patient bill for upcoding, unbundling, and price gouging
auditor = BillingAuditor(provider_name="Example Health System")
report = auditor.audit_bill([
    {"cpt_code": "99285", "amount": 6672.00, "description": "ED Visit Level 5"},
    {"cpt_code": "56420", "amount": 709.00, "description": "Bartholin Cyst I&D"},
])

print(f"Risk Level: {report['risk_level']}")           # "High"
print(f"Potential Savings: ${report['suggested_savings']:.2f}")  # "$5,472.00"
print(report['dispute_letter'])                         # Ready-to-send dispute letter

Try it nowOpen in Google Colab


Key Features

Module What It Does
FraudDetector Unified API for 8+ ML algorithms (supervised, unsupervised, hybrid ensemble)
BillingAuditor Rule-based CPT code auditing — detects upcoding, unbundling, overpricing
RAGBillAuditor RAG pipeline: ChromaDB vector store + Gemini LLM for intelligent auditing
LLMBillParser Extract billing data from PDFs and emails using Gemini or regex fallback
CPTDatabase Vector-indexed CPT reference database with semantic search
ReadinessAssessment Score (0–100) an organization's readiness to adopt ML-based fraud detection
Benchmarking Suite Compare models using F1, AUC-PR, MCC — metrics that matter for imbalanced healthcare data

Supported Fraud Types

Fraud Type Description Detection Approach
Upcoding Billing for more expensive services than provided Supervised classification
Phantom Billing Billing for services never rendered Anomaly detection
Duplicate Claims Submitting the same claim multiple times Rule-based + ML hybrid
Unbundling Separately billing bundled services Pattern analysis
Identity Theft Using stolen patient identities Behavioral profiling
Kickbacks Illegal referral arrangements Network analysis

Installation

pip install healthfraudml

Or install from source:

git clone https://github.com/bharath309/healthfraudml.git
cd healthfraudml
pip install -e .

Quick Start — Claims-Level Fraud Detection

from healthfraudml import FraudDetector
from healthfraudml.models import HybridEnsemble
from healthfraudml.preprocessing import ClaimsPreprocessor

# Load and preprocess claims data
preprocessor = ClaimsPreprocessor()
X_train, X_test, y_train, y_test = preprocessor.load_and_split("claims_data.csv")

# Train hybrid ensemble model
detector = FraudDetector(model=HybridEnsemble())
detector.fit(X_train, y_train)

# Detect fraud with explainable outputs
results = detector.predict(X_test, explain=True)

for case in results.flagged:
    print(f"Claim {case.id} | Score: {case.score:.3f} | {case.explanation}")

Quick Start — Patient Billing Audit with RAG

from healthfraudml import CPTDatabase, RAGBillAuditor

# Initialize vector database with CPT pricing rules
db = CPTDatabase()

# RAG auditor: retrieves rules from ChromaDB → prompts Gemini → generates audit
rag = RAGBillAuditor(db=db)
report = rag.audit_bill([
    {"cpt_code": "99285", "amount": 6500.00, "description": "ED Level 5"},
    {"cpt_code": "",      "amount": 900.00,  "description": "Bartholin cyst drainage"},
], provider_name="Example Health System")

# Semantic search resolves "Bartholin cyst drainage" → CPT 56420 automatically
print(f"Savings: ${report['suggested_savings']:.2f}")
print(report['dispute_letter'])

Organizational Readiness Assessment

from healthfraudml.readiness import ReadinessAssessment

assessment = ReadinessAssessment()
report = assessment.evaluate(
    institution_size="medium",
    annual_claims_volume=120000,
    existing_fraud_detection="manual",
    it_staff_count=5,
    annual_fraud_budget=45000
)

print(f"Readiness Score: {report.readiness_score}/100")
print(report.recommendations)
print(report.implementation_roadmap)

Architecture

healthfraudml/
├── detector.py              # Main FraudDetector API
├── models/
│   ├── supervised/          # Neural Net, SVM, Random Forest, Gradient Boosting, Bayesian
│   ├── unsupervised/        # K-Means, Outlier Detection, Artificial Immune Systems
│   └── hybrid/              # AdaBoost Ensemble, Stacked Models
├── preprocessing/           # Claims pipelines, feature engineering, HIPAA privacy
├── evaluation/              # Metrics, benchmarking, SHAP/LIME explainability
├── readiness/               # TAM-based organizational assessment
├── auditor/                 # Patient billing auditor
│   ├── billing_auditor.py   # Rule-based CPT audit engine
│   ├── llm_integration.py   # Gemini LLM parser + RAG auditor
│   └── db.py                # ChromaDB vector store
├── fraud_types/             # Upcoding, phantom billing, unbundling, etc.
└── examples/                # Jupyter notebooks and demo scripts

Research Foundation

Built from doctoral research at the University of the Cumberlands examining ML adoption for healthcare fraud detection across U.S. institutions. Grounded in Technology Acceptance Model (TAM), Fraud Triangle Theory, and Diffusion of Innovations Theory.

Citation:

@phdthesis{bahudhoddi2025financial,
  title={Financial Fraud Detection in Healthcare Settings: Comparative Analysis
         through Machine Learning to Identify Problems Relating to Fraudulent
         Activities in Hospitals},
  author={Bahudhoddi, Bharath Kumar},
  year={2025},
  school={University of the Cumberlands}
}

Documentation

Full docs are powered by MkDocs with Material theme:

pip install mkdocs mkdocs-material
mkdocs serve
# Open http://127.0.0.1:8000/

Contributing

Contributions are welcome! See CONTRIBUTING.md for guidelines and good first issues.

License

MIT License — see LICENSE for details.

Contact

Bharath Kumar Bahudhoddi, Ph.D.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

healthfraudml-0.1.0.tar.gz (45.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

healthfraudml-0.1.0-py3-none-any.whl (53.3 kB view details)

Uploaded Python 3

File details

Details for the file healthfraudml-0.1.0.tar.gz.

File metadata

  • Download URL: healthfraudml-0.1.0.tar.gz
  • Upload date:
  • Size: 45.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.7

File hashes

Hashes for healthfraudml-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6f64bc93e3b028ac64d87e4cf148ed65e73c07aafa0118a0af97e72d7d97d385
MD5 0a76da52dcb7faa6e5f7535a82b10a75
BLAKE2b-256 0baf8e5cf45b372739b46dce09752161a1ae4fa40d118ef8d6251717cafb30c9

See more details on using hashes here.

File details

Details for the file healthfraudml-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: healthfraudml-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 53.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.7

File hashes

Hashes for healthfraudml-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2c2ffb75599fa6fe45ba21157c5d3fecb4ba0a676c0a3e08b7959546045f4876
MD5 959f3d54afcb4e8a90e3018bb4eacc37
BLAKE2b-256 0358a77b5dbb5c189e6ea151731158b9d292a0fef78c371840527a7332f5edcb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page