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

Equivalent between FHIR.AdministrativeGender System.Code #448

Open
alexanderkiel opened this issue Aug 20, 2019 · 2 comments
Open

Equivalent between FHIR.AdministrativeGender System.Code #448

alexanderkiel opened this issue Aug 20, 2019 · 2 comments

Comments

@alexanderkiel
Copy link

I have the following Library which translated with elm-to-cql v1.3.15 but doesn't in v1.4.6:

library Retrieve
using FHIR version '4.0.0'
include FHIRHelpers version '4.0.0'
       
codesystem gender: 'http://hl7.org/fhir/administrative-gender'
       
context Patient
       
define InInitialPopulation:
  Patient.gender ~ Code 'male' from gender

The error is:

Could not resolve call to operator Equivalent with signature (FHIR.AdministrativeGender,System.Code).

I know that the type checks are stricter in v1.4.x but shouldn't is possible to compare codes directly? I know that ToString works like in this library:

library Retrieve
using FHIR version '4.0.0'
include FHIRHelpers version '4.0.0'

context Patient

define InInitialPopulation:
  Patient.gender = 'male'

But than I only compare the code value and not the code + system.

Also this example from the Authors Guide translates:

library Retrieve
using FHIR version '4.0.0'
include FHIRHelpers version '4.0.0'

valueset "Female Administrative Sex": 'urn:oid:2.16.840.1.113883.3.560.100.2'

context Patient

define InInitialPopulation:
  Patient.gender in "Female Administrative Sex"

But in the ELM, I see that ToString is called on gender although the type of the value set ref is List(System.Code). How is the InValueSet Operator supposed to compare strings with codes?

At the end, why is FHIR.AdministrativeGender at type at all? Are there types for codes from most common code systems or has it something to do with the ValueSet binding of Patient.gender? If all codes would have just the type System.Code, comparison would be easy.

@alexanderkiel
Copy link
Author

I made one observation: It is possible to compare a FHIR.Coding with a System.Code because an implicit type conversion with the function ToCode is made. So Patient.gender isn't a FHIR.Coding but it would be possible to have an overload of ToCode for FHIR.AdministrativeGender.

Now I also understand why FHIR.AdministrativeGender is it's own type. Because in FHIR the code type doesn't carry any code system information. The standalone code-typed data elements can only be interpreted using the value set binding. In my server, I resolve such codes like in Patient.gender to an actual coding at data ingest and safe a reference to that coding in my database. So actually I have the full coding information for all Patient.gender values and can compare them with another codings.

In the FHIR models for CQL, there is really a separate type for each of the code-typed data elements? How can I extend the model if a use my own code-typed data elements say in an extension?

@brynrhodes
Copy link
Member

With apologies for the extreme delay here, there is active work on tooling to produce "profile-informed model info" for CQL: https://github.com/cqframework/cqf-tooling/tree/master/src/main/java/org/opencds/cqf/tooling/modelinfo

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

2 participants