FHIR Chat · FHIRPath SDC example · questionnaire

Stream: questionnaire

Topic: FHIRPath SDC example


view this post on Zulip Tilo Christ (Aug 29 2021 at 07:36):

I am working with @Grey Faulkenberry to implement FHIRPath support into a questionnaire filler. I am trying to get the following SDC example to work: http://build.fhir.org/ig/HL7/sdc/examples.html#using-enablewhen-enablebehavior-and-enablewhenexpression . I have 2 questions:

  1. am I right in assuming that "repeats" is a typo and it should be repeat (no trailing s)?
  2. is there any kind of implicit / polymorphism etc. specified behavior that should allow "answer.toString()" to work as in the example, or should it be "answer.valueDate.toString()"?

I am essentially trying to understand whether our code is broken, or the example is incorrect.

view this post on Zulip Jose Costa Teixeira (Aug 29 2021 at 08:05):

which repeats would be a typo?

view this post on Zulip Jose Costa Teixeira (Aug 29 2021 at 08:13):

the one in expression seems a typo indeed

view this post on Zulip Tilo Christ (Aug 29 2021 at 09:26):

I am referring to this overall expression "expression": "%resource.repeats(item).where(linkId='4.2.b.1').answer.valueCoding.code ='female' and today().toString().substring(0, 4).toInteger() - %resource.repeats(item).where(linkId='4.2.b.5').answer.toString().substring(0, 4).toInteger() >= 40"
It has repeats(item) in it two times.

My second question is referring to the second half of the example where it says .answer.toString().

view this post on Zulip Jose Costa Teixeira (Aug 29 2021 at 10:32):

I think you are correct in assuming there are 2 issues with the documentation.
I don't know about the implicit casting, and I don0t find it in FHIRPath. The repeats seems a typo. I think the expression should be

%resource.repeat(item).where(linkId='4.2.b.1').answer.valueCoding.code ='female'
and (today().toString().substring(0, 4).toInteger() - %resource.repeat(item).where(linkId='4.2.b.5').answer.valueDate.toString().substring(0, 4).toInteger() >= 40)

view this post on Zulip Jose Costa Teixeira (Aug 29 2021 at 11:03):

Can others confirm please?
repeats does not exist in fhirpath, should be repeat. And answer.toString does not resolve, should be answer.valueDate.toString

view this post on Zulip Brian Postlethwaite (Aug 29 2021 at 11:21):

answer.valueString is not correct either, it is answer.value

view this post on Zulip Brian Postlethwaite (Aug 29 2021 at 11:22):

And you can add .toString() to that also.

view this post on Zulip Brian Postlethwaite (Aug 29 2021 at 11:24):

Check the fhirpath spec for how polymorphic types are defined here
http://hl7.org/fhirpath/#paths-and-polymorphic-items

view this post on Zulip Tilo Christ (Aug 29 2021 at 15:06):

so from this very compact spec, am I right in assuming that only the field name as specified for the choice is valid (if the FHIR spec says fieldname[x], then I can only use .fieldname, but not .fieldnameString? So the fully correct example would be %resource.repeat(item).where(linkId='4.2.b.1').answer.value.code ='female' and today().toString().substring(0, 4).toInteger() - %resource.repeat(item).where(linkId='4.2.b.5').answer.value.toString().substring(0, 4).toInteger() >= 40?

view this post on Zulip Jose Costa Teixeira (Aug 29 2021 at 15:17):

both resolve (according to https://hl7.github.io/fhirpath.js/):
answer.value and answer.valueDate.toString()

view this post on Zulip Tilo Christ (Aug 29 2021 at 15:25):

But I am wondering whether the latter "valueDate" is merely a side-effect of the JavaScript/JSON based implementation, or should really resolve according to spec.

view this post on Zulip Lloyd McKenzie (Aug 29 2021 at 16:08):

valueDate used to be allowed. It's not officially allowed any longer, though some of the tool stacks still support it. Can you submit a change request for us to fix the SDC example?

view this post on Zulip Tilo Christ (Aug 29 2021 at 16:25):

my favourite pastime on a rainy Sunday: https://jira.hl7.org/browse/FHIR-33262

view this post on Zulip Jose Costa Teixeira (Aug 29 2021 at 16:26):

Tilo Christ said:

my favourite pastime on a rainy Sunday: https://jira.hl7.org/browse/FHIR-33262

there are worse pastimes... :)

view this post on Zulip Jose Costa Teixeira (Aug 29 2021 at 16:26):

does LHCForms support enableWhenExpression?

view this post on Zulip Jose Costa Teixeira (Aug 29 2021 at 16:27):

@Paul Lynch

view this post on Zulip Paul Lynch (Aug 30 2021 at 13:55):

Not yet, but I am hoping to get started on it this week. I don't think it will be hard it add. I just need to get some time to work on it.

view this post on Zulip Jose Costa Teixeira (Aug 30 2021 at 15:44):

thank you

view this post on Zulip Paul Lynch (Sep 07 2021 at 20:42):

Jose Costa Teixeira said:

does LHCForms support enableWhenExpression?

Just published LHC-Forms 29.3.0 with enableWhenExpression support.


Last updated: Apr 12 2022 at 19:14 UTC