Is your feature request related to a problem? Please describe.
I wrote some code to extract all the resource ids from a bundle via fhirpath, but it took me longer than it should have to figure out how to get the primitive value out of the FHIRPathNode:
Bundle bundle = load("patients.json");
Collection<FHIRPathNode> nodes = FHIRPathEvaluator.evaluator().evaluate(bundle,
"Bundle.entry.resource.id");
List<Member> members = nodes.stream()
.filter(node -> node.isSystemValue())
.map(node -> string("Patient/" + node.howToGetTheValue...
Eventually I found the correct answer:
node.asSystemValue().asStringValue().string()
What tripped me up is that we have a FHIRPathNode.getValue() which I thought would work, but it turns out that actually returns the FHIRPathNode's value (child) when it holds one, not the primitive value of current FHIRPathNode when you already have a FHIRPathSystemValue.
Having this method on instances of FHIRPathSystemValue doesn't make much sense, because FHIRPathSystemValue itself is a terminal node and the getValue() just gets in the way of the actual accessors which don't use get at all.
Describe the solution you'd like
- override the
getValue() javadoc for FHIRPathSystemValue to indicate that it will always return null.
- in the concrete subtypes for FHIRPathSystemValue, add a
@see link to the actually getters for the given primitive type
Describe alternatives you've considered
Acceptance Criteria
Additional context
Is your feature request related to a problem? Please describe.
I wrote some code to extract all the resource ids from a bundle via fhirpath, but it took me longer than it should have to figure out how to get the primitive value out of the FHIRPathNode:
Eventually I found the correct answer:
node.asSystemValue().asStringValue().string()What tripped me up is that we have a
FHIRPathNode.getValue()which I thought would work, but it turns out that actually returns the FHIRPathNode's value (child) when it holds one, not the primitive value of current FHIRPathNode when you already have a FHIRPathSystemValue.Having this method on instances of FHIRPathSystemValue doesn't make much sense, because FHIRPathSystemValue itself is a terminal node and the
getValue()just gets in the way of the actual accessors which don't usegetat all.Describe the solution you'd like
getValue()javadoc for FHIRPathSystemValue to indicate that it will always return null.@seelink to the actually getters for the given primitive typeDescribe alternatives you've considered
Acceptance Criteria
Additional context