When I started building a grounded RAG system over FHIR records, I assumed the hard part would be retrieval and generation. Two years of working with FHIR had made the resource model familiar, but that familiarity turned out to be the easy half. The real question was which parts of the FHIR structure the pipeline had to preserve instead of flattening the record into a document.

A FHIR record is not a pile of prose. It is a graph of typed, coded, cross-referencing objects, where the meaning of any one node depends on nodes it points at. Bringing the document-RAG mental model to it builds something that technically runs and quietly answers the wrong questions.

FHIR R4 patient records contain resources, terminology codes, and references. For an engineer who knows embeddings but has not worked with a patient chart, those details determine the pipeline design.

A Bundle is not a document

The unit we get is a Bundle: a JSON envelope with an entry array. Each entry has a fullUrl and a resource. The resources are not sections of one document. They are independent records that happen to have been shipped together.