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

patientBirthDatePropertyName marked as deprecated but still required for SystemFunctionResolver #1400

Open
Zylox opened this issue Aug 14, 2024 · 0 comments

Comments

@Zylox
Copy link

Zylox commented Aug 14, 2024

Some time ago, 7b8f435 marked patientBirthDatePropertyName as deprecated within the modelinfo schema.

As such, i would expect to be able to omit it from the model info header if i define the patient context in my model info:

    <ns4:contextInfo name="Patient" keyElement="id" birthDateElement="birthDatetime">
        <ns4:contextType modelName="Example" name="Patient"/>
    </ns4:contextInfo>

Compiled against cql like this:

library example_1

using Example

context Patient

define "patients":
    AgeInYears() > 18

I would expect success.

However i get this instead

Error:[8:5, 8:16] Cannot invoke "String.indexOf(int)" because "birthDateProperty" is null

The problem seems to lie in this snippet here:

Expression source = builder.resolveIdentifier("Patient", true);
String birthDateProperty = builder.getDefaultModel().getModelInfo().getPatientBirthDatePropertyName();

This code is still looking specifically at the information in the modelinfo header.

The "simple" fix seems like it would be to call getContextInfo() and retrieve the birthDateElement from one of the contexts returned. That would require it to be context aware to work properly, i think. Which is not information that i see readily available to the class right now.

Looking at the cql spec here: https://cql.hl7.org/07-physicalrepresentation.html
i do see a clause that seems to describe an alternate behavior to what is happening here, under "Context Information":

For patient contexts, Patient Birth Date information must be supplied as well to allow the CQL-to-ELM translator to render references to patient-age-related functions (AgeInYears, AgeInYearsAt, etc.) into the non-patient-aware age-related functions in ELM (CalculateAgeInYears, CalculateAgeInYearsAt, etc.). This information is not required, but if it is not present, references to patient-age-related functions will be passed directly through to ELM as FunctionRefs.

I'm fairly green to the project, i fully admit i could be missing something, but i couldnt find any reference to this elsewhere so im logging this for at least a discussion/explanation of it.

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