Error for Path Selection of Attributes Named like Functions
Hi there,
there are sometimes problems if a path selection attribute has the same name as an existing operation. For example, div is the integer division, but it is also used in many generated public FHIR resources.
In this case, the path text.div will yield an error.
import json
from fhirpathpy import evaluate
from pathlib import Path
with Path("tests/resources/observation-example.json").open("r") as fp:
resource = json.load(fp)
res = evaluate(resource, "Observation.text.div")
print(res)
returns
Exception: Infix invoke should have arity 2
I think that this error could be fixed by looking at whether there is a dot or not before the declaration.
Best, Giulia
According to the specification https://build.fhir.org/ig/HL7/FHIRPath/#keywords keyword like div must be wrapped with backticks, but it's not supported yet
@giuliabaldini you can use workaround for the old grammar like Patient.text."div".
But there's an issue #13 that will change quotes to backticks.
It should be fixed starting from 1.0.0 version @giuliabaldini Could you please check?