Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support "as" with best-effort in the absence of a model #141

Open
jmandel opened this issue May 8, 2023 · 0 comments
Open

Support "as" with best-effort in the absence of a model #141

jmandel opened this issue May 8, 2023 · 0 comments

Comments

@jmandel
Copy link
Contributor

jmandel commented May 8, 2023

Currently, evaluating "path.to.choiceType as Quantity" only works when a model is available. Example:

// example.js

import fhirpath from "https://esm.sh/fhirpath"
import r4 from "https://esm.sh/fhirpath/fhir-context/r4"

const o = {"resourceType": "Observation", "valueQuantity": {"value": 123}}
const withModel = fhirpath.evaluate(o, "value as Quantity", null, r4)
const noModel   = fhirpath.evaluate(o, "value as Quantity")

console.log("With model", withModel);
console.log("No model", noModel);
$ deno run example.js 
With model [ { value: 123 } ]
No model []

It'd be very convenient if fhirpath.js could make a "best effort" at resolving "as Quantity" using FHIR conventions, even without any specific model loaded. So looking for foo.bar as Quantity could essentially act like foo.barQuantity even if no model is available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant