targetElement vs targetPath to reference an element

I need to store references to specific elements of a resource inside Provenance records in Provenance.target and Provenance.entity.what. The options I’ve found are targetElement (Extension: targetElement - FHIR v5.0.0-cibuild) or targetPath (Extension: targetPath - FHIR v5.0.0-cibuild) extensions. targetPath seems easier to use since elements always have a path that can be referenced, whereas targetElement requires an id which may not be set on all elements. But, the documentation for targetPath says “This extension can be used when the target element has no explicit id associated with it. When there is an id on the element of interest, the extension targetElement* can be used since it is much simpler to implement.” Why is targetElement considered simpler to implement? Is targetElement or targetPath preferred as a way to reference elements?

*The page actually says targetPath here, but I believe that’s a typo since it wouldn’t make sense.

targetPath requires an implementation of FHIRPath. if you have one of those, it’s easy, but having one of those is very hard for legacy systems.

p.s. you’re right about the typo, thanks

1 Like