R4 Draft for Comment

This page is part of the FHIR Specification (v3.2.0: R4 Ballot 1). The current version which supercedes this version is 5.0.0. For a full list of available versions, see the Directory of published versions . Page versions: R5 R4B R4 R3

FHIR Infrastructure Work GroupMaturity Level: N/ABallot Status: Informative Compartments: Device, Encounter, Patient, Practitioner, RelatedPerson

R2 : R3 Conversion maps for QuestionnaireResponse.

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

map "http://hl7.org/fhir/StructureMap/QuestionnaireResponse2to3" = "R2 to R3 Conversions for QuestionnaireResponse"

uses "http://hl7.org/fhir/DSTU2/StructureDefinition/QuestionnaireResponse" alias QuestionnaireResponseR2 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

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

  "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 qrAnswer extends BackboneElement
  input src as source
  input tgt as target

  "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"

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

  "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

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

  "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 qrAnswer extends BackboneElement
  input src as source
  input tgt as target

  "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 validation can be performed against the base questionnaire (src = InstanceValidator)