FHIR Release 3 (STU) Current Build
This page is part of FHIR STU 3 (v3.0.1) in it's permanent home (it will always be available at this URL). It has been superceded by R4 . For a full list of available versions, see the Directory of published versions .
FHIR Infrastructure Work Group Maturity Level : N/A Ballot Standards Status : Informative Security Category : Patient Compartments : Device , Encounter , Patient , Practitioner , RelatedPerson

R2 : R3 Converson : R4 Conversion maps for QuestionnaireResponse.

Functional status for this map: 6 5 tests that all execute ok. 1 fail round-trip testing and 6 5 r3 resources are invalid (19 (0 errors). ( see documentation)

map "http://hl7.org/fhir/StructureMap/QuestionnaireResponse2to3" = "R2 to R3 Conversions for QuestionnaireResponse"
map "http://hl7.org/fhir/StructureMap/QuestionnaireResponse3to4" = "R3 to R4 Conversions for QuestionnaireResponse"
uses "http://hl7.org/fhir/DSTU2/StructureDefinition/QuestionnaireResponse" alias QuestionnaireResponseR2 as source

uses "http://hl7.org/fhir/3.0/StructureDefinition/QuestionnaireResponse" alias QuestionnaireResponseR3 as source

uses "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse" alias QuestionnaireResponse as target
imports "http://hl7.org/fhir/StructureMap/*2to3"
group for type+types  QuestionnaireResponse extends DomainResource
  input src : QuestionnaireResponseR2 as source
  input tgt : QuestionnaireResponse as target
  "QuestionnaireResponse-identifier" : for src.identifier make tgt.identifier
  "QuestionnaireResponse-questionnaire" : for src.questionnaire make tgt.questionnaire
  "QuestionnaireResponse-status" : for src.status make tgt.status
  "QuestionnaireResponse-subject" : for src.subject make tgt.subject
  "QuestionnaireResponse-author" : for src.author make tgt.author
  "QuestionnaireResponse-authored" : for src.authored make tgt.authored
  "QuestionnaireResponse-source" : for src.source make tgt.source
  "QuestionnaireResponse-encounter" : for src.encounter make tgt.context
  
  "QuestionnaireResponse-item" : for src.group as vs0 make tgt.item as vt0 then qrGroup(vs0, vt0)
endgroup
group qrGroup extends BackboneElement
  input src as source
  input tgt as target
  "QuestionnaireResponse.group-linkId" : for src.linkId make tgt.linkId
  "QuestionnaireResponse.group-title" : for src.title where src.text.empty() make tgt.text
  "QuestionnaireResponse.group-text" : for src.text make tgt.text
  "QuestionnaireResponse.group-subject" : for src.subject make tgt.subject
  "QuestionnaireResponse.group-group" : for src.group as vs0 make tgt.item as vt0 then qrGroup(vs0, vt0)
  "QuestionnaireResponse.group-question" : for src.question as vs0 make tgt.item as vt0 then qrQuestion(vs0, vt0)
endgroup

imports "http://hl7.org/fhir/StructureMap/*3to4"

group qrQuestion extends BackboneElement
  input src as source
  input tgt as target

group QuestionnaireResponse(source src : QuestionnaireResponseR3, target tgt : QuestionnaireResponse) extends DomainResource <<type+>> {
  src.identifier -> tgt.identifier;
  src.basedOn -> tgt.basedOn;
  src.parent -> tgt.partOf;
  src.questionnaire -> tgt.questionnaire;
  src.status -> tgt.status;
  src.subject -> tgt.subject;
  src.context -> tgt.encounter;
  src.authored -> tgt.authored;
  src.author -> tgt.author;
  src.source -> tgt.source;
  src.item as vs0 -> tgt.item as vt0 then item(vs0, vt0);
}

  "QuestionnaireResponse.group.question-linkId" : for src.linkId make tgt.linkId
  // drop title
  "QuestionnaireResponse.group.question-text" : for src.text make tgt.text
  "QuestionnaireResponse.group.question-answer" : for src.answer as vs0 make tgt.answer as vt0 then qrAnswer(vs0, vt0)
endgroup

group item(source src, target tgt) extends BackboneElement {
  src.linkId -> tgt.linkId;
  src.definition -> tgt.definition;
  src.text -> tgt.text;
  src.subject as v ->  tgt.extension as vt,  vt.url = 'http://hl7.org/fhir/3.0/StructureDefinition/extension-QuestionnaireResponse.item.subject',  vt.value = v;
  src.answer as vs0 -> tgt.answer as vt0 then answer(vs0, vt0);
  src.item as vs0 -> tgt.item as vt0 then item(vs0, vt0);
}

group qrAnswer extends BackboneElement
  input src as source
  input tgt as target

group answer(source src, target tgt) extends BackboneElement {
  src.value -> tgt.value;
  src.item as vs0 -> tgt.item as vt0 then item(vs0, vt0);
}

  "QuestionnaireResponse.group.question.answer-value" : for src.value make tgt.value 
  "QuestionnaireResponse.group.question.answer-group" : for src.group as vs0 make tgt.item as vt0 then qrGroup(vs0, vt0)
endgroup

map "http://hl7.org/fhir/StructureMap/QuestionnaireResponse3to2" = "R3 to R2 Conversion for QuestionnaireResponse"
map "http://hl7.org/fhir/StructureMap/QuestionnaireResponse4to3" = "R4 to R3 Conversion for QuestionnaireResponse"
uses "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse" alias QuestionnaireResponse as source
uses "http://hl7.org/fhir/DSTU2/StructureDefinition/QuestionnaireResponse" alias QuestionnaireResponseR2 as target
imports "http://hl7.org/fhir/StructureMap/*3to2"
group for type+types  QuestionnaireResponse extends DomainResource
  input src : QuestionnaireResponse as source
  input tgt : QuestionnaireResponseR2 as target
  "QuestionnaireResponse-identifier" : for src.identifier make tgt.identifier
  "QuestionnaireResponse-questionnaire" : for src.questionnaire make tgt.questionnaire
  "QuestionnaireResponse-status" : for src.status make tgt.status
  "QuestionnaireResponse-subject" : for src.subject make tgt.subject
  "QuestionnaireResponse-author" : for src.author make tgt.author
  "QuestionnaireResponse-authored" : for src.authored make tgt.authored
  "QuestionnaireResponse-source" : for src.source make tgt.source
  "QuestionnaireResponse-encounter" : for src.context make tgt.encounter
  
  "QuestionnaireResponse-item" : for src.item as vs0 make tgt.group as vt0 then qrGroup(vs0, vt0)
endgroup
group qrGroup extends BackboneElement
  input src as source
  input tgt as target

uses "http://hl7.org/fhir/3.0/StructureDefinition/QuestionnaireResponse" alias QuestionnaireResponseR3 as target

  "QuestionnaireResponse.group-linkId" : for src.linkId make tgt.linkId
  "QuestionnaireResponse.group-text" : for src.text where item.answer.empty() make tgt.title
  "QuestionnaireResponse.group-text" : for src.text where item.answer.exists() make tgt.text
  "QuestionnaireResponse.group-subject" : for src.subject make tgt.subject
  "QuestionnaireResponse.group-group" :    for src.item as vs0 where answer.empty() make tgt.group    as vt0 then qrGroup(vs0, vt0)
  "QuestionnaireResponse.group-question" : for src.item as vs0 where answer.exists() make tgt.question as vt0 then qrQuestion(vs0, vt0)
endgroup

imports "http://hl7.org/fhir/StructureMap/*4to3"

group qrQuestion extends BackboneElement
  input src as source
  input tgt as target

group QuestionnaireResponse(source src : QuestionnaireResponse, target tgt : QuestionnaireResponseR3) extends DomainResource <<type+>> {
  src.identifier -> tgt.identifier;
  src.basedOn -> tgt.basedOn;
  src.partOf -> tgt.parent;
  src.questionnaire -> tgt.questionnaire;
  src.status -> tgt.status;
  src.subject -> tgt.subject;
  src.encounter -> tgt.context;
  src.authored -> tgt.authored;
  src.author -> tgt.author;
  src.source -> tgt.source;
  src.item as vs0 -> tgt.item as vt0 then item(vs0, vt0);
}

  "QuestionnaireResponse.group.question-linkId" : for src.linkId make tgt.linkId
  "QuestionnaireResponse.group.question-text" : for src.text make tgt.text
  "QuestionnaireResponse.group.question-answer" : for src.answer as vs0 make tgt.answer as vt0 then qrAnswer(vs0, vt0)
endgroup

group item(source src, target tgt) extends BackboneElement {
  src.linkId -> tgt.linkId;
  src.definition -> tgt.definition;
  src.text -> tgt.text;
  src.extension as e where url = 'http://hl7.org/fhir/3.0/StructureDefinition/extension-QuestionnaireResponse.item.subject' then {
    e.value -> tgt.subject;
  };
  src.answer as vs0 -> tgt.answer as vt0 then answer(vs0, vt0);
  src.item as vs0 -> tgt.item as vt0 then item(vs0, vt0);
}

group qrAnswer extends BackboneElement
  input src as source
  input tgt as target

group answer(source src, target tgt) extends BackboneElement {
  src.value -> tgt.value;
  src.item as vs0 -> tgt.item as vt0 then item(vs0, vt0);
}

  "QuestionnaireResponse.group.question.answer-value" : for src.value make tgt.value 
  "QuestionnaireResponse.group.question.answer-group" : for src.item as vs0 check answer.empty() make tgt.group as vt0 then qrGroup(vs0, vt0)
endgroup

3141 ERROR @ QuestionnaireResponse: If the resource is contained in another resource, it SHALL be referred to from elsewhere in the resource [contained.where(('#'+id in %resource.descendants().reference).not()).empty()] (src = InstanceValidator) ERROR @ QuestionnaireResponse.item: Profile http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse, Element 'QuestionnaireResponse.item.linkId': minimum required = 1, but only found 0 (src = InstanceValidator) ERROR @ QuestionnaireResponse.item.item: Profile http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse, Element 'QuestionnaireResponse.item.item.linkId': minimum required = 1, but only found 0 (src = InstanceValidator) ERROR @ QuestionnaireResponse.item.item.item: Profile http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse, Element 'QuestionnaireResponse.item.item.item.linkId': minimum required = 1, but only found 0 (src = InstanceValidator) ERROR @ QuestionnaireResponse.item.item.item.answer.item: Profile http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse, Element 'QuestionnaireResponse.item.item.item.answer.item.linkId': minimum required = 1, but only found 0 (src = InstanceValidator) ERROR @ QuestionnaireResponse.item.item.item.answer.item.item[1]: Profile http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse, Element 'QuestionnaireResponse.item.item.item.answer.item.item[1].linkId': minimum required = 1, but only found 0 (src = InstanceValidator) ERROR @ QuestionnaireResponse.item.item.item.answer.item.item[2]: Profile http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse, Element 'QuestionnaireResponse.item.item.item.answer.item.item[2].linkId': minimum required = 1, but only found 0 (src = InstanceValidator) ERROR @ QuestionnaireResponse.item.item.item.answer.item.item[3]: Profile http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse, Element 'QuestionnaireResponse.item.item.item.answer.item.item[3].linkId': minimum required = 1, but only found 0 (src = InstanceValidator) INFORMATION @ QuestionnaireResponse: No questionnaire is identified, so no validation can be performed against the base questionnaire (src = InstanceValidator) bb ERROR @ QuestionnaireResponse.item.item.item[1]: Profile http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse, Element 'QuestionnaireResponse.item.item.item[1].linkId': minimum required = 1, but only found 0 (src = InstanceValidator) ERROR @ QuestionnaireResponse.item.item.item[2].item[4].answer.item.item: Profile http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse, Element 'QuestionnaireResponse.item.item.item[2].item[4].answer.item.item.linkId': minimum required = 1, but only found 0 (src = InstanceValidator) INFORMATION @ QuestionnaireResponse: No questionnaire is identified, so no validation can be performed against the base questionnaire (src = InstanceValidator) f201 INFORMATION @ QuestionnaireResponse: No questionnaire is identified, so no validation can be performed against the base questionnaire (src = InstanceValidator) gcs WARNING @ QuestionnaireResponse: The questionnaire could not be resolved, so no validation can be performed against the base questionnaire (src = InstanceValidator) questionnaireresponse-sdc-example-ussg-fht-answers ERROR @ QuestionnaireResponse.item.item[3].item[10].item.item[4].answer.item.item[1].answer.item.item: Profile http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse, Element 'QuestionnaireResponse.item.item[3].item[10].item.item[4].answer.item.item[1].answer.item.item.linkId': minimum required = 1, but only found 0 (src = InstanceValidator) WARNING @ QuestionnaireResponse: The questionnaire could not be resolved, so no validation can be performed against the base questionnaire (src = InstanceValidator) questionnaireresponse-sdc-profile-example ERROR @ QuestionnaireResponse.item: Profile http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse, Element 'QuestionnaireResponse.item.linkId': minimum required = 1, but only found 0 (src = InstanceValidator) ERROR @ QuestionnaireResponse.item.item[2].item: Profile http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse, Element 'QuestionnaireResponse.item.item[2].item.linkId': minimum required = 1, but only found 0 (src = InstanceValidator) INFORMATION @ QuestionnaireResponse: No questionnaire is identified, so no <p>No validation can be performed against the base questionnaire (src = InstanceValidator) errors - all conversions are clean</p>