FHIR Extensions Pack
5.1.0 - 5.1.0 (April 2024) International flag

This page is part of the FHIR Core Extensions Registry (v5.1.0: Release 5.1) based on FHIR (HL7® FHIR® Standard) v5.0.0. This is the current published version. For a full list of available versions, see the Directory of published versions

StructureMap: FML Conversion for Questionnaire: R4B to R5

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

FMLConversionforQuestionnaireR4BtoR5

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

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

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

conceptmap "PublicationStatus" {
  prefix s = "http://hl7.org/fhir/4.3/publication-status"
  prefix t = "http://hl7.org/fhir/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/4.3/questionnaire-enable-operator"
  prefix t = "http://hl7.org/fhir/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/4.3/item-type"
  prefix t = "http://hl7.org/fhir/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:choice - t:coding
  s:"open-choice" - t:coding
  s:attachment - t:attachment
  s:reference - t:reference
  s:quantity - t:quantity
}

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

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

group Questionnaire(source src : QuestionnaireR4B, target tgt : QuestionnaireR5) 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.type as s where type = 'choice' ->  tgt.answerConstraint as t,  t.value = 'optionsOnly';
  src.type as s where type = 'open-choice' ->  tgt.answerConstraint as t,  t.value = 'optionsOrString';
  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.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;
}