StructureMap-QuestionnaireResponse-JSON
type: StructureMap
node role: treeRoot
id:
  v: StructureMap-QuestionnaireResponse-JSON
text:
  status:
    v: generated
  div: Narratif généré : StructureMap StructureMap-QuestionnaireResponse-JSON #xD; map "https://www.ghdc.be/StructureMap/StructureMap-QuestionnaireResponse-JSON" = "TransformeQuestionnaireResponseJSONEnQuestionnaireRepsonseFHIRSDC"#xD; #xD; // StructureMap permettant la transformation d'une extraction JSON de QuestionnaireResponse vers le standard FHIR SDC QuestionnaireResponse.#xD; #xD; uses "https://www.ghdc.be" alias source as source#xD; uses "http://hl7.org/fhir/StructureDefinition/Questionnaire" alias source as source#xD; uses "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaireresponse" alias target as target#xD; #xD; group main(source source : JSON, source questionnaire : Questionnaire, target target : QuestionnaireResponse) {#xD; source.reponses : JSON as reponses then {#xD; reponses.groupId : json as groupId then {#xD; target.item as groupItem where $this.linkId=%groupId then {#xD; reponses.questions : json as question then {#xD; question.questionId : json as questionId then {#xD; groupItem.item as questionItem where $this.linkId=%questionId then {#xD; questionnaire.item as questionnaireGroupItem where $this.linkId=%groupId then {#xD; questionnaireGroupItem.item as questionnaireQuestionItem where $this.linkId=%questionId then {#xD; questionnaireQuestionItem.type as questionType then {#xD; question.reponse : json as reponse then {#xD; questionType as questionType where ($this = 'choice').not() and %reponse.exists() -> questionItem.answer[0].value = cast(reponse, questionType) "CastNoChoice";#xD; questionType as questionType where $this = 'choice' and %reponse.exists() -> questionItem.answer[0].value = c('http://loinc.org', reponse) "CastChoice";#xD; } "FetchResponse";#xD; } "FetchQuestionType";#xD; } "FindQuestionnaireQuestion";#xD; } "FindQuestionnaireGroup";#xD; } "FindQuestion";#xD; } "QuestionId";#xD; } "Questions";#xD; } "FindGroup";#xD; };#xD; };#xD; }#xD; #xD;
url:
  v: https://www.ghdc.be/StructureMap/StructureMap-QuestionnaireResponse-JSON
version:
  v: 0.1.1
name:
  v: TransformeQuestionnaireResponseJSONEnQuestionnaireRepsonseFHIRSDC
title:
  v: Transforme une extraction JSON QuestionnaireResponse vers un FHIR SDC QuestionnaireResponse
status:
  v: draft
date:
  v: 2025-10-07T10:35:59+02:00
publisher:
  v: Fyrstain
contact:
  name:
    v: Fyrstain
  telecom:
    system:
      v: url
    value:
      v: http://fyrstain.com
description:
  v: StructureMap permettant la transformation d'une extraction JSON de QuestionnaireResponse vers le standard FHIR SDC QuestionnaireResponse.
structure:
  url:
    v: https://www.ghdc.be
    link: https://www.ghdc.be
  mode:
    v: source
  alias:
    v: source
structure:
  url:
    v: http://hl7.org/fhir/StructureDefinition/Questionnaire
    link: http://hl7.org/fhir/StructureDefinition/Questionnaire
  mode:
    v: source
  alias:
    v: source
structure:
  url:
    v: http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaireresponse
    link: http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaireresponse
  mode:
    v: target
  alias:
    v: target
group:
  name:
    v: main
  type mode:
    v: none
  input:
    name:
      v: source
    type:
      v: JSON
    mode:
      v: source
  input:
    name:
      v: questionnaire
    type:
      v: Questionnaire
    mode:
      v: source
  input:
    name:
      v: target
    type:
      v: QuestionnaireResponse
    mode:
      v: target
  rule:
    name:
      v: reponses
    source:
      context:
        v: source
      type:
        v: JSON
      element:
        v: reponses
      variable:
        v: reponses
    rule:
      name:
        v: groupId

v: reponses

v: json

v: groupId

v: groupId

v: FindGroup

context:
  v: target
element:
  v: item
variable:
  v: groupItem
condition:
  v: $this.linkId=%groupId

name:
  v: Questions
source:
  context:
    v: reponses
  type:
    v: json
  element:
    v: questions
  variable:
    v: question
rule:
  name:
    v: QuestionId
  source:
    context:
      v: question
    type:
      v: json
    element:
      v: questionId
    variable:
      v: questionId
  rule:
    name:
      v: FindQuestion
    source:
      context:
        v: groupItem
      element:
        v: item
      variable:
        v: questionItem
      condition:
        v: $this.linkId=%questionId
    rule:
      name:
        v: FindQuestionnaireGroup

v: questionnaire

v: item

v: questionnaireGroupItem

v: $this.linkId=%groupId

v: FindQuestionnaireQuestion

context:
  v: questionnaireGroupItem
element:
  v: item
variable:
  v: questionnaireQuestionItem
condition:
  v: $this.linkId=%questionId

name:
  v: FetchQuestionType
source:
  context:
    v: questionnaireQuestionItem
  element:
    v: type
  variable:
    v: questionType
rule:
  name:
    v: FetchResponse
  source:
    context:
      v: question
    type:
      v: json
    element:
      v: reponse
    variable:
      v: reponse
  rule:
    name:
      v: CastNoChoice
    source:
      context:
        v: questionType
      variable:
        v: questionType
      condition:
        v: ($this = 'choice').not() and %reponse.exists()
    target:
      context:
        v: questionItem
      context type:
        v: variable
      element:
        v: answer[0].value
      transform:
        v: cast
      parameter:
        value: id
      parameter:
        value: id
  rule:
    name:
      v: CastChoice
    source:
      context:
        v: questionType
      variable:
        v: questionType
      condition:
        v: $this = 'choice' and %reponse.exists()
    target:
      context:
        v: questionItem
      context type:
        v: variable
      element:
        v: answer[0].value
      transform:
        v: c
      parameter:
        value: string
      parameter:
        value: id

id
v: reponse

id
v: questionType

id
v: reponse