Structured Data Capture
3.0.0 - STU 3 International flag

This page is part of the Structured Data Capture FHIR IG (v3.0.0: STU 3) based on FHIR R4. This is the current published version in its permanent home (it will always be available at this URL). For a full list of available versions, see the Directory of published versions

: SDC Map population StructureMap example - JSON Representation

Page standards status: Informative

Raw json | Download


{
  "resourceType" : "StructureMap",
  "id" : "questionnaire-population-transform",
  "text" : {
    "status" : "generated",
    "div" : "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p><b>Generated Narrative</b></p><div style=\"display: inline-block; background-color: #d9e0e7; padding: 6px; margin: 4px; border: 1px solid #8da1b4; border-radius: 5px; line-height: 60%\"><p style=\"margin-bottom: 0px\">Resource \"questionnaire-population-transform\" </p></div><p><b>url</b>: <code>http://hl7.org/fhir/uv/sdc/StructureMap/questionnaire-population-transform</code></p><p><b>version</b>: 3.0.0</p><p><b>name</b>: QuestionnairePopulationTransform</p><p><b>title</b>: Questionnaire Population Transform</p><p><b>status</b>: draft</p><p><b>experimental</b>: true</p><p><b>date</b>: 2022-03-08 06:33:14+0000</p><p><b>publisher</b>: HL7 International - FHIR Infrastructure Work Group</p><p><b>contact</b>: <a href=\"http://hl7.org/Special/committees/fiwg\">http://hl7.org/Special/committees/fiwg</a></p><p><b>description</b>: Sample stricture map showing process for auto-populating a QuestionnaireResponse from a query bundle</p><p><b>jurisdiction</b>: World <span style=\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\"> (m49.htm#001)</span></p><blockquote><p><b>structure</b></p><p><b>url</b>: <a href=\"http://hl7.org/fhir/R4/bundle.html\">Bundle</a></p><p><b>mode</b>: source</p></blockquote><blockquote><p><b>structure</b></p><p><b>url</b>: <a href=\"http://hl7.org/fhir/R4/questionnaireresponse.html\">QuestionnaireResponse</a></p><p><b>mode</b>: target</p></blockquote><blockquote><p><b>group</b></p><p><b>name</b>: main</p><p><b>typeMode</b>: none</p><blockquote><p><b>input</b></p><p><b>name</b>: src</p><p><b>type</b>: Bundle</p><p><b>mode</b>: source</p></blockquote><blockquote><p><b>input</b></p><p><b>name</b>: qr</p><p><b>type</b>: QuestionnaireResponse</p><p><b>mode</b>: target</p></blockquote><blockquote><p><b>rule</b></p><p><b>name</b>: questionnaire</p><h3>Sources</h3><table class=\"grid\"><tr><td>-</td><td><b>Context</b></td></tr><tr><td>*</td><td>src</td></tr></table><blockquote><p><b>target</b></p><p><b>context</b>: qr</p><p><b>contextType</b>: variable</p><p><b>element</b>: questionnaire</p><p><b>transform</b>: copy</p><h3>Parameters</h3><table class=\"grid\"><tr><td>-</td><td><b>Value[x]</b></td></tr><tr><td>*</td><td>http://hl7.org/fhir/uv/sdc/Questionnaire/questionnaire-sdc-test-fhirpath-prepop-source-query</td></tr></table></blockquote></blockquote><blockquote><p><b>rule</b></p><p><b>name</b>: status</p><h3>Sources</h3><table class=\"grid\"><tr><td>-</td><td><b>Context</b></td></tr><tr><td>*</td><td>src</td></tr></table><blockquote><p><b>target</b></p><p><b>context</b>: qr</p><p><b>contextType</b>: variable</p><p><b>element</b>: status</p><p><b>transform</b>: copy</p><h3>Parameters</h3><table class=\"grid\"><tr><td>-</td><td><b>Value[x]</b></td></tr><tr><td>*</td><td>in-progress</td></tr></table></blockquote></blockquote><blockquote><p><b>rule</b></p><p><b>name</b>: authored</p><h3>Sources</h3><table class=\"grid\"><tr><td>-</td><td><b>Context</b></td></tr><tr><td>*</td><td>src</td></tr></table><blockquote><p><b>target</b></p><p><b>context</b>: qr</p><p><b>contextType</b>: variable</p><p><b>element</b>: authored</p><p><b>transform</b>: evaluate</p><h3>Parameters</h3><table class=\"grid\"><tr><td>-</td><td><b>Value[x]</b></td></tr><tr><td>*</td><td>now()</td></tr></table></blockquote></blockquote><blockquote><p><b>rule</b></p><p><b>name</b>: subject</p><h3>Sources</h3><table class=\"grid\"><tr><td>-</td><td><b>Context</b></td><td><b>Element</b></td><td><b>ListMode</b></td><td><b>Variable</b></td></tr><tr><td>*</td><td>src</td><td>entry</td><td>first</td><td>patient</td></tr></table><blockquote><p><b>target</b></p><p><b>context</b>: qr</p><p><b>contextType</b>: variable</p><p><b>element</b>: subject</p><p><b>variable</b>: subject</p></blockquote><blockquote><p><b>target</b></p><p><b>context</b>: subject</p><p><b>contextType</b>: variable</p><p><b>element</b>: reference</p><p><b>transform</b>: evaluate</p><h3>Parameters</h3><table class=\"grid\"><tr><td>-</td><td><b>Value[x]</b></td></tr><tr><td>*</td><td>patient.resource.entry.fullUrl</td></tr></table></blockquote></blockquote><blockquote><p><b>rule</b></p><p><b>name</b>: grp</p><h3>Sources</h3><table class=\"grid\"><tr><td>-</td><td><b>Context</b></td></tr><tr><td>*</td><td>src</td></tr></table><blockquote><p><b>target</b></p><p><b>context</b>: qr</p><p><b>contextType</b>: variable</p><p><b>element</b>: item</p><p><b>variable</b>: grp</p></blockquote><blockquote><p><b>target</b></p><p><b>context</b>: grp</p><p><b>contextType</b>: variable</p><p><b>element</b>: linkId</p><p><b>transform</b>: copy</p><h3>Parameters</h3><table class=\"grid\"><tr><td>-</td><td><b>Value[x]</b></td></tr><tr><td>*</td><td>grp</td></tr></table></blockquote><blockquote><p><b>rule</b></p><p><b>name</b>: part-details</p></blockquote><blockquote><p><b>rule</b></p><p><b>name</b>: meds</p></blockquote></blockquote></blockquote></div>"
  },
  "url" : "http://hl7.org/fhir/uv/sdc/StructureMap/questionnaire-population-transform",
  "version" : "3.0.0",
  "name" : "QuestionnairePopulationTransform",
  "title" : "Questionnaire Population Transform",
  "status" : "draft",
  "experimental" : true,
  "date" : "2022-03-08T18:33:14+00:00",
  "publisher" : "HL7 International - FHIR Infrastructure Work Group",
  "contact" : [
    {
      "telecom" : [
        {
          "system" : "url",
          "value" : "http://hl7.org/Special/committees/fiwg"
        }
      ]
    }
  ],
  "description" : "Sample stricture map showing process for auto-populating a QuestionnaireResponse from a query bundle",
  "jurisdiction" : [
    {
      "coding" : [
        {
          "system" : "http://unstats.un.org/unsd/methods/m49/m49.htm",
          "code" : "001"
        }
      ]
    }
  ],
  "structure" : [
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/Bundle",
      "mode" : "source"
    },
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse",
      "mode" : "target"
    }
  ],
  "group" : [
    {
      "name" : "main",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "Bundle",
          "mode" : "source"
        },
        {
          "name" : "qr",
          "type" : "QuestionnaireResponse",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "questionnaire",
          "source" : [
            {
              "context" : "src"
            }
          ],
          "target" : [
            {
              "context" : "qr",
              "contextType" : "variable",
              "element" : "questionnaire",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "http://hl7.org/fhir/uv/sdc/Questionnaire/questionnaire-sdc-test-fhirpath-prepop-source-query"
                }
              ]
            }
          ]
        },
        {
          "name" : "status",
          "source" : [
            {
              "context" : "src"
            }
          ],
          "target" : [
            {
              "context" : "qr",
              "contextType" : "variable",
              "element" : "status",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "in-progress"
                }
              ]
            }
          ]
        },
        {
          "name" : "authored",
          "source" : [
            {
              "context" : "src"
            }
          ],
          "target" : [
            {
              "context" : "qr",
              "contextType" : "variable",
              "element" : "authored",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "now()"
                }
              ]
            }
          ]
        },
        {
          "name" : "subject",
          "source" : [
            {
              "context" : "src",
              "element" : "entry",
              "listMode" : "first",
              "variable" : "patient"
            }
          ],
          "target" : [
            {
              "context" : "qr",
              "contextType" : "variable",
              "element" : "subject",
              "variable" : "subject"
            },
            {
              "context" : "subject",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "patient.resource.entry.fullUrl"
                }
              ]
            }
          ]
        },
        {
          "name" : "grp",
          "source" : [
            {
              "context" : "src"
            }
          ],
          "target" : [
            {
              "context" : "qr",
              "contextType" : "variable",
              "element" : "item",
              "variable" : "grp"
            },
            {
              "context" : "grp",
              "contextType" : "variable",
              "element" : "linkId",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "grp"
                }
              ]
            }
          ],
          "rule" : [
            {
              "name" : "part-details",
              "source" : [
                {
                  "context" : "src"
                }
              ],
              "target" : [
                {
                  "context" : "grp",
                  "contextType" : "variable",
                  "element" : "item",
                  "variable" : "partDetails"
                },
                {
                  "context" : "partDetails",
                  "contextType" : "variable",
                  "element" : "linkId",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "part-details"
                    }
                  ]
                }
              ],
              "rule" : [
                {
                  "name" : "patientDetails",
                  "source" : [
                    {
                      "context" : "src",
                      "element" : "entry",
                      "listMode" : "first",
                      "variable" : "patient"
                    }
                  ],
                  "target" : [
                    {
                      "contextType" : "variable",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueId" : "partDetails"
                        }
                      ]
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "participantId",
                      "source" : [
                        {
                          "context" : "patient",
                          "element" : "resource",
                          "variable" : "patientRes"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "partDetails",
                          "contextType" : "variable",
                          "element" : "item",
                          "variable" : "participantId"
                        },
                        {
                          "context" : "participantId",
                          "contextType" : "variable",
                          "element" : "linkId",
                          "transform" : "copy",
                          "parameter" : [
                            {
                              "valueString" : "participant-id"
                            }
                          ]
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "participantIdValue",
                          "source" : [
                            {
                              "context" : "patientRes",
                              "element" : "entry",
                              "variable" : "patientResEntry"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "participantId",
                              "contextType" : "variable",
                              "element" : "answer",
                              "variable" : "participantIdAnswer"
                            },
                            {
                              "context" : "participantIdAnswer",
                              "contextType" : "variable",
                              "element" : "value",
                              "transform" : "evaluate",
                              "parameter" : [
                                {
                                  "valueString" : "patientResEntry.resource.id"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "familyName",
                      "source" : [
                        {
                          "context" : "patient",
                          "element" : "resource",
                          "variable" : "patientRes"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "partDetails",
                          "contextType" : "variable",
                          "element" : "item",
                          "variable" : "familyName"
                        },
                        {
                          "context" : "familyName",
                          "contextType" : "variable",
                          "element" : "linkId",
                          "transform" : "copy",
                          "parameter" : [
                            {
                              "valueString" : "family-name"
                            }
                          ]
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "familyNameValue",
                          "source" : [
                            {
                              "context" : "patientRes",
                              "element" : "entry",
                              "variable" : "patientResEntry"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "familyName",
                              "contextType" : "variable",
                              "element" : "answer",
                              "variable" : "familyNameAnswer"
                            },
                            {
                              "context" : "familyNameAnswer",
                              "contextType" : "variable",
                              "element" : "value",
                              "transform" : "evaluate",
                              "parameter" : [
                                {
                                  "valueString" : "patientResEntry.resource.name.first().family"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "familyName",
                      "source" : [
                        {
                          "context" : "patient",
                          "element" : "resource",
                          "variable" : "patientRes"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "partDetails",
                          "contextType" : "variable",
                          "element" : "item",
                          "variable" : "givenName"
                        },
                        {
                          "context" : "givenName",
                          "contextType" : "variable",
                          "element" : "linkId",
                          "transform" : "copy",
                          "parameter" : [
                            {
                              "valueString" : "given-name"
                            }
                          ]
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "givenNameValue",
                          "source" : [
                            {
                              "context" : "patientRes",
                              "element" : "entry",
                              "variable" : "patientResEntry"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "givenName",
                              "contextType" : "variable",
                              "element" : "answer",
                              "variable" : "givenNameAnswer"
                            },
                            {
                              "context" : "givenNameAnswer",
                              "contextType" : "variable",
                              "element" : "value",
                              "transform" : "evaluate",
                              "parameter" : [
                                {
                                  "valueString" : "patientResEntry.resource.name.first().given.aggregate(iif($total.empty(), $this, $total & ' ' & $this))"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "familyName",
                      "source" : [
                        {
                          "context" : "patient",
                          "element" : "resource",
                          "variable" : "patientRes"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "partDetails",
                          "contextType" : "variable",
                          "element" : "item",
                          "variable" : "dob"
                        },
                        {
                          "context" : "dob",
                          "contextType" : "variable",
                          "element" : "linkId",
                          "transform" : "copy",
                          "parameter" : [
                            {
                              "valueString" : "dob"
                            }
                          ]
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "dobValue",
                          "source" : [
                            {
                              "context" : "patientRes",
                              "element" : "entry",
                              "variable" : "patientResEntry"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "dob",
                              "contextType" : "variable",
                              "element" : "answer",
                              "variable" : "dobAnswer"
                            },
                            {
                              "context" : "dobAnswer",
                              "contextType" : "variable",
                              "element" : "value",
                              "transform" : "evaluate",
                              "parameter" : [
                                {
                                  "valueString" : "patientResEntry.resource.birthDate"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "condition-count",
                  "source" : [
                    {
                      "context" : "src",
                      "element" : "entry",
                      "variable" : "conditions",
                      "condition" : "(resource.link.url.contains('/Condition?'))"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "partDetails",
                      "contextType" : "variable",
                      "element" : "item",
                      "variable" : "conditionItem"
                    },
                    {
                      "context" : "conditionItem",
                      "contextType" : "variable",
                      "element" : "linkId",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "condition-count"
                        }
                      ]
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "conditionCountAnswer",
                      "source" : [
                        {
                          "context" : "conditions"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "conditionItem",
                          "contextType" : "variable",
                          "element" : "answer",
                          "variable" : "conditionCountAnswer"
                        },
                        {
                          "context" : "conditionCountAnswer",
                          "contextType" : "variable",
                          "element" : "value",
                          "transform" : "evaluate",
                          "parameter" : [
                            {
                              "valueString" : "conditions.resource.entry.count()"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name" : "meds",
              "source" : [
                {
                  "context" : "src",
                  "element" : "entry",
                  "variable" : "medications",
                  "condition" : "(resource.link.url.contains('/MedicationStatement?'))"
                }
              ],
              "target" : [
                {
                  "contextType" : "variable",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueId" : "grp"
                    }
                  ]
                }
              ],
              "rule" : [
                {
                  "name" : "medEntry",
                  "source" : [
                    {
                      "context" : "medications",
                      "element" : "resource",
                      "variable" : "medRes"
                    }
                  ],
                  "target" : [
                    {
                      "contextType" : "variable",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueId" : "grp"
                        }
                      ]
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "medItem",
                      "source" : [
                        {
                          "context" : "medRes",
                          "element" : "entry",
                          "variable" : "med",
                          "condition" : "(resource is MedicationStatement)"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "grp",
                          "contextType" : "variable",
                          "element" : "item",
                          "variable" : "medsItem"
                        },
                        {
                          "context" : "medsItem",
                          "contextType" : "variable",
                          "element" : "linkId",
                          "transform" : "copy",
                          "parameter" : [
                            {
                              "valueString" : "meds"
                            }
                          ]
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "medsName",
                          "source" : [
                            {
                              "context" : "med",
                              "element" : "resource",
                              "variable" : "medResource"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "medsItem",
                              "contextType" : "variable",
                              "element" : "item",
                              "variable" : "medsName"
                            },
                            {
                              "context" : "medsName",
                              "contextType" : "variable",
                              "element" : "linkId",
                              "transform" : "copy",
                              "parameter" : [
                                {
                                  "valueString" : "meds-name"
                                }
                              ]
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "medsNameAnswer",
                              "source" : [
                                {
                                  "context" : "medResource",
                                  "element" : "medication",
                                  "variable" : "medMedication"
                                }
                              ],
                              "target" : [
                                {
                                  "context" : "medsName",
                                  "contextType" : "variable",
                                  "element" : "answer",
                                  "variable" : "medsNameAnswer"
                                },
                                {
                                  "context" : "medsNameAnswer",
                                  "contextType" : "variable",
                                  "element" : "value",
                                  "transform" : "evaluate",
                                  "parameter" : [
                                    {
                                      "valueString" : "medMedication.select(iif(text, text, coding.display.first()))"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name" : "medsStatus",
                          "source" : [
                            {
                              "context" : "med",
                              "element" : "resource",
                              "variable" : "medResource"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "medsItem",
                              "contextType" : "variable",
                              "element" : "item",
                              "variable" : "medsStatus"
                            },
                            {
                              "context" : "medsStatus",
                              "contextType" : "variable",
                              "element" : "linkId",
                              "transform" : "copy",
                              "parameter" : [
                                {
                                  "valueString" : "med-status"
                                }
                              ]
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "medsStatusAnswer",
                              "source" : [
                                {
                                  "context" : "medResource",
                                  "variable" : "medsMedication"
                                }
                              ],
                              "target" : [
                                {
                                  "context" : "medsStatus",
                                  "contextType" : "variable",
                                  "element" : "answer",
                                  "variable" : "medsStatusAnswer"
                                },
                                {
                                  "context" : "medsStatusAnswer",
                                  "contextType" : "variable",
                                  "element" : "value",
                                  "transform" : "evaluate",
                                  "parameter" : [
                                    {
                                      "valueString" : "medResource.status"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name" : "medsCategory",
                          "source" : [
                            {
                              "context" : "med",
                              "element" : "resource",
                              "variable" : "medResource",
                              "condition" : "(category.coding.where(system = 'http://terminology.hl7.org/CodeSystem/medicationrequest-category').exists())"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "medsItem",
                              "contextType" : "variable",
                              "element" : "item",
                              "variable" : "medsCategory"
                            },
                            {
                              "context" : "medsCategory",
                              "contextType" : "variable",
                              "element" : "linkId",
                              "transform" : "copy",
                              "parameter" : [
                                {
                                  "valueString" : "meds-category"
                                }
                              ]
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "medsCategoryAnswer",
                              "source" : [
                                {
                                  "context" : "medResource"
                                }
                              ],
                              "target" : [
                                {
                                  "context" : "medsCategory",
                                  "contextType" : "variable",
                                  "element" : "answer",
                                  "variable" : "medsCategoryAnswer"
                                },
                                {
                                  "context" : "medsCategoryAnswer",
                                  "contextType" : "variable",
                                  "element" : "value",
                                  "transform" : "evaluate",
                                  "parameter" : [
                                    {
                                      "valueString" : "medResource.category.coding.where(system = 'http://terminology.hl7.org/CodeSystem/medicationrequest-category').code.aggregate(iif($total.empty(), $this, $total & ' ' & $this))"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}