HL7/fhirpath.js

impossible to use attribute name that starts with a capitalized letter

ruscoder opened this issue · 3 comments

Hello!

I'm using fhirpath.js library with a FHIR server that allows using first-class extensions with custom name and there is an issue with accessing attributes that starts with a capitalized letter, e.g.

fhirpath.evaluate({"resourceType": "Patient", "CustomField": "value"}, "Patient.CustomField", {})

returns []

What is the reason for having this restriction?

Thanks.

I think the code is assuming that any identifier starting with a capital letter is a resource type. It is a simplification, but on other hand, I am not aware of any case in FHIR where a property of a resource also starts with a capital letter. Why would you not follow that pattern for your custom property names?

Anyway, I agree that identifiers starting with a capital letter should work, and I will add it to our list of things to address.

Why would you not follow that pattern for your custom property names?

I'm using Aidbox FHIR server that has own format for union type where valueQuantity: {...} becomes {value: {Quantity: {...}}} and currently it's impossible to extract value.Quantity.unit, so, I'm using workaround value.children().unit.

Thanks for fixing it! It works well in the latest release