FHIR Extensions Pack
5.1.0-ballot1 - Ballot for Release 5.1.0 International flag

This page is part of the FHIR Core Extensions Registry (v5.1.0-ballot: Releases Ballot 4) based on FHIR (HL7® FHIR® Standard) v5.0.0. The current version which supersedes this version is 1.0.0. For a full list of available versions, see the Directory of published versions

StructureMap: FML Conversion for Questionnaire: R5 to R4B

Official URL: http://hl7.org/fhir/StructureMap/Questionnaire5to4B Version: 5.1.0-ballot1
Standards status: Trial-use Maturity Level: 1 Computable Name: Questionnaire5to4B

FMLConversionforQuestionnaireR5toR4B

/// url = 'http://hl7.org/fhir/StructureMap/Questionnaire5to4B'
/// name = 'Questionnaire5to4B'
/// title = 'FML Conversion for Questionnaire: R5 to R4B'
/// status = 'active'

conceptmap "EnableWhenBehavior" {
  prefix s = "http://hl7.org/fhir/questionnaire-enable-behavior"
  prefix t = "http://hl7.org/fhir/4.3/questionnaire-enable-behavior"

  s:all - t:all
  s:any - t:any
}

conceptmap "PublicationStatus" {
  prefix s = "http://hl7.org/fhir/publication-status"
  prefix t = "http://hl7.org/fhir/4.3/publication-status"

  s:draft - t:draft
  s:active - t:active
  s:retired - t:retired
  s:unknown - t:unknown
}

conceptmap "QuestionnaireItemOperator" {
  prefix s = "http://hl7.org/fhir/questionnaire-enable-operator"
  prefix t = "http://hl7.org/fhir/4.3/questionnaire-enable-operator"

  s:exists - t:exists
  s:"=" - t:"="
  s:"!=" - t:"!="
  s:">" - t:">"
  s:"<" - t:"<"
  s:">=" - t:">="
  s:"<=" - t:"<="
}

conceptmap "QuestionnaireItemType" {
  prefix s = "http://hl7.org/fhir/item-type"
  prefix t = "http://hl7.org/fhir/4.3/item-type"

  s:group - t:group
  s:display - t:display
  s:question - t:question
  s:boolean - t:boolean
  s:decimal - t:decimal
  s:integer - t:integer
  s:date - t:date
  s:dateTime - t:dateTime
  s:time - t:time
  s:string - t:string
  s:text - t:text
  s:url - t:url
  s:coding - t:"open-choice"
  s:attachment - t:attachment
  s:reference - t:reference
  s:quantity - t:quantity
}

uses "http://hl7.org/fhir/StructureDefinition/Questionnaire" alias QuestionnaireR5 as source
uses "http://hl7.org/fhir/4.3/StructureDefinition/Questionnaire" alias QuestionnaireR4B as target

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

group Questionnaire(source src : QuestionnaireR5, target tgt : QuestionnaireR4B) extends DomainResource <<type+>> {
  src.url -> tgt.url;
  src.identifier -> tgt.identifier;
  src.version -> tgt.version;
  src.name -> tgt.name; // src.versionAlgorithm : string -> tgt.versionAlgorithm;
  src.title -> tgt.title;
  src.derivedFrom -> tgt.derivedFrom;
  src.status as v -> tgt.status = translate(v, '#PublicationStatus', '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.copyrightLabel -> tgt.copyrightLabel;
  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, '#QuestionnaireItemType', 'code');
  src.enableWhen as s -> tgt.enableWhen as t then QuestionnaireItemEnableWhen(s, t);
  src.enableBehavior as v -> tgt.enableBehavior = translate(v, '#EnableWhenBehavior', 'code');
  src.required -> tgt.required; // src.disabledDisplay as v -> tgt.disabledDisplay = translate(v, '#DisabledDisplay', 'code');
  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, '#QuestionnaireItemOperator', '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;
}