-
Notifications
You must be signed in to change notification settings - Fork 2
FHIRPath lexer root-node list is R4-only and includes removed resources #314
Description
The ROOT_NODE keyword list (used to recognise FHIR resource type names as path root tokens) is hardcoded from R4. This causes two classes of problems:
R5-only resources are absent
New R5 resources such as ActorDefinition, Requirements, Transport, SubscriptionStatus,
SubscriptionTopic, TestPlan, GenomicStudy, FormularyItem, InventoryReport, and
NutritionProduct are not in the list. FHIRPath expressions starting with any of these type
names will fail to parse as root paths when working against R5 resources.
R4-only removed resources are still present
Resources removed in R5 (e.g. CatalogEntry, MedicinalProduct, all MedicinalProduct*
variants, SubstanceSpecification, SubstanceNucleicAcid, SubstancePolymer, etc.) remain
in the list. Since the lexer is shared across all releases this pollutes the keyword vocabulary.
Suggested fix
The ROOT_NODE list should be generated per FHIR release from the type registry rather than
hardcoded. The lexer (or parser) should receive the active release context so it can use the
appropriate set of resource type names. A quick interim fix would be to take the union of R4
and R5 names so neither release is broken, while the proper fix builds the list dynamically.
Alternatively, the union could be kept and a dynamic check against the registry could be done at the Root.evaluate() class-level,