FHIR Cross-Version Mapping Pack
0.1.0 - Ballot for Release 5.1.0 International flag

FHIR Cross-Version Mapping Pack, published by HL7 International / FHIR Infrastructure. This guide is not an authorized publication; it is the continuous build for version 0.1.0 built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/HL7/fhir-cross-version/ and changes regularly. See the Directory of published versions

StructureMap: Questionnaire Transforms: R5 to R4

Official URL: http://hl7.org/fhir/StructureMap/Questionnaire5to4 Version: 0.1.0
Standards status: Draft Maturity Level: 1 Computable Name: Questionnaire5to4

QuestionnaireTransformsR5toR4

/// url = 'http://hl7.org/fhir/StructureMap/Questionnaire5to4'
/// name = 'Questionnaire5to4'
/// title = 'Questionnaire Transforms: R5 to R4'
/// status = 'active'

uses "http://hl7.org/fhir/5.0/Questionnaire" alias QuestionnaireR5 as source
uses "http://hl7.org/fhir/4.0/Questionnaire" alias QuestionnaireR4 as target

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

group Questionnaire(source src : QuestionnaireR5, target tgt : QuestionnaireR4) extends DomainResource <<type+>> {
  src.url -> tgt.url;
  src.identifier -> tgt.identifier;
  src.version -> tgt.version;
  src.name -> tgt.name;
  src.title -> tgt.title;
  src.derivedFrom -> tgt.derivedFrom;
  src.status as v -> tgt.status = translate(v, 'http://hl7.org/fhir/ConceptMap/Questionnaire.status-R5toR4', 'code');
  src.experimental -> tgt.experimental;
  src.subjectType -> tgt.subjectType;
  src.date -> tgt.date;
  src.publisher -> tgt.publisher;
  src.contact -> tgt.contact;
  src.description -> tgt.description;
  src.useContext -> tgt.useContext;
  src.jurisdiction -> tgt.jurisdiction;
  src.purpose -> tgt.purpose;
  src.copyright -> tgt.copyright;
  src.approvalDate -> tgt.approvalDate;
  src.lastReviewDate -> tgt.lastReviewDate;
  src.effectivePeriod -> tgt.effectivePeriod;
  src.code -> tgt.code;
  src.item as s -> tgt.item as t then QuestionnaireItem(s, t);
}

group QuestionnaireItem(source src, target tgt) extends BackboneElement {
  src.linkId -> tgt.linkId;
  src.definition -> tgt.definition;
  src.code -> tgt.code;
  src.prefix -> tgt.prefix;
  src.text -> tgt.text;
  src.type as v -> tgt.type = translate(v, 'http://hl7.org/fhir/ConceptMap/Questionnaire.item.type-R5toR4', 'code');
  src.enableWhen as s -> tgt.enableWhen as t then QuestionnaireItemEnableWhen(s, t);
  src.enableBehavior as v -> tgt.enableBehavior = translate(v, 'http://hl7.org/fhir/ConceptMap/Questionnaire.item.enableBehavior-R5toR4', 'code');
  src.required -> tgt.required;
  src.repeats -> tgt.repeats;
  src.readOnly -> tgt.readOnly;
  src.maxLength -> tgt.maxLength;
  src.answerConstraint as v where answerConstraint = 'optionsOnly' ->  tgt.type as t,  t.value = 'choice';
  src.answerConstraint as v where answerConstraint = 'optionsOrType' ->  tgt.type as t,  t.value = 'open-choice';
  src.answerConstraint as v where answerConstraint = 'optionsOrString' ->  tgt.type as t,  t.value = 'open-choice';
  src.answerValueSet -> tgt.answerValueSet;
  src.answerOption as s -> tgt.answerOption as t then QuestionnaireItemAnswerOption(s, t);
  src.initial as s -> tgt.initial as t then QuestionnaireItemInitial(s, t);
}

group QuestionnaireItemEnableWhen(source src, target tgt) extends BackboneElement {
  src.question -> tgt.question;
  src.operator as v -> tgt.operator = translate(v, 'http://hl7.org/fhir/ConceptMap/Questionnaire.item.enableWhen.operator-R5toR4', 'code');
  src.answer : boolean -> tgt.answer;
  src.answer : decimal -> tgt.answer;
  src.answer : integer -> tgt.answer;
  src.answer : date -> tgt.answer;
  src.answer : dateTime -> tgt.answer;
  src.answer : time -> tgt.answer;
  src.answer : string -> tgt.answer;
  src.answer : Coding -> tgt.answer;
  src.answer : Quantity -> tgt.answer;
  src.answer : Reference -> tgt.answer;
}

group QuestionnaireItemAnswerOption(source src, target tgt) extends BackboneElement {
  src.value : integer -> tgt.value;
  src.value : date -> tgt.value;
  src.value : time -> tgt.value;
  src.value : string -> tgt.value;
  src.value : Coding -> tgt.value;
  src.value : Reference -> tgt.value;
  src.initialSelected -> tgt.initialSelected;
}

group QuestionnaireItemInitial(source src, target tgt) extends BackboneElement {
  src.value : boolean -> tgt.value;
  src.value : decimal -> tgt.value;
  src.value : integer -> tgt.value;
  src.value : date -> tgt.value;
  src.value : dateTime -> tgt.value;
  src.value : time -> tgt.value;
  src.value : string -> tgt.value;
  src.value : uri -> tgt.value;
  src.value : Attachment -> tgt.value;
  src.value : Coding -> tgt.value;
  src.value : Quantity -> tgt.value;
  src.value : Reference -> tgt.value;
}