Stream: CCDA / FHIR mapping stream
Topic: Where conditions
Jean Duteau (May 09 2018 at 02:26):
I'm slightly confused by the context that exists for where conditions in mapping rules. I want to express a rule like this: for source as srcSection where code.code = "48765-2"
but that doesn't fire. When I trace it in the debugger, it is quite tough to make heads or tails of whether it is supposed to work. I am assuming that the context for my where clause is the initial variable, i.e. source. So this should work when my XML is <section><code code="48765-2" .../>
Grahame Grieve (May 09 2018 at 05:48):
hmm. maybe I could document this better. There's no implicit context for that FHIRPath statement. You need to do where srcSection.code.code
Grahame Grieve (May 09 2018 at 05:48):
you can start with a reference to any of the variables in scope
Jean Duteau (May 09 2018 at 06:42):
hmm, i must still have something wrong:
section: for source.component as component then { body: for component.structuredBody as body then { component: for body.component as component then { allergySection: for component.section as srcSection where srcSection.code.code = "48765-2" make target.section as tgtSection then AllergySection(srcSection, bundle, tgtSection) section: for component.section as srcSection where srcSection.code.code != "48765-2" make target.section as tgtSection then ClinicalDocumentSection(srcSection, tgtSection) } } }
the allergySection rule is always firing even though only one of my sections has a code with 48765-2.
Last updated: Apr 12 2022 at 19:14 UTC