Built for Google Cloud Rapid Agent Hackathon 2026

Hospital prices are public.
Finally, they're human.

5 AI agents. 3,000+ hospitals. Real Medicare data. Plain English answers in 8 seconds.

3,000+Hospitals
260K+Procedures
50US States
clearprice — agent session
> "knee replacement near zip 94102?"
Procedure AgentDRG 470, DRG 469 identified
Hospital Discovery9 hospitals within 25 miles
Price Intelfetching Medicare payments...
Quality & Financeloading CMS ratings...
— results —
Kaiser Foundation Hospital – SF$32,039★★★★-12% vs national
CPMC Van Ness Campus$61,969★★★+70% vs national
UCSF Medical Center$72,100★★★★+98% vs national
National median DRG 470: $36,400 · Medicare 2024 data
The Problem

They published the data. Nobody made it readable.

Since January 2021, every US hospital must publish a machine-readable price file. Here's what that looks like — vs what ClearPrice gives you from the same data.

hospital_chargemaster_2024.csv — 523,841 rows
payer_name | code_type | local_code | description | gross_charge | discounted_cash | negotiated_charge
BCBS CADRG470Major Hip...$82,000
Aetna PPODRG470Major Hip...$82,000$31,200
United HCDRG470Maj Hip Kne...$82,000
BCBS CACPT27447TKA w/o MCC$74,500
... 523,837 more rows
What hospitals publish — legally required since 2021
ClearPrice — same data, human language8.2s
You asked: "Knee replacement near zip 94102?"
BEST VALUEKaiser Foundation Hospital – SF

Medicare paid $32,03912% below the national median of $36,400.

CMS quality: ★★★★ · 4.7 miles away

vs UCSF Medical Center: $72,100 (+98% vs national)

vs CPMC Van Ness: $61,969 (+70% vs national)

ASC alternative: Highland Surgical Center — $18,200 outpatient. Save ~43% vs hospital inpatient.

Powered by 5 AI agents · CMS Medicare FY2024 · DRG 470
What ClearPrice gives you — same data, 8 seconds
System Architecture

End-to-End Architecture

From your question to ranked hospital comparison — 5 specialized agents, 1 custom MCP server, MongoDB Atlas.

🌐 User Browser
SSE streaming
Next.js Frontend — Cloud Run
POST /api/chat
Hono.js API — Cloud Run
ADK runner
Orchestrator Agent
Gemini 3.5 Flash — Vertex AI Agent Runtime
Decomposes query → dispatches sub-agents in parallel → synthesizes
parallel dispatch
Procedure Agent
NL → DRG/APC
Hospital Discovery
Geo + filters
Price Intel
DRG/APC pricing
Quality & Finance
Stars + charity
Provider Agent
Physicians + NPI
MCPToolset / stdio
Custom MCP Server
10 domain-aware tools — Cloud Run sidecar
search_procedures · find_hospitals_near · get_price_data · get_quality_scores · rank_hospitals + 5 more
MongoDB queries / REST
MongoDB Atlas
hospitals · prices · providers
Google Places API
ratings + reviews
NPI Registry
provider directory
Request Timeline (~7 seconds total)
Step 1
~2s
Procedure + Hospital
Step 2
~3s
Price + Quality + Provider
Step 3
~2s
Synthesis + response
Total: ~7 seconds end-to-end
Multi-Agent System

5 Specialized AI Agents

Each agent is a Gemini 3.5 Flash specialist with a focused job and access only to the tools it needs.

🔬
Agent 01
Procedure Agent
Triggers when

Any query with a procedure name

Tools used
search_procedures
Returns

DRG/APC codes with plain names

in "knee replacement"
out DRG 470 (Knee Replacement, inpatient), DRG 469 (with MCC)
🗺️
Agent 02
Hospital Discovery
Triggers when

Any query with a location (zip/city)

Tools used
find_hospitals_near
Returns

Hospital list with CCNs, distances, coordinates

in zip 94102, 25mi
out 9 hospitals with CCNs and lat/lng coordinates
💰
Agent 03
Price Intel Agent
Triggers when

After hospital list + procedure codes are known

Tools used
get_price_dataget_asc_prices
Returns

Medicare payments + national median benchmark

in DRG 470 at UCSF (050454)
out avg Medicare paid $72,100, national median $36,400
Agent 04
Quality & Financial
Triggers when

After hospital list is known

Tools used
get_quality_scoresget_financial_assistance
Returns

CMS stars, Leapfrog grades, charity care ratios

in CPMC Van Ness (CCN 050076)
out ★★★ CMS, Grade B Leapfrog, 1.8% charity care ratio
👨‍⚕️
Agent 05
Provider Agent
Triggers when

When user asks about doctors or surgeons

Tools used
get_providersget_provider_ratings
Returns

Physician list with specialties, ratings, NPI

in Orthopedic surgeons at UCSF
out 4 surgeons, avg Google 4.6★, 2 accepting new patients
🎯
Coordinator
Orchestrator

Receives user query, decomposes it into workstreams, dispatches sub-agents in parallel, synthesizes final ranked response.

Checks session context before asking for zip code. Handles ambiguous procedure names with one clarifying question.

Runs sub-agents in parallel:
Step 1: Procedure + Hospital (concurrent)
Step 2: Price + Quality + Provider (concurrent)
Step 3: rank_hospitals → synthesize
Custom MCP Server

10 Domain-Aware Tools

Built with @modelcontextprotocol/sdk. Bridges AI agents to MongoDB Atlas and external APIs. Each agent only sees the tools it needs.

search_procedures

Semantic search: natural language → DRG/APC codes

{ query: string, top_k?: number }
Atlas Vector Search
find_hospitals_near

Geocode ZIP/address → $near geo query on hospitals collection

{ zip: string, radius_miles?: number, filters?: object }
Atlas $near / Geo
get_price_data

Aggregation pipeline: DRG/APC prices per hospital vs national

{ hospital_ccns: string[], procedure_codes: string[] }
Atlas Aggregation
get_asc_prices

ASC outpatient alternative pricing — surface the cheaper option

{ procedure_codes: string[], zip: string }
asc_prices collection
get_quality_scores

CMS star ratings + Leapfrog safety grades per hospital

{ hospital_ccns: string[] }
CMS + Leapfrog
get_financial_assistance

Charity care ratio and uncompensated care from HCRIS

{ hospital_ccns: string[] }
HCRIS Cost Reports
get_providers

Physicians at a hospital — Atlas Full-Text Search on specialty

{ hospital_ccn: string, specialty?: string }
NPI Registry / CMS
get_provider_ratings

Google Places rating for hospital or individual provider

{ npi?: string, name?: string, address?: string }
Google Places API
rank_hospitals

Composite score: price + quality + distance + ratings (weighted)

{ hospitals: HospitalData[], weights?: object }
Pure computation
save_session / get_session

Persist zip, payer, filters across conversation turns (TTL: 30d)

{ session_id: string, context: object }
MongoDB TTL Index
Data Sources

7 Real Data Sources

All public, all free. No synthetic data — ever.

🏥DRG

CMS Medicare Inpatient

145,879procedure records across 3,000+ hospitals

Annual bulk CSV from data.cms.gov. What Medicare actually paid per DRG per hospital — the definitive national benchmark.

Covers knee replacement, cardiac bypass, C-section, hip replacement + hundreds more inpatient DRGs.

🔬APC

CMS Medicare Outpatient

116,799outpatient procedure records

Outpatient procedures billed to Medicare: colonoscopy, MRI, CT scan, minor surgeries, infusion therapy.

Combined with ASC data to surface the cheapest setting for each procedure.

Quality

CMS Hospital General Information

5,432hospitals with quality ratings

CMS 1–5 star ratings, addresses, CCN join key. Every hospital geocoded via Google Maps API.

The primary join key (CCN) connects pricing data to quality ratings and financial data.

🛡️Safety

Leapfrog Hospital Safety Grades

A–Fletter grades for surgical safety

More meaningful than CMS stars for surgical procedures. Leapfrog grades focus specifically on preventable errors.

Displayed alongside CMS stars — two independent quality signals for each hospital.

💙Charity Care

HCRIS Cost Reports

$45B+uncompensated care tracked annually

HCRIS data shows charity care costs and uncompensated care per hospital — critical for uninsured patients.

"This hospital forgives ~2% of charges — ask about financial counseling before your visit."

👨‍⚕️Providers

NPI Registry (CMS)

3.37Mphysician and provider records

Links doctors to their affiliated hospital via CCN. Free API, no key required.

Combined with CMS Doctors & Clinicians dataset for quality scores and malpractice flags.

📍Consumer Ratings

Google Places API

4.2★avg rating, 1,800+ reviews per hospital

Consumer ratings and review counts for hospitals and individual practices. Cached in MongoDB after first lookup.

$200/mo free credit — zero cost at demo scale.

Geospatial Layer

How Location Works

From a ZIP code to a ranked list of nearby hospitals in under 2 seconds.

1

ZIP → Coordinates

Google Maps Geocoding API converts any US ZIP code or address to lat/lng.

"94102" → { lat: 37.773, lng: -122.431 }
2

MongoDB $near Query

2dsphere index on hospitals.location enables sub-100ms geo queries across 5,000+ hospitals.

$near + $maxDistance: radius × 1609.34
3

Distance + Ranking

Haversine distance in miles attached to each result. Fed into composite rank_hospitals score.

Weight: distance 15%, price 35%, quality 30%, ratings 20%
mcp-server/src/tools/findHospitalsNear.ts
// Atlas $near geo query — requires 2dsphere index on hospitals.location
const hospitals = await db.collection('hospitals').find(({
location: {
$near: {
$geometry: { type: 'Point', coordinates: [lng, lat] }
$maxDistance: radiusMiles * 1609.34,
},
}
}).limit(20).toArray();
// Returns hospitals sorted by distance. 2dsphere index makes this ~80ms.
Real Data

Real Data. Real Hospitals. Real Prices.

DRG 470 — Major Knee/Hip Replacement. Medicare payment averages, fiscal year 2024.

National median (DRG 470): $36,400
HospitalCityMedicare Paidvs NationalCMS ★Discharges
Good Samaritan Hospital
San Jose, CA$29,800-18%★★★☆☆156
BEST VALUEKaiser Foundation Hosp – SF
San Francisco, CA$32,039-12%★★★★187
Stanford Health Care
Palo Alto, CA$48,200+32%★★★★★445
CPMC Van Ness Campus
San Francisco, CA$61,969+70%★★★☆☆203
UCSF Medical Center
San Francisco, CA$72,100+98%★★★★312

Source: CMS Medicare Provider Utilization and Payment Data: Inpatient, FY2024. These are Medicare average payments — commercial rates are typically 150–300% higher. Individual patient costs vary based on plan, deductible, and network status.

MongoDB Atlas

Every Atlas Feature, Visibly Used

Each MongoDB capability appears in the demo and directly shapes the user experience — not just listed in a README.

🔍Vector
Atlas Vector Search
search_procedures tool

"knee replacement" → DRG 470 via semantic similarity — no exact match needed

📊Aggregation
$median Aggregation
Price Intel Agent

National benchmark across 260K+ records in a single pipeline stage

📍Geospatial
$near Geospatial
Hospital Discovery Agent

Find 20 nearest hospitals to any coordinates — requires 2dsphere index

🔤Full-Text
Atlas Full-Text Search
Compare page UI

Hospital name autocomplete, live search-as-you-type across 5,000 hospitals

TTL
TTL Index
sessions collection

Sessions auto-expire after 30 days — built-in privacy, zero application code needed

🌐Index
2dsphere Index
hospitals + asc_prices collections

Prerequisite for $near queries. Without this, geo search is a full collection scan

Performance
Compound Indexes
prices collection

{ procedure_code, hospital_ccn, cms_year } — sub-100ms queries on 260K+ docs

🔄Aggregation
Aggregation Pipelines
get_price_data tool

$match → $group → $project → $round — multi-stage price rollup per hospital

Impact

Why This Matters

100 million Americans carry medical debt. The data to prevent it has been public since 2021. Nobody made it usable — until now.

🧑‍⚕️

For Patients

100M
Americans with medical debt
  • Compare prices before elective procedures
  • Find highest-rated hospital at lowest price
  • Identify hospitals with charity care programs
  • See if an ASC is 50% cheaper for your surgery
  • "I'm uninsured" mode: cash prices + charity care
🏢

For Employers

$23K
avg annual family premium (2024)
  • Benchmark insurer contracts vs Medicare rates
  • Build reference-based pricing programs
  • Identify Centers of Excellence
  • Negotiate better rates with real data
  • Surface ASC alternatives for employees
📐

For Researchers

6,000+
hospital price files — all normalized
  • Price variation across geographies
  • Quality vs cost correlation analysis
  • Charity care distribution by system
  • Payer negotiation power analysis
  • ASC vs hospital setting savings by state
⚠ Known Limitations

What this tool can and can't do

We believe in transparency. Here's exactly where ClearPrice falls short.

Medicare rates, not your insurer's rate

Commercial rates are typically 150–300% of Medicare. Your out-of-pocket depends on your specific plan, deductible, and network.

Prices are averages, not guarantees

Medicare payments shown are hospital-level averages. Individual cases vary by complexity, length of stay, and complications.

Data is 1–2 years behind

CMS publishes annually with a 1–2 year lag. Prices reflect 2022–2024 data. Hospital rates change each year.

Not a substitute for medical advice

ClearPrice presents data — it does not recommend providers, procedures, or treatments. Always consult your physician.

Rural coverage gaps

Critical Access Hospitals and some rural facilities report differently or are excluded from CMS bulk datasets.

No PHI ever collected

Session context (zip code, payer) is ephemeral with a 30-day TTL. Never linked to patient identity. No login required.

Live — CMS 2024 Medicare data

The data was always public.
We just made it human.

Ask about any procedure, any zip code — 3,000+ hospitals, real Medicare prices, zero signup.

Ask About Hospital Prices →

No account required · CMS FY2024 data · Free forever

Google ADKGemini 3.5 FlashVertex AI Agent RuntimeMongoDB AtlasAtlas Vector SearchCustom MCP ServerHono.jsNext.js 14Cloud Run