FHIR Extensions Pack
5.1.0-cibuild - Working Copy International flag

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

StructureMap: FML Conversion for Bundle: R5 to R4

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

FMLConversionforBundleR5toR4

/// url = 'http://hl7.org/fhir/StructureMap/Bundle5to4'
/// name = 'Bundle5to4'
/// title = 'FML Conversion for Bundle: R5 to R4'
/// status = 'active'

conceptmap "BundleType" {
  prefix s = "http://hl7.org/fhir/bundle-type"
  prefix t = "http://hl7.org/fhir/4.0/bundle-type"

  s:document - t:document
  s:message - t:message
  s:transaction - t:transaction
  s:"transaction-response" - t:"transaction-response"
  s:batch - t:batch
  s:"batch-response" - t:"batch-response"
  s:history - t:history
  s:searchset - t:searchset
  s:collection - t:collection
}

conceptmap "HTTPVerb" {
  prefix s = "http://hl7.org/fhir/http-verb"
  prefix t = "http://hl7.org/fhir/4.0/http-verb"

  s:GET - t:GET
  s:HEAD - t:HEAD
  s:POST - t:POST
  s:PUT - t:PUT
  s:DELETE - t:DELETE
  s:PATCH - t:PATCH
}

conceptmap "SearchEntryMode" {
  prefix s = "http://hl7.org/fhir/search-entry-mode"
  prefix t = "http://hl7.org/fhir/4.0/search-entry-mode"

  s:match - t:match
  s:include - t:include
  s:outcome - t:outcome
}

uses "http://hl7.org/fhir/StructureDefinition/Bundle" alias BundleR5 as source
uses "http://hl7.org/fhir/4.0/StructureDefinition/Bundle" alias BundleR4 as target

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

group Bundle(source src : BundleR5, target tgt : BundleR4) extends Resource <<type+>> {
  src.identifier -> tgt.identifier;
  src.type as v -> tgt.type = translate(v, '#BundleType', 'code');
  src.timestamp -> tgt.timestamp;
  src.total -> tgt.total;
  src.link as s -> tgt.link as t then BundleLink(s, t);
  src.entry as s -> tgt.entry as t then BundleEntry(s, t);
  src.signature -> tgt.signature;
}

group BundleLink(source src, target tgt) extends BackboneElement {
  src.relation -> tgt.relation;
  src.url -> tgt.url;
}

group BundleEntry(source src, target tgt) extends BackboneElement {
  src.fullUrl -> tgt.fullUrl;
  src.resource : Resource -> tgt.resource;
  src.search as s -> tgt.search as t then BundleEntrySearch(s, t);
  src.request as s -> tgt.request as t then BundleEntryRequest(s, t);
  src.response as s -> tgt.response as t then BundleEntryResponse(s, t);
}

group BundleEntrySearch(source src, target tgt) extends BackboneElement {
  src.mode as v -> tgt.mode = translate(v, '#SearchEntryMode', 'code');
  src.score -> tgt.score;
}

group BundleEntryRequest(source src, target tgt) extends BackboneElement {
  src.method as v -> tgt.method = translate(v, '#HTTPVerb', 'code');
  src.url -> tgt.url;
  src.ifNoneMatch -> tgt.ifNoneMatch;
  src.ifModifiedSince -> tgt.ifModifiedSince;
  src.ifMatch -> tgt.ifMatch;
  src.ifNoneExist -> tgt.ifNoneExist;
}

group BundleEntryResponse(source src, target tgt) extends BackboneElement {
  src.status -> tgt.status;
  src.location -> tgt.location;
  src.etag -> tgt.etag;
  src.lastModified -> tgt.lastModified;
  src.outcome : Resource -> tgt.outcome;
}