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

PyPI version 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

Note: the RAG and LLM features need extra dependencies. Install them with pip install "healthfraudml[rag]" (adds ChromaDB, Google GenAI, and pypdf).

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.2.0.tar.gz (128.5 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.2.0-py3-none-any.whl (133.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for healthfraudml-0.2.0.tar.gz
Algorithm Hash digest
SHA256 6c0b92b7d3d75a155b5ccff960a87efb81feb84c70667b0f662978d5d6958e26
MD5 abb9eb817907cab18c8d737d2113fb1d
BLAKE2b-256 28b2066a5b67ead8bdcdbfd4832bc765bdbf03a6de807a172db4546c35837ca8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: healthfraudml-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 133.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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 38a6e3ec19669c23853feec9079cfb1e6d6365e27481d433a5fcbf3066b59b48
MD5 ee2a3b13dac3f25a4926347d5138f082
BLAKE2b-256 d046deaf245aed7184b37781d2089db5775fe046b07ea0d6aeb45909f40460ae

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