Implement coalesce function according to the specification
Spec: https://build.fhir.org/ig/HL7/FHIRPath/#coalescevalue--collection-value--collection---collection
It should support variadic number of params
Testing
NOTE: can be put into DSL tests tests/cases/5.2.8_coalesce.yaml
resourceType: Patient
identifier:
- system: required-system
value: required-value
coalesce(Patient.identifier.where(system='required-system').value.first(), 'unknown')
should return {'required-value'}.
coalesce(Patient.identifier.where(system='other-system').value.first(), 'unknown')
should return {'unknown'}.
-
coalesce({}, (1 | 2), (3 | 4)) should return {1, 2}
-
coalesce({}, 1) should return {1}
-
coalesce({}) should return {}
Implement
coalescefunction according to the specificationSpec: https://build.fhir.org/ig/HL7/FHIRPath/#coalescevalue--collection-value--collection---collection
It should support variadic number of params
Testing
NOTE: can be put into DSL tests
tests/cases/5.2.8_coalesce.yamlshould return
{'required-value'}.should return
{'unknown'}.coalesce({}, (1 | 2), (3 | 4))should return{1, 2}coalesce({}, 1)should return{1}coalesce({})should return{}