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

Extension.value is a DataType, and using it will raise errors. #200

Closed
ewoutkramer opened this issue Feb 23, 2024 · 2 comments
Closed

Extension.value is a DataType, and using it will raise errors. #200

ewoutkramer opened this issue Feb 23, 2024 · 2 comments

Comments

@ewoutkramer
Copy link
Member

Caveat: I haven't fully researched this one, but it seems to me that choice types are again the culprit here:

  Patient.ethnicity E
    return Tuple {
      codes: { E.ombCategory } union E.detailed,
      display: E.text
    }

In this fragment from CMS SupplementalDataElements.cql, we see E.ethnicity and E.ombCategory, which are aliases for an extension defined in QICore. The value of an Extension (in our POCO model) is DataType, and somewhere along the line, when these extension values are used, we are getting an invalid cast from DataType to string (for display).

I have for now added a new cast that will cast a DataType to type string when a string is expected. This might actually work, since the CQL->ELM compiler has already checked that the assignment is valid, so we might as well assume it is.

@ewoutkramer
Copy link
Member Author

Added another cast from DataType to CqlInterval that will work when the datatype is a period.

@ewoutkramer
Copy link
Member Author

In general, the FHIR TypeConverter is the place to know that DataType actually means: a choice type from the underlying model. So it is its responsibility to try to convert (with as) a DataType to one of its subclasses (or return null otherwise).

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

No branches or pull requests

1 participant