HealthRecordCommunity
FHIR🌏 InternationalEnriched

Context-Free Grammar Guided Generation of FHIR Resources Using Large Language Models

Context-Free Grammar-Guided Generation of FHIR Resources Using Large Language Models

May 28, 2026

Summary

Researchers developed a new pipeline to leverage the medical information extraction capabilities of Large Language Models (LLMs) while addressing their unstructured output challenge. This method generates context-free grammars (CFGs) from FHIR JSON Schemas, demonstrating enhanced structural validity.

Details

Large Language Models (LLMs) show remarkable capabilities in medical information extraction and data transformation but pose significant challenges because their outputs are unstructured for integration into clinical data pipelines. Although Fast Healthcare Interoperability Resources (FHIR) provides a standardized data model, its complexity—involving deeply nested structures and strict syntactical rules—makes reliable generation difficult. This study addresses this by presenting a pipeline that synthesizes Context-Free Grammars (CFGs) from FHIR-derived JSON Schemas. This enables schema-conformant structured generation using LLMs. A key feature is the use of 'relaxed key ordering' to maintain structural validity while avoiding limitations inherent in strict schema-guided approaches. Systematic evaluation on 17 test cases across 5 categories using FHIR R5 resources demonstrated that CFG-guided generation achieved a 76.5% validity rate. This significantly surpasses the 41.2% achieved by JSON Schema-guided methods and the 17.6% of unguided generation. Furthermore, the approach successfully enforced value constraints (like enumerated types) and structural compliance, which other methods fail to guarantee.

📰
Read Original Article
researchgate.net

Original content copyright by respective publishers