Inspiration

In a typical clinical setting, a doctor spends the most critical minutes of an encounter discussing the "Plan." They type vital commitments like "I will order an MRI in 14 days" or "Follow up with Neurology in a month." However, these promises are often buried in unstructured text notes.

If a busy clinician forgets to manually enter those orders into a scheduling system, the patient falls through the cracks. This isn't just a workflow issue; it’s a severe patient safety issue. We were inspired to build a bridge that automatically catches these "Clinical Promises" before they are forgotten, converting them from unstructured text into formal, trackable elements within the healthcare system's source of truth.

What it does

FHIR Task Creator is an AI-driven, multi-agent system that reads unstructured clinical notes, identifies promised future actions, and automatically generates structured, trackable FHIR Task and ServiceRequest resources. It effectively acts as an automated safety net, ensuring that every verbal or written commitment made by a provider becomes a mathematically tracked deadline in the patient's official medical record.

How we built it

We leveraged the Prompt Opinion Platform to create an architecture that prioritizes medical precision over LLM "best guesses."

  • Agent-to-Agent (A2A) Orchestration: We utilized a dual-agent workflow. First, the Scribe Agent analyzes the DocumentReference (clinical note) to identify the provider's intent. Once found, it pings the Coordinator Agent, which acts as the gatekeeper for the FHIR server.
  • Deterministic Precision Engine (MCP Tool): To avoid the dangerous hallucinations often associated with LLMs trying to do medical billing or date math, we built a Regex-based MCP Server in Python. Instead of letting the AI guess the dates, our tool uses strict regular expressions to parse strings like "in 14 days".
  • Mathematical Temporal Logic: The MCP tool then uses Python's datetime library to calculate exact calendar dates: $$\text{Target Date} = \text{datetime.now()} + \text{timedelta(extracted_days)}$$
  • FHIR Interoperability: Finally, using the platform's SHARP Context for secure authorization, our MCP tool POSTs this deterministic data to the FHIR R4 server as a perfectly formatted JSON Task resource.

Challenges we ran into

  • Temporal Reasoning: Doctors describe time in many ways ("a fortnight," "2 weeks," "next month"). Normalizing this required building robust regex patterns that could feed our deterministic calculation engine without breaking.
  • Contextual Noise vs. Future Intent: Clinical notes are heavily populated with historical data (e.g., past diagnoses or past surgeries). Our challenge was writing prompts and regex rules strict enough to ignore past events and only extract future clinical promises.
  • Strict Healthcare Standards: Mapping a doctor's informal phrase to a formal, schema-compliant FHIR Task required a deep dive into the HL7 FHIR documentation to ensure our JSON payloads were structurally perfect and clinically meaningful.

Accomplishments that we're proud of

We are incredibly proud of successfully combining the fluid reasoning of Generative AI with the rigid, deterministic reliability of standard code (Regex). By passing the unstructured data from the A2A system into a strictly controlled Python MCP logic gate, we achieved a "Zero-Hallucination" timeframe calculation. Proving that we can securely write data back into the FHIR server using the SHARP context was our biggest technical win.

What we learned

This hackathon taught us that the "Last Mile" of healthcare AI isn't about making the AI smarter—it's about making the AI accountable. We learned that while LLMs are incredible at reading comprehension, enterprise-grade healthcare applications must rely on deterministic code for database writing and temporal math. We also gained a profound appreciation for the FHIR standard as a universal language for patient care.

What's next for FHIR Task Creator

The next step is to expand our Regex MCP server to handle complex conditional logic (e.g., parsing phrases like "if symptoms persist for 3 more days"). We also plan to integrate our outputs with a notification system, alerting human Care Coordinators when a generated FHIR Task approaches its calculated due date without being fulfilled.

Built With

Share this project:

Updates