Inspiration

Chile has 2.5 million patients waiting for specialist care in the public health system. In 2024, 36,262 people died while on a waitlist. The median wait time for an oncology consultation is 255 days — but this average hides dramatic regional inequality. A patient in Araucanía may wait 389 days while a slot in Maule is available in 52 days. No existing system detects this gap or recommends the transfer.

What it does

ChileWait is an MCP server that exposes four AI-powered healthcare tools to the Prompt Opinion platform:

  1. get_patient_profile() — retrieves a synthetic FHIR R4 patient record with oncology diagnosis, coverage type (FONASA/GES), and clinical urgency score
  2. query_waitlist() — queries synthetic RNLE data for current wait times across all 16 Chilean health service regions
  3. recommend_referral() — the core AI tool: crosses patient profile + regional capacity + coverage constraints to generate a ranked referral recommendation with plain-language clinical justification
  4. generate_heatmap_data() — produces structured data for a regional heat map showing waitlist pressure across Chile (RED/AMBER/GREEN by region)

When a clinician asks "What are this patient's referral options?", ChileWait invokes all four tools and returns: top 3 regional recommendations, days saved per option, coverage compatibility, and a national heat map of oncology waitlist pressure.

How we built it

  • MCP Server: Python + FastMCP framework, deployed on OVHcloud VPS (Ubuntu 22.04)
  • FHIR Data: Synthetic patient profiles generated with Synthea, calibrated to Chilean oncology epidemiology (DEIS-MINSAL 2002-2022)
  • Waitlist Data: Synthetic RNLE dataset based on published MINSAL statistics — 16 regions × 8 pathology groups × 4 coverage types
  • Platform: Integrated and published to Prompt Opinion Marketplace for discovery and invocation

Challenges we ran into

The main challenge was building a recommendation engine that balances three competing factors simultaneously: clinical urgency (how critical is the patient's condition), wait time savings (how much time is saved by transferring), and logistical feasibility (distance, coverage compatibility). Traditional rule-based systems cannot weigh these contextually — this is where generative AI reasoning is essential.

Accomplishments that we're proud of

  • First AI agent specifically designed for Chile's public health waitlist problem
  • Complete FHIR R4 compliance using only synthetic data — zero PHI
  • Covers all 16 Chilean health service regions
  • Directly addresses a gap confirmed by MINSAL's own 2024 procurement for AI-assisted waitlist management

What we learned

Building healthcare AI for a Latin American public system requires understanding the specific coverage structure (GES vs Non-GES, FONASA tiers A-D) and the regulatory context. The solution must be explainable — clinicians need to understand why a region is recommended, not just which region.

What's next for ChileWait — Intelligent Oncology Referral Agent

Phase 2: Pilot with one regional health service using anonymized live RNLE data. Phase 3: Expand to all 29 surgical specialties. Phase 4: Adapt for other Latin American public health systems (Colombia SISPRO, Peru FISSAL).

Built With

  • fastapi
  • fastmcp
  • fhir-r4
  • mcp-protocol
  • minsal
  • ovhcloud
  • prompt-opinion
  • python
  • rnle
  • sqlite
  • synthea
Share this project:

Updates