Janus
0.1.1 - ci-build

Janus - Local Development build (v0.1.1) built by the FHIR (HL7® FHIR® Standard) Build Tools. See the Directory of published versions

StructureMap: Transforme une extraction JSON QuestionnaireResponse vers un FHIR SDC QuestionnaireResponse - JSON Representation

Draft as of 2025-10-07

Raw json | Download

{
  "resourceType" : "StructureMap",
  "id" : "StructureMap-QuestionnaireResponse-JSON",
  "text" : {
    "status" : "generated",
    "div" : "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p class=\"res-header-id\"><b>Narratif généré : StructureMap StructureMap-QuestionnaireResponse-JSON</b></p><a name=\"StructureMap-QuestionnaireResponse-JSON\"> </a><a name=\"hcStructureMap-QuestionnaireResponse-JSON\"> </a><pre class=\"fml\">\r\n<b>map</b><span style=\"color: navy\"> &quot;</span>https://www.ghdc.be/StructureMap/StructureMap-QuestionnaireResponse-JSON<span style=\"color: navy\">&quot; = &quot;</span>TransformeQuestionnaireResponseJSONEnQuestionnaireRepsonseFHIRSDC<span style=\"color: navy\">&quot;\r\n\r\n</span><span style=\"color: navy\">// </span><span style=\"color: green\">StructureMap permettant la transformation d'une extraction JSON de QuestionnaireResponse vers le standard FHIR SDC QuestionnaireResponse.</span>\r\n\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span>https://www.ghdc.be<span style=\"color: navy\">&quot; </span><b>alias </b>source <b>as </b><b>source</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/questionnaire.html\" title=\"Questionnaire\">http://hl7.org/fhir/StructureDefinition/Questionnaire</a><span style=\"color: navy\">&quot; </span><b>alias </b>source <b>as </b><b>source</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/uv/sdc/STU3/StructureDefinition-sdc-questionnaireresponse.html\" title=\"SDC Questionnaire Response\">http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaireresponse</a><span style=\"color: navy\">&quot; </span><b>alias </b>target <b>as </b><b>target</b>\r\n\r\n<b>group </b>main<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">source</span><span style=\"color: navy\"> : </span>JSON, <b>source</b> <span style=\"color: maroon\">questionnaire</span><span style=\"color: navy\"> : </span>Questionnaire, <b>target</b> <span style=\"color: maroon\">target</span><span style=\"color: navy\"> : </span>QuestionnaireResponse<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  source.reponses<span style=\"color: navy\"> : </span>JSON<b> as </b><span style=\"color: maroon\">reponses</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    reponses.groupId<span style=\"color: navy\"> : </span>json<b> as </b><span style=\"color: maroon\">groupId</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      target.item<b> as </b><span style=\"color: maroon\">groupItem</span><b> where </b>$this.linkId=%groupId<b> then</b><span style=\"color: navy\"> {\r\n</span>        reponses.questions<span style=\"color: navy\"> : </span>json<b> as </b><span style=\"color: maroon\">question</span><b> then</b><span style=\"color: navy\"> {\r\n</span>          question.questionId<span style=\"color: navy\"> : </span>json<b> as </b><span style=\"color: maroon\">questionId</span><b> then</b><span style=\"color: navy\"> {\r\n</span>            groupItem.item<b> as </b><span style=\"color: maroon\">questionItem</span><b> where </b>$this.linkId=%questionId<b> then</b><span style=\"color: navy\"> {\r\n</span>              questionnaire.item<b> as </b><span style=\"color: maroon\">questionnaireGroupItem</span><b> where </b>$this.linkId=%groupId<b> then</b><span style=\"color: navy\"> {\r\n</span>                questionnaireGroupItem.item<b> as </b><span style=\"color: maroon\">questionnaireQuestionItem</span><b> where </b>$this.linkId=%questionId<b> then</b><span style=\"color: navy\"> {\r\n</span>                  questionnaireQuestionItem.type<b> as </b><span style=\"color: maroon\">questionType</span><b> then</b><span style=\"color: navy\"> {\r\n</span>                    question.reponse<span style=\"color: navy\"> : </span>json<b> as </b><span style=\"color: maroon\">reponse</span><b> then</b><span style=\"color: navy\"> {\r\n</span>                      questionType<b> as </b><span style=\"color: maroon\">questionType</span><b> where </b>($this = 'choice').not() and %reponse.exists()<span style=\"color: navy\"><b> -&gt; </b></span>questionItem.answer[0].value = <b>cast</b><span style=\"color: navy\">(</span><span style=\"color: maroon\">reponse</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">questionType</span><span style=\"color: navy\">)</span> <i>&quot;CastNoChoice&quot;</i><span style=\"color: navy\">;</span>\r\n                      questionType<b> as </b><span style=\"color: maroon\">questionType</span><b> where </b>$this = 'choice' and %reponse.exists()<span style=\"color: navy\"><b> -&gt; </b></span>questionItem.answer[0].value = <b>c</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'http://loinc.org'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">reponse</span><span style=\"color: navy\">)</span> <i>&quot;CastChoice&quot;</i><span style=\"color: navy\">;</span>\r\n                    <span style=\"color: navy\">}</span> <i>&quot;FetchResponse&quot;</i><span style=\"color: navy\">;</span>\r\n                  <span style=\"color: navy\">}</span> <i>&quot;FetchQuestionType&quot;</i><span style=\"color: navy\">;</span>\r\n                <span style=\"color: navy\">}</span> <i>&quot;FindQuestionnaireQuestion&quot;</i><span style=\"color: navy\">;</span>\r\n              <span style=\"color: navy\">}</span> <i>&quot;FindQuestionnaireGroup&quot;</i><span style=\"color: navy\">;</span>\r\n            <span style=\"color: navy\">}</span> <i>&quot;FindQuestion&quot;</i><span style=\"color: navy\">;</span>\r\n          <span style=\"color: navy\">}</span> <i>&quot;QuestionId&quot;</i><span style=\"color: navy\">;</span>\r\n        <span style=\"color: navy\">}</span> <i>&quot;Questions&quot;</i><span style=\"color: navy\">;</span>\r\n      <span style=\"color: navy\">}</span> <i>&quot;FindGroup&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span></pre></div>"
  },
  "url" : "https://www.ghdc.be/StructureMap/StructureMap-QuestionnaireResponse-JSON",
  "version" : "0.1.1",
  "name" : "TransformeQuestionnaireResponseJSONEnQuestionnaireRepsonseFHIRSDC",
  "title" : "Transforme une extraction JSON QuestionnaireResponse vers un FHIR SDC QuestionnaireResponse",
  "status" : "draft",
  "date" : "2025-10-07T10:35:59+02:00",
  "publisher" : "Fyrstain",
  "contact" : [
    {
      "name" : "Fyrstain",
      "telecom" : [
        {
          "system" : "url",
          "value" : "http://fyrstain.com"
        }
      ]
    }
  ],
  "description" : "StructureMap permettant la transformation d'une extraction JSON de QuestionnaireResponse vers le standard FHIR SDC QuestionnaireResponse.",
  "structure" : [
    {
      "url" : "https://www.ghdc.be",
      "mode" : "source",
      "alias" : "source"
    },
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/Questionnaire",
      "mode" : "source",
      "alias" : "source"
    },
    {
      "url" : "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaireresponse",
      "mode" : "target",
      "alias" : "target"
    }
  ],
  "group" : [
    {
      "name" : "main",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "source",
          "type" : "JSON",
          "mode" : "source"
        },
        {
          "name" : "questionnaire",
          "type" : "Questionnaire",
          "mode" : "source"
        },
        {
          "name" : "target",
          "type" : "QuestionnaireResponse",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "reponses",
          "source" : [
            {
              "context" : "source",
              "type" : "JSON",
              "element" : "reponses",
              "variable" : "reponses"
            }
          ],
          "rule" : [
            {
              "name" : "groupId",
              "source" : [
                {
                  "context" : "reponses",
                  "type" : "json",
                  "element" : "groupId",
                  "variable" : "groupId"
                }
              ],
              "rule" : [
                {
                  "name" : "FindGroup",
                  "source" : [
                    {
                      "context" : "target",
                      "element" : "item",
                      "variable" : "groupItem",
                      "condition" : "$this.linkId=%groupId"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "Questions",
                      "source" : [
                        {
                          "context" : "reponses",
                          "type" : "json",
                          "element" : "questions",
                          "variable" : "question"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "QuestionId",
                          "source" : [
                            {
                              "context" : "question",
                              "type" : "json",
                              "element" : "questionId",
                              "variable" : "questionId"
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "FindQuestion",
                              "source" : [
                                {
                                  "context" : "groupItem",
                                  "element" : "item",
                                  "variable" : "questionItem",
                                  "condition" : "$this.linkId=%questionId"
                                }
                              ],
                              "rule" : [
                                {
                                  "name" : "FindQuestionnaireGroup",
                                  "source" : [
                                    {
                                      "context" : "questionnaire",
                                      "element" : "item",
                                      "variable" : "questionnaireGroupItem",
                                      "condition" : "$this.linkId=%groupId"
                                    }
                                  ],
                                  "rule" : [
                                    {
                                      "name" : "FindQuestionnaireQuestion",
                                      "source" : [
                                        {
                                          "context" : "questionnaireGroupItem",
                                          "element" : "item",
                                          "variable" : "questionnaireQuestionItem",
                                          "condition" : "$this.linkId=%questionId"
                                        }
                                      ],
                                      "rule" : [
                                        {
                                          "name" : "FetchQuestionType",
                                          "source" : [
                                            {
                                              "context" : "questionnaireQuestionItem",
                                              "element" : "type",
                                              "variable" : "questionType"
                                            }
                                          ],
                                          "rule" : [
                                            {
                                              "name" : "FetchResponse",
                                              "source" : [
                                                {
                                                  "context" : "question",
                                                  "type" : "json",
                                                  "element" : "reponse",
                                                  "variable" : "reponse"
                                                }
                                              ],
                                              "rule" : [
                                                {
                                                  "name" : "CastNoChoice",
                                                  "source" : [
                                                    {
                                                      "context" : "questionType",
                                                      "variable" : "questionType",
                                                      "condition" : "($this = 'choice').not() and %reponse.exists()"
                                                    }
                                                  ],
                                                  "target" : [
                                                    {
                                                      "context" : "questionItem",
                                                      "contextType" : "variable",
                                                      "element" : "answer[0].value",
                                                      "transform" : "cast",
                                                      "parameter" : [
                                                        {
                                                          "valueId" : "reponse"
                                                        },
                                                        {
                                                          "valueId" : "questionType"
                                                        }
                                                      ]
                                                    }
                                                  ]
                                                },
                                                {
                                                  "name" : "CastChoice",
                                                  "source" : [
                                                    {
                                                      "context" : "questionType",
                                                      "variable" : "questionType",
                                                      "condition" : "$this = 'choice' and %reponse.exists()"
                                                    }
                                                  ],
                                                  "target" : [
                                                    {
                                                      "context" : "questionItem",
                                                      "contextType" : "variable",
                                                      "element" : "answer[0].value",
                                                      "transform" : "c",
                                                      "parameter" : [
                                                        {
                                                          "valueString" : "http://loinc.org"
                                                        },
                                                        {
                                                          "valueId" : "reponse"
                                                        }
                                                      ]
                                                    }
                                                  ]
                                                }
                                              ]
                                            }
                                          ]
                                        }
                                      ]
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}