Similar to the web app implementation: https://github.com/beda-software/fhir-emr/blob/2086e60eaf60d6faf86175c173932363deec9053/src/utils/fhirpath.ts#L33