Project Info
Inspiration
Medicaid helps serve 70 to 80 million people every year, which comes out to roughly 1 to 4 Americans. But due to the large number of people Medicaid is provided to, investigative capacity is limited. Parsing millions if not billions of data entries, and assessing billing patterns that look suspicious is slow, manual and full of false positives. Medicaid Sherlock is a open-source multi-agent AI system that helps investigators triage faster and help catch perpetrators in a more effective manner.
What it does
Medicaid Sherlock is a multi-agent AI system that analyzes 227 million Medicaid claim rows between the years 2018 and 2024 and flags providers with unusual billing patterns using five anomaly detectors (spending outliers, cost-per-claim outliers, billing spikes, billing/service mismatch, and procedure concentration). It then uses a 5 agent workflow to turn any flagged provider into a nuanced case file that includes peer comparisons, time-series evidence, billing network relationships, HCPCS plain-English translation, and public context to separate explained structural patterns to unexplained signals that warrant review.
How we built it
Data pipeline (DuckDB + Parquet): Pre-aggregated benchmarks (HCPCS×year medians/p95/p99), provider summaries, and monthly time series for fast analytics over a huge dataset. Anomaly detection layer: Implemented five complementary detectors and unified all flags into a single anomalies table with scores and categories. Cross-referencing engine: Intersected risk dimensions to surface high-signal leads (e.g., multi-flag providers, extreme cost outliers, new high spenders, flagged networks). Enrichment: NPPES NPI Registry API to classify providers (organization vs individual, specialty/taxonomy, location) for context-aware scoring. HCPCS lookup (official CMS file + common CPTs) to translate procedure codes. Perplexity Sonar to pull relevant public records and enforcement context. Multi-agent system (Claude Sonnet): Investigator orchestrates Analyst + Network Mapper + Researcher + Report Generator to produce structured reports with evidence and caveats. Frontend (demo): An interactive UI for exploring anomalies, drilling into providers, visualizing networks, and generating a report for screen-recorded demos.
Challenges we ran into
Scale: Working with a massive dataset required careful pre-aggregation, indexing strategies, and avoiding “full table scans.” False positives / structural noise: Hospitals, FQHCs, and integrated systems naturally look anomalous; we had to design the system to avoid reckless conclusions and add context-aware interpretation. OSINT reliability: Web context can be messy; we structured outputs to separate confirmed enforcement actions from unverified allegations and to surface uncertainty clearly.
Accomplishments we're proud of
Built a complete end-to-end investigation pipeline from raw claims to anomalies to cross-referenced leads to enriched case files. Created a system that’s explainable by design: every flag has a rationale, peer comparison, and a “legitimate explanation” section. Successfully integrated a multi-agent investigation workflow that produces structured, investigator-friendly reports on demand.
Medicaid Sherlock
Medicaid fraud detection and investigation system: a DuckDB-powered pipeline over HHS T-MSIS claims data and a multi-agent framework (Claude + Perplexity + NPPES) for provider-level intelligence.
What it does
- Scripts pipeline (batch): Ingest 227M+ Medicaid claims, compute procedure benchmarks and provider summaries, run five anomaly-detection algorithms, enrich top-risk providers with NPPES and web research, and produce an executive briefing plus cross-referenced leads.
- Multi-agent (conversational): Investigate any provider on demand. The Investigator coordinates an Analyst (DuckDB + NPI + HCPCS), Researcher (Perplexity), Network Mapper (billing/servicing relationships), and Report Generator to produce structured investigation reports.
See docs/ARCHITECTURE.md for data-flow diagrams and how scripts and agents connect.
Requirements
- Python 3.10+
- Data: Place
medicaid-provider-spending.parquet(or your T-MSIS-style spending file) indata/. Expected columns includeBILLING_PROVIDER_NPI_NUM,SERVICING_PROVIDER_NPI_NUM,HCPCS_CODE,CLAIM_FROM_MONTH,TOTAL_PAID,TOTAL_CLAIMS,TOTAL_UNIQUE_BENEFICIARIES. - APIs (optional but recommended for full flow):
- Anthropic API key — for 05 deep analysis narrative, 06 executive briefing, and multi-agent (Claude).
- Perplexity API key — for web research in 05, 08, and the Researcher agent.
- NPPES: NPI lookups use the public NPPES Registry API (no key required).
Setup
1. Clone and virtualenv
git clone <repo-url>
cd medicaid-sherlock
python3 -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
2. Install Python dependencies
pip install -r requirements.txt
3. Environment variables
Copy the example env file and set your keys (do not commit .env):
cp .env.example .env
# Edit .env and set ANTHROPIC_API_KEY and PERPLEXITY_API_KEY
| Variable | Used by | Purpose |
|---|---|---|
ANTHROPIC_API_KEY | 05, 06, multi-agent | Claude (deep analysis, briefing, all agents) |
PERPLEXITY_API_KEY | 05, 08, multi-agent | Perplexity Sonar (web research) |
4. Data
- Put your claims parquet in
data/medicaid-provider-spending.parquet. - HCPCS descriptions: the agent uses
agent/hcpcs_codes.json(from CMS 2026 release). Populate or generate it if you need procedure lookups.
Scripts pipeline (run in order)
Run from the project root. Later steps depend on earlier outputs in data/.
| Step | Script | Purpose |
|---|---|---|
| 1 | python scripts/01_explore.py | Schema and summary stats (row count, top providers, time range). |
| 2 | python scripts/02_enrich_npi.py | Extract unique NPIs to data/unique_npis.parquet (for bulk lookups if needed). |
| 3 | python scripts/03_benchmarks.py | Build procedure_benchmarks, provider_summaries, provider_monthly parquet files. |
| 4 | python scripts/04_anomaly_detection.py | Run 5 anomaly algorithms → data/all_anomalies.parquet. |
| 5 | python scripts/05_deep_analysis.py | Top-20 risk providers + NPPES + Perplexity → data/intelligence_report.json. |
| 6 | python scripts/06_generate_report.py | Claude turns intelligence_report.json into data/executive_briefing.md. |
| 7 | python scripts/07_cross_references.py | Cross-reference risk lists → data/cross_references.json. |
| 8 | python scripts/08_enrich_leads.py | Enrich cross-referenced leads with NPPES + Perplexity → data/enriched_leads.json. |
Steps 5, 6, and 8 call external APIs; 1–4 and 7 are local DuckDB only.
Multi-agent (conversational)
From the project root, run the agent from the agent directory so imports resolve:
cd agent && python multi_agent.py
Then type natural-language requests, e.g. “Investigate NPI 1234567890” or “Who are the highest-risk providers for cost-per-claim?” The Investigator will delegate to the Analyst, Researcher, Network Mapper, and Report Generator and return a single answer. Type quit to exit.
Requires the same data/ outputs as the scripts (at least 03 and 04 run) so that all_anomalies, provider_summaries, procedure_benchmarks, and medicaid-provider-spending.parquet exist.
Project layout
medicaid-sherlock/
├── agent/ # Multi-agent system
│ ├── multi_agent.py # Investigator + Analyst, Researcher, Network Mapper, Report Generator
│ ├── tools.py # DuckDB queries for Analyst
│ ├── hcpcs_loader.py # HCPCS/CPT code lookup
│ └── hcpcs_codes.json # Procedure code descriptions (e.g. CMS 2026)
├── data/ # Input/output data (parquet, JSON, briefing)
│ ├── medicaid-provider-spending.parquet # Input: T-MSIS-style claims
│ ├── procedure_benchmarks.parquet
│ ├── provider_summaries.parquet
│ ├── provider_monthly.parquet
│ ├── all_anomalies.parquet
│ ├── intelligence_report.json
│ ├── cross_references.json
│ ├── enriched_leads.json
│ └── executive_briefing.md
├── scripts/ # Batch pipeline
│ ├── 01_explore.py .. 08_enrich_leads.py
│ └── npi_lookup.py
├── docs/
│ ├── ARCHITECTURE.md # Diagrams: scripts, agents, shared data
│ └── PROJECT_ANALYSIS.md # Suggestions and quality notes
├── dashboard/ # Optional Next.js UI (see dashboard/README if present)
├── .env.example
├── requirements.txt
└── README.md
Docs
- docs/ARCHITECTURE.md — How the scripts pipeline and multi-agent framework work and how they connect (Mermaid diagrams and file reference).
- docs/PROJECT_ANALYSIS.md — Analysis, improvement ideas, and known limitations.
License and disclaimer
This is an analytical tool to help investigators prioritize review. It does not determine fraud. Use outputs in accordance with your organization’s policies and applicable law.
Analysis
View
Metric
- 3
Figures cover GitHub contributors during the hackathon window. A co-authored commit counts in full for each author, so per-member totals add up to more than the whole-team figures.
Technology
- AnthropicIn code
- CSSIn code
- JavaScriptIn code
- Next.jsIn code
- PythonIn code
- ReactIn code
- Tailwind CSSIn code
- TypeScriptClaimed
7 of 8 appear in the indexed code. 1 claimed on Devpost could not be matched to code, which may simply mean the tool leaves no trace in the repository.
AI coding agents
No AI coding agent signals were found in this repository.
Detected from committed agent config files and commit authorship. Absence of a signal is not proof an agent was unused.
Codebase size
Source size
220 KB
Source files
36
Counts recognized source files only; vendored directories, binaries and lockfiles are excluded, so this is smaller than the repository on disk.
Repository
KrishDesai/medicaid-sherlock
53 files · 1.4 MB · @ fa6b9ed
Structure
Interface
18 files · 34%Screens, components and styles rendered to the user.
Application logic
6 files · 11%Domain rules, services and shared utilities.
Supporting
Layers are inferred from where files sit in the tree, not from reading the code. A project that names its directories unconventionally will read oddly here — open the file browser to check anything the diagram implies.
Languages
- Python50%
- JavaScript32%
- Markdown16%
- CSS1%
Share of indexed source by file size. Binary and vendored files are excluded.
Dependencies
dashboard/package.json
npm · 10- framer-motion
- next
- react
- react-dom
- react-markdown
- recharts
- +4 more
requirements.txt
pypi · 6- anthropic
- duckdb
- numpy
- pyarrow
- python-dotenv
- requests
Declared in the repository’s manifests at the indexed commit. A declared package is not proof it is used, and runtime dependencies are listed first.
This project’s features have not been analysed yet.
Export this project's context (description, README, evidence, key source files) to chat with an AI agent elsewhere.