Prototype / MVP - Technology demonstration for development and testing purposes. Not approved for clinical use or patient data.

AI-Powered Medical Data Processing,
FHIR-Compliant by Design

Ingest clinical documents, extract structured medical entities, and generate validated FHIR R4/R5 bundles - with intelligent multi-provider AI routing and built-in agent interoperability.

FHIR R4 / R5 MCP Compatible HL7 Standards DICOM Support Apache 2.0
2.3s
Avg. processing time
per clinical document
100%
FHIR R4/R5
validation compliance
4
AI providers with
automatic fallback
29
Test modules covering
unit, integration, MCP
6
Docker-orchestrated
microservices
$0
Local dev cost
Ollama, no API keys

Platform Demo

Watch FhirFlame process a clinical document end-to-end: from raw text ingestion through AI entity extraction to a validated FHIR R4 bundle.

Why FhirFlame Exists

Healthcare data is locked in unstructured formats. Converting it to interoperable standards manually is slow, expensive, and error-prone.

1

Unstructured Medical Data Everywhere

Clinical notes, lab reports, discharge summaries, and imaging reports arrive as free text, scanned PDFs, and proprietary formats. EHR systems need structured, coded data to be useful.

FhirFlame auto-extracts entities and structures them into FHIR bundles
2

FHIR Conversion Is Hard to Get Right

Building a compliant FHIR bundle by hand requires deep HL7 expertise. One missing field or wrong reference breaks downstream systems. Validation is tedious and easy to get wrong.

100% schema-validated output, zero dummy data, every field traced to source
3

No Affordable AI Tooling for Small Teams

Cloud AI APIs cost money per call. Many healthcare teams can't justify API spend for development and testing. Existing tools require expensive enterprise licenses.

Run entirely local with Ollama at $0 cost, scale to cloud only when needed
4

AI Agents Can't Access Healthcare Tools

LLM-based agents (Claude, GPT, custom) lack purpose-built medical tools. There's no standard way for an AI agent to process a clinical document and get back structured FHIR data.

MCP server gives any agent instant access to medical processing

Built for Healthcare Workflows

From document ingestion to FHIR-compliant output, every component is designed for medical data processing at scale.

R4

FHIR Validation Engine

Generate and validate HL7 FHIR R4/R5 bundles with 100% compliance scoring. Seamless EHR integration with structured, standards-conformant output.

  • Zero-dummy-data policy
  • Healthcare-professional validated
  • HL7 schema conformance
AI

Multi-Provider AI Routing

Intelligent cost-aware routing across Ollama (local/free), Modal Labs L4 GPU, HuggingFace inference, and Mistral Vision with automatic fallback.

  • Free local development
  • Serverless GPU auto-scaling
  • Provider health monitoring
MCP

Agent Interoperability

Built-in Model Context Protocol server with two healthcare-specific tools for seamless integration with Claude, GPT, and other LLM-based agents.

  • process_medical_document()
  • validate_fhir_bundle()
  • Agent-to-agent REST API
OCR

Document Intelligence

Mistral Vision OCR for medical document processing with high-accuracy entity extraction across clinical notes, lab reports, and radiology reports.

  • PDF, DICOM, TXT, DOCX support
  • Condition & medication extraction
  • Vitals and patient data parsing
DCM

DICOM Processing

Extract and process medical imaging metadata via pydicom. Map DICOM data to FHIR ImagingStudy resources for radiology and diagnostic workflows.

  • DICOM metadata extraction
  • ImagingStudy resource mapping
  • Standard imaging format support
MON

Observability & Audit

Langfuse-powered tracing and monitoring with PostgreSQL persistence, ClickHouse analytics, and comprehensive audit trails for compliance.

  • Real-time performance dashboard
  • Complete audit trail logging
  • Healthcare compliance tracking
MCP + A2A Protocol

First-Class Agent Interoperability

FhirFlame is not just a tool you use manually. It implements the Model Context Protocol so any LLM agent (Claude, GPT, custom) can call its healthcare functions programmatically. The A2A REST API enables system-to-system integration with EHRs, labs, and other services.

process_medical_document() — send clinical text, get back structured entities and a validated FHIR bundle in a single call
validate_fhir_bundle() — pass any FHIR bundle for R4/R5 compliance scoring with detailed error reporting
Agent-to-Agent REST API — FastAPI endpoints on port 8000 for synchronous and async document processing, health checks, and job tracking
MCP Tool Call Example
{
  "tool": "process_medical_document",
  "input": {
    "document_content": "Patient presents with
      acute chest pain, BP 142/91,
      HR 98. History of hypertension.
      Started on Metoprolol 50mg.",
    "document_type": "clinical_note",
    "extract_entities": true,
    "generate_fhir": true
  }
}
2
MCP Tools
REST
A2A Protocol
Async
Job Queue
Intelligent Routing

Cost-Aware Multi-Provider AI

The routing engine selects the optimal AI provider for each request based on cost, latency, and availability. Start free with local Ollama, then seamlessly scale to GPU cloud when you need production throughput. If a provider goes down, the system automatically falls back.

1
Ollama (Local) — CodeLlama 13B running on your machine at zero cost. No API keys, no network calls, full privacy.
2
Modal Labs (L4 GPU) — serverless GPU scaling for production. Auto-provisions NVIDIA L4 instances and scales to zero when idle.
3
HuggingFace + Mistral — medical-domain models (BioBERT, ClinicalBERT) and multimodal vision OCR for scanned documents.
Automatic Fallback — if a provider is unavailable or slow, the router promotes the next-best option without manual intervention.
Provider Priority Chain
Router Decision Engine
├─ Priority 1: Ollama (local)
│  ├─ Cost: $0
│  ├─ Latency: ~2.3s
│  └─ Status: ● healthy
├─ Priority 2: Modal Labs (GPU)
│  ├─ Cost: usage-based
│  ├─ Latency: ~1.1s
│  └─ Status: ● standby
├─ Priority 3: HuggingFace
│  ├─ Cost: free tier / paid
│  ├─ Latency: ~3.0s
│  └─ Status: ● healthy
└─ Priority 4: Mistral Vision
   ├─ Cost: usage-based
   ├─ Latency: ~2.8s (OCR)
   └─ Status: ● healthy
4
Providers
$0
Local Cost
Auto
Fallback
Healthcare Standards

100% FHIR R4/R5 Compliance

Every output bundle is validated against official HL7 FHIR schemas. The engine enforces a zero-dummy-data policy — every resource field maps directly to extracted clinical entities. Bundles are ready for EHR integration without post-processing.

R4
FHIR R4 + R5 Dual Support — generate bundles for either specification version, configurable per request or globally
Entity-to-Resource Mapping — conditions, medications, vitals, and patient demographics map to Patient, Condition, MedicationStatement, and Observation resources
Healthcare-Professional Validated — output quality reviewed by clinical domain experts to ensure semantic correctness
Validated FHIR Bundle Output
{
  "resourceType": "Bundle",
  "type": "collection",
  "entry": [
    {
      "resource": {
        "resourceType": "Patient",
        "name": [{"given": ["John"]}],
        "birthDate": "1965-03-15"
      }
    },
    {
      "resource": {
        "resourceType": "Condition",
        "code": {
          "text": "Hypertension"
        },
        "clinicalStatus": "active"
      }
    }
  ]
}
100%
Compliance
R4/R5
Dual Version
0
Dummy Data

From Document to FHIR Bundle

A multi-stage pipeline that transforms unstructured medical documents into validated, standards-compliant healthcare data.

1

Document Ingestion

PDF, DICOM, clinical text, and lab reports are ingested and pre-processed with OCR via Mistral Vision and text extraction via pydicom and PyMuPDF.

2

MCP Agent Routing

The MCP server selects the appropriate tool, routes to the optimal AI provider based on cost and availability, and tracks job state in PostgreSQL.

3

AI Entity Extraction

Medical NLP models extract conditions, medications, vitals, and patient information. Scaling flows automatically from local Ollama to Modal L4 GPU.

4

FHIR Compliance

Extracted entities are mapped to HL7 FHIR R4/R5 schemas, validated for 100% compliance, and output as EHR-ready structured bundles.

Real-World Use Cases

FhirFlame is built for anyone who needs to turn medical text into structured, standards-compliant healthcare data.

Hospital & Clinic IT

Automate the conversion of clinical notes, discharge summaries, and lab reports into FHIR bundles for EHR ingestion. Reduce manual data entry and transcription errors.

Clinical Note AI Extraction FHIR Bundle EHR System

Health Tech Startups

Add FHIR-compliant document processing to your product without building a validation engine from scratch. Ship interoperable features faster with the A2A API.

Your App A2A REST API FHIR Output Your Users

AI Agent Developers

Give your Claude, GPT, or custom LLM agent healthcare capabilities instantly. The MCP server exposes two tools that turn any agent into a medical document processor.

LLM Agent MCP Call Entities + FHIR Agent Response

Research & Education

Process medical datasets for research analysis. Use as a teaching tool for FHIR standards, medical NLP, and healthcare interoperability concepts. Runs locally for full data privacy.

Medical Dataset Batch Processing Structured Data Analysis

What Goes In, What Comes Out

FhirFlame accepts diverse medical document formats and produces standards-compliant structured output.

Input Formats

  • TXT
    Clinical Notes
    Free-text patient encounters, assessments
  • PDF
    PDF Documents
    Scanned reports, lab results via OCR
  • DCM
    DICOM Files
    Medical imaging metadata extraction
  • DOC
    DOCX Files
    Word documents, discharge summaries
  • IMG
    Images
    Scanned documents via Mistral Vision OCR
FhirFlame AI
Entity
Extraction
& Validation

Output

  • R4
    FHIR R4 Bundles
    HL7 FHIR R4 JSON, EHR-ready
  • R5
    FHIR R5 Bundles
    Latest FHIR specification support
  • ENT
    Extracted Entities
    Conditions, medications, vitals, patient info
  • RPT
    Compliance Report
    Validation score, errors, field coverage
  • LOG
    Audit Trail
    Full trace via Langfuse for every job

Microservices Architecture

Container-orchestrated services connected via Docker Compose for reproducible, healthcare-grade deployments.

Frontend
Gradio Web UI
Port 7860
API Gateway
FastAPI + MCP Server
Port 8000
AI Processing
Ollama + Modal Scaling
Port 11434
Data Layer
PostgreSQL + ClickHouse
Persistent Storage
Observability
Langfuse Analytics
Port 3000
FHIR Engine
R4/R5 Validation
Healthcare Standards

Deploy in Minutes

Run the full stack with Docker or start lightweight with a local Python environment.

Docker (Recommended)

Full stack - single command
git clone https://github.com/leksval/fhirflame.git
cd fhirflame
cp .env.example .env
docker compose -f docker-compose.local.yml up -d
Gradio UIlocalhost:7860
A2A APIlocalhost:8000
Langfuselocalhost:3000
Ollamalocalhost:11434

Local Python

Lightweight - Gradio UI only
git clone https://github.com/leksval/fhirflame.git
cd fhirflame
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .env
python app.py

On Windows use .venv\Scripts\activate instead. No API keys required - Ollama runs locally at zero cost.

Multi-Provider Configuration

Configure providers via environment variables. Start free with Ollama and add cloud providers as needed.

Ollama (Local)

No API keys required. Run CodeLlama 13B Instruct locally for development and testing.

USE_REAL_OLLAMA=true

Free

HuggingFace

Medical domain models (BioBERT, ClinicalBERT) and HF Spaces hosting with enterprise inference endpoints.

HF_TOKEN

Free tier available

Modal Labs

Serverless L4 GPU auto-scaling for production workloads with automatic provider fallback.

MODAL_TOKEN_ID

Usage-based

Mistral Vision

Multimodal AI for medical document OCR and text extraction from imaging and scanned documents.

MISTRAL_API_KEY

Usage-based

Langfuse

LLM observability and analytics with real-time job tracking, backed by PostgreSQL and ClickHouse.

LANGFUSE_SECRET_KEY

Self-hosted

HF Spaces Hosting

Deploy and host FhirFlame directly on HuggingFace Spaces with public or private access.

HF_TOKEN

Free tier available

Healthcare Security

Security patterns designed for healthcare environments with defense-in-depth principles.

Data Protection

  • Container isolation via Docker
  • Local processing for sensitive data
  • Encrypted environment configuration
  • Zero-dummy-data policy

Compliance Framework

  • HIPAA-aware architecture
  • Comprehensive audit trail logging
  • Healthcare data governance
  • Regulatory evaluation support

Authentication

  • JWT token-based authentication
  • OAuth 2.0 with PKCE flow
  • Role-based access control
  • Session management with expiry

Technology Stack

Open-source technologies chosen for reliability, performance, and healthcare-grade standards.

Core Platform

Python 3.11
FastAPI + Uvicorn
Gradio Web UI
asyncio

AI / Machine Learning

Ollama (CodeLlama 13B)
Modal Labs (L4 GPU)
HuggingFace Inference
Mistral Vision OCR

Healthcare Standards

FHIR R4/R5 (fhir.resources)
DICOM (pydicom)
HL7 Standards
MCP / A2A Protocols

Infrastructure

Docker Compose
PostgreSQL
ClickHouse
Langfuse

Start Processing Medical Documents Today

Try the live demo instantly, or deploy locally in under 5 minutes with Docker. No API keys required to get started.