FHIR Extensions Pack v5.1.0-cibuild (2023-12-11)

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

Clinical Genomics Work GroupMaturity Level: N/AStandards Status: InformativeSecurity Category: N/A Compartments: N/A

Following are maps for converting between the equivalent R4B resource and this R5 resource.

Maps to MolecularSequence

FML Conversion for MolecularSequence: R5 to R4 (Ready for Use/Trial Use)

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

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

  s:sense - t:sense
  s:antisense - t:antisense
}

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

  s:aa - t:aa
  s:dna - t:dna
  s:rna - t:rna
}

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

  s:watson - t:watson
  s:crick - t:crick
}

uses "http://hl7.org/fhir/StructureDefinition/MolecularSequence" alias MolecularSequenceR5 as source
uses "http://hl7.org/fhir/4.0/StructureDefinition/MolecularSequence" alias MolecularSequenceR4 as target

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

group MolecularSequence(source src : MolecularSequenceR5, target tgt : MolecularSequenceR4) extends DomainResource <<type+>> {
  src.identifier -> tgt.identifier;
  src.type as v -> tgt.type = translate(v, '#sequenceType', 'code');
  src.subject -> tgt.patient;
  src.specimen -> tgt.specimen; // src.focus -> tgt.focus;
  src.device -> tgt.device;
  src.performer -> tgt.performer;
  src.relative as s -> tgt.referenceSeq as t then MolecularSequenceReferenceSeq(s, t); // src.literal -> tgt.literal;
  src.relative as s -> tgt.variant as t then MolecularSequenceVariant(s, t);
}

group MolecularSequenceReferenceSeq(source src, target tgt) extends BackboneElement {
  src.startingSequence as s -> tgt then {
    s.chromosome as s where code = 'LA21254-0' ->  tgt.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://terminology.hl7.org/CodeSystem/chromosome-human',  tcc.code = '1',  tcc.display = 'chromosome 1';
    s.chromosome as s where code = 'LA21255-7' ->  tgt.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://terminology.hl7.org/CodeSystem/chromosome-human',  tcc.code = '2',  tcc.display = 'chromosome 2';
    s.chromosome as s where code = 'LA21256-5' ->  tgt.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://terminology.hl7.org/CodeSystem/chromosome-human',  tcc.code = '3',  tcc.display = 'chromosome 3';
    s.chromosome as s where code = 'LA21257-3' ->  tgt.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://terminology.hl7.org/CodeSystem/chromosome-human',  tcc.code = '4',  tcc.display = 'chromosome 4';
    s.chromosome as s where code = 'LA21258-1' ->  tgt.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://terminology.hl7.org/CodeSystem/chromosome-human',  tcc.code = '5',  tcc.display = 'chromosome 5';
    s.chromosome as s where code = 'LA21259-9' ->  tgt.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://terminology.hl7.org/CodeSystem/chromosome-human',  tcc.code = '6',  tcc.display = 'chromosome 6';
    s.chromosome as s where code = 'LA21260-7' ->  tgt.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://terminology.hl7.org/CodeSystem/chromosome-human',  tcc.code = '7',  tcc.display = 'chromosome 7';
    s.chromosome as s where code = 'LA21261-5' ->  tgt.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://terminology.hl7.org/CodeSystem/chromosome-human',  tcc.code = '8',  tcc.display = 'chromosome 8';
    s.chromosome as s where code = 'LA21262-3' ->  tgt.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://terminology.hl7.org/CodeSystem/chromosome-human',  tcc.code = '9',  tcc.display = 'chromosome 9';
    s.chromosome as s where code = 'LA21263-1' ->  tgt.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://terminology.hl7.org/CodeSystem/chromosome-human',  tcc.code = '10',  tcc.display = 'chromosome 10';
    s.chromosome as s where code = 'LA21264-9' ->  tgt.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://terminology.hl7.org/CodeSystem/chromosome-human',  tcc.code = '11',  tcc.display = 'chromosome 11';
    s.chromosome as s where code = 'LA21265-6' ->  tgt.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://terminology.hl7.org/CodeSystem/chromosome-human',  tcc.code = '12',  tcc.display = 'chromosome 12';
    s.chromosome as s where code = 'LA21266-4' ->  tgt.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://terminology.hl7.org/CodeSystem/chromosome-human',  tcc.code = '13',  tcc.display = 'chromosome 13';
    s.chromosome as s where code = 'LA21267-2' ->  tgt.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://terminology.hl7.org/CodeSystem/chromosome-human',  tcc.code = '14',  tcc.display = 'chromosome 14';
    s.chromosome as s where code = 'LA21268-0' ->  tgt.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://terminology.hl7.org/CodeSystem/chromosome-human',  tcc.code = '15',  tcc.display = 'chromosome 15';
    s.chromosome as s where code = 'LA21269-8' ->  tgt.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://terminology.hl7.org/CodeSystem/chromosome-human',  tcc.code = '16',  tcc.display = 'chromosome 16';
    s.chromosome as s where code = 'LA21270-6' ->  tgt.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://terminology.hl7.org/CodeSystem/chromosome-human',  tcc.code = '17',  tcc.display = 'chromosome 17';
    s.chromosome as s where code = 'LA21271-4' ->  tgt.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://terminology.hl7.org/CodeSystem/chromosome-human',  tcc.code = '18',  tcc.display = 'chromosome 18';
    s.chromosome as s where code = 'LA21272-2' ->  tgt.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://terminology.hl7.org/CodeSystem/chromosome-human',  tcc.code = '19',  tcc.display = 'chromosome 19';
    s.chromosome as s where code = 'LA21273-0' ->  tgt.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://terminology.hl7.org/CodeSystem/chromosome-human',  tcc.code = '20',  tcc.display = 'chromosome 20';
    s.chromosome as s where code = 'LA21274-8' ->  tgt.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://terminology.hl7.org/CodeSystem/chromosome-human',  tcc.code = '21',  tcc.display = 'chromosome 21';
    s.chromosome as s where code = 'LA21275-5' ->  tgt.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://terminology.hl7.org/CodeSystem/chromosome-human',  tcc.code = '22',  tcc.display = 'chromosome 22';
    s.chromosome as s where code = 'LA21276-3' ->  tgt.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://terminology.hl7.org/CodeSystem/chromosome-human',  tcc.code = 'X',  tcc.display = 'chromosome X';
    s.chromosome as s where code = 'LA21277-1' ->  tgt.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://terminology.hl7.org/CodeSystem/chromosome-human',  tcc.code = 'Y',  tcc.display = 'chromosome Y';
    s.sequence : CodeableConcept -> tgt.referenceSeqId;
    s.sequence : Reference -> tgt.referenceSeqPointer;
    s.sequence : string -> tgt.referenceSeqString;
    s.windowStart -> tgt.windowStart;
    s.windowEnd -> tgt.windowEnd;
    s.orientation as v -> tgt.orientation = translate(v, '#orientationType', 'code');
    s.strand as v -> tgt.strand = translate(v, '#strandType', 'code');
  };
}

group MolecularSequenceVariant(source src, target tgt) extends BackboneElement {
  src.edit as s -> tgt then {
    s.start -> tgt.start;
    s.end -> tgt.end;
    s.replacementSequence -> tgt.observedAllele;
    s.replacedSequence -> tgt.referenceAllele;
  };
}

FML Conversion for MolecularSequence: R5 to R4B (Ready for Use/Trial Use)

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

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

  s:sense - t:sense
  s:antisense - t:antisense
}

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

  s:aa - t:aa
  s:dna - t:dna
  s:rna - t:rna
}

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

  s:watson - t:watson
  s:crick - t:crick
}

uses "http://hl7.org/fhir/StructureDefinition/MolecularSequence" alias MolecularSequenceR5 as source
uses "http://hl7.org/fhir/4.3/StructureDefinition/MolecularSequence" alias MolecularSequenceR4B as target

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

group MolecularSequence(source src : MolecularSequenceR5, target tgt : MolecularSequenceR4B) extends DomainResource <<type+>> {
  src.identifier -> tgt.identifier;
  src.type as v -> tgt.type = translate(v, '#sequenceType', 'code');
  src.subject -> tgt.patient;
  src.specimen -> tgt.specimen; // src.focus -> tgt.focus;
  src.device -> tgt.device;
  src.performer -> tgt.performer;
  src.relative as s -> tgt.referenceSeq as t then MolecularSequenceReferenceSeq(s, t); // src.literal -> tgt.literal;
  src.relative as s -> tgt.variant as t then MolecularSequenceVariant(s, t);
}

group MolecularSequenceReferenceSeq(source src, target tgt) extends BackboneElement {
  src.startingSequence as s -> tgt then {
    s.chromosome as s where code = 'LA21254-0' ->  tgt.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://terminology.hl7.org/CodeSystem/chromosome-human',  tcc.code = '1',  tcc.display = 'chromosome 1';
    s.chromosome as s where code = 'LA21255-7' ->  tgt.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://terminology.hl7.org/CodeSystem/chromosome-human',  tcc.code = '2',  tcc.display = 'chromosome 2';
    s.chromosome as s where code = 'LA21256-5' ->  tgt.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://terminology.hl7.org/CodeSystem/chromosome-human',  tcc.code = '3',  tcc.display = 'chromosome 3';
    s.chromosome as s where code = 'LA21257-3' ->  tgt.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://terminology.hl7.org/CodeSystem/chromosome-human',  tcc.code = '4',  tcc.display = 'chromosome 4';
    s.chromosome as s where code = 'LA21258-1' ->  tgt.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://terminology.hl7.org/CodeSystem/chromosome-human',  tcc.code = '5',  tcc.display = 'chromosome 5';
    s.chromosome as s where code = 'LA21259-9' ->  tgt.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://terminology.hl7.org/CodeSystem/chromosome-human',  tcc.code = '6',  tcc.display = 'chromosome 6';
    s.chromosome as s where code = 'LA21260-7' ->  tgt.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://terminology.hl7.org/CodeSystem/chromosome-human',  tcc.code = '7',  tcc.display = 'chromosome 7';
    s.chromosome as s where code = 'LA21261-5' ->  tgt.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://terminology.hl7.org/CodeSystem/chromosome-human',  tcc.code = '8',  tcc.display = 'chromosome 8';
    s.chromosome as s where code = 'LA21262-3' ->  tgt.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://terminology.hl7.org/CodeSystem/chromosome-human',  tcc.code = '9',  tcc.display = 'chromosome 9';
    s.chromosome as s where code = 'LA21263-1' ->  tgt.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://terminology.hl7.org/CodeSystem/chromosome-human',  tcc.code = '10',  tcc.display = 'chromosome 10';
    s.chromosome as s where code = 'LA21264-9' ->  tgt.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://terminology.hl7.org/CodeSystem/chromosome-human',  tcc.code = '11',  tcc.display = 'chromosome 11';
    s.chromosome as s where code = 'LA21265-6' ->  tgt.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://terminology.hl7.org/CodeSystem/chromosome-human',  tcc.code = '12',  tcc.display = 'chromosome 12';
    s.chromosome as s where code = 'LA21266-4' ->  tgt.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://terminology.hl7.org/CodeSystem/chromosome-human',  tcc.code = '13',  tcc.display = 'chromosome 13';
    s.chromosome as s where code = 'LA21267-2' ->  tgt.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://terminology.hl7.org/CodeSystem/chromosome-human',  tcc.code = '14',  tcc.display = 'chromosome 14';
    s.chromosome as s where code = 'LA21268-0' ->  tgt.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://terminology.hl7.org/CodeSystem/chromosome-human',  tcc.code = '15',  tcc.display = 'chromosome 15';
    s.chromosome as s where code = 'LA21269-8' ->  tgt.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://terminology.hl7.org/CodeSystem/chromosome-human',  tcc.code = '16',  tcc.display = 'chromosome 16';
    s.chromosome as s where code = 'LA21270-6' ->  tgt.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://terminology.hl7.org/CodeSystem/chromosome-human',  tcc.code = '17',  tcc.display = 'chromosome 17';
    s.chromosome as s where code = 'LA21271-4' ->  tgt.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://terminology.hl7.org/CodeSystem/chromosome-human',  tcc.code = '18',  tcc.display = 'chromosome 18';
    s.chromosome as s where code = 'LA21272-2' ->  tgt.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://terminology.hl7.org/CodeSystem/chromosome-human',  tcc.code = '19',  tcc.display = 'chromosome 19';
    s.chromosome as s where code = 'LA21273-0' ->  tgt.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://terminology.hl7.org/CodeSystem/chromosome-human',  tcc.code = '20',  tcc.display = 'chromosome 20';
    s.chromosome as s where code = 'LA21274-8' ->  tgt.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://terminology.hl7.org/CodeSystem/chromosome-human',  tcc.code = '21',  tcc.display = 'chromosome 21';
    s.chromosome as s where code = 'LA21275-5' ->  tgt.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://terminology.hl7.org/CodeSystem/chromosome-human',  tcc.code = '22',  tcc.display = 'chromosome 22';
    s.chromosome as s where code = 'LA21276-3' ->  tgt.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://terminology.hl7.org/CodeSystem/chromosome-human',  tcc.code = 'X',  tcc.display = 'chromosome X';
    s.chromosome as s where code = 'LA21277-1' ->  tgt.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://terminology.hl7.org/CodeSystem/chromosome-human',  tcc.code = 'Y',  tcc.display = 'chromosome Y';
    s.sequence : CodeableConcept -> tgt.referenceSeqId;
    s.sequence : Reference -> tgt.referenceSeqPointer;
    s.sequence : string -> tgt.referenceSeqString;
    s.windowStart -> tgt.windowStart;
    s.windowEnd -> tgt.windowEnd;
    s.orientation as v -> tgt.orientation = translate(v, '#orientationType', 'code');
    s.strand as v -> tgt.strand = translate(v, '#strandType', 'code');
  };
}

group MolecularSequenceVariant(source src, target tgt) extends BackboneElement {
  src.edit as s -> tgt then {
    s.start -> tgt.start;
    s.end -> tgt.end;
    s.replacementSequence -> tgt.observedAllele;
    s.replacedSequence -> tgt.referenceAllele;
  };
}

Maps from MolecularSequence

FML Conversion for MolecularSequence: R4B to R5 (Ready for Use/Trial Use)

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

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

  s:sense - t:sense
  s:antisense - t:antisense
}

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

  s:aa - t:aa
  s:dna - t:dna
  s:rna - t:rna
}

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

  s:watson - t:watson
  s:crick - t:crick
}

uses "http://hl7.org/fhir/4.3/StructureDefinition/MolecularSequence" alias MolecularSequenceR4B as source
uses "http://hl7.org/fhir/StructureDefinition/MolecularSequence" alias MolecularSequenceR5 as target

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

group MolecularSequence(source src : MolecularSequenceR4B, target tgt : MolecularSequenceR5) extends DomainResource <<type+>> {
  src.identifier -> tgt.identifier;
  src.type as v -> tgt.type = translate(v, '#sequenceType', 'code');
  src.patient -> tgt.subject;
  src.specimen -> tgt.specimen; // src.focus -> tgt.focus;
  src.device -> tgt.device;
  src.performer -> tgt.performer;
  src.referenceSeq as s -> tgt.relative as t then MolecularSequenceReferenceSeq(s, t); // src.literal as s -> tgt.literal as t, t.observedSeq = s;
  src.variant as s -> tgt.relative as t then MolecularSequenceVariant(s, t);
}

group MolecularSequenceReferenceSeq(source src, target tgt) extends BackboneElement {
  src.chromosome as s where code = '1' ->  tgt.startingSequence as t,  t.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://loinc.org',  tcc.code = 'LA21254-0',  tcc.display = 'Chromosome 1';
  src.chromosome as s where code = '2' ->  tgt.startingSequence as t,  t.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://loinc.org',  tcc.code = 'LA21255-7',  tcc.display = 'Chromosome 2';
  src.chromosome as s where code = '3' ->  tgt.startingSequence as t,  t.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://loinc.org',  tcc.code = 'LA21256-5',  tcc.display = 'Chromosome 3';
  src.chromosome as s where code = '4' ->  tgt.startingSequence as t,  t.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://loinc.org',  tcc.code = 'LA21257-3',  tcc.display = 'Chromosome 4';
  src.chromosome as s where code = '5' ->  tgt.startingSequence as t,  t.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://loinc.org',  tcc.code = 'LA21258-1',  tcc.display = 'Chromosome 5';
  src.chromosome as s where code = '6' ->  tgt.startingSequence as t,  t.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://loinc.org',  tcc.code = 'LA21259-9',  tcc.display = 'Chromosome 6';
  src.chromosome as s where code = '7' ->  tgt.startingSequence as t,  t.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://loinc.org',  tcc.code = 'LA21260-7',  tcc.display = 'Chromosome 7';
  src.chromosome as s where code = '8' ->  tgt.startingSequence as t,  t.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://loinc.org',  tcc.code = 'LA21261-5',  tcc.display = 'Chromosome 8';
  src.chromosome as s where code = '9' ->  tgt.startingSequence as t,  t.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://loinc.org',  tcc.code = 'LA21262-3',  tcc.display = 'Chromosome 9';
  src.chromosome as s where code = '10' ->  tgt.startingSequence as t,  t.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://loinc.org',  tcc.code = 'LA21263-1',  tcc.display = 'Chromosome 10';
  src.chromosome as s where code = '11' ->  tgt.startingSequence as t,  t.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://loinc.org',  tcc.code = 'LA21264-9',  tcc.display = 'Chromosome 11';
  src.chromosome as s where code = '12' ->  tgt.startingSequence as t,  t.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://loinc.org',  tcc.code = 'LA21265-6',  tcc.display = 'Chromosome 12';
  src.chromosome as s where code = '13' ->  tgt.startingSequence as t,  t.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://loinc.org',  tcc.code = 'LA21266-4',  tcc.display = 'Chromosome 13';
  src.chromosome as s where code = '14' ->  tgt.startingSequence as t,  t.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://loinc.org',  tcc.code = 'LA21267-2',  tcc.display = 'Chromosome 14';
  src.chromosome as s where code = '15' ->  tgt.startingSequence as t,  t.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://loinc.org',  tcc.code = 'LA21268-0',  tcc.display = 'Chromosome 15';
  src.chromosome as s where code = '16' ->  tgt.startingSequence as t,  t.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://loinc.org',  tcc.code = 'LA21269-8',  tcc.display = 'Chromosome 16';
  src.chromosome as s where code = '17' ->  tgt.startingSequence as t,  t.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://loinc.org',  tcc.code = 'LA21270-6',  tcc.display = 'Chromosome 17';
  src.chromosome as s where code = '18' ->  tgt.startingSequence as t,  t.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://loinc.org',  tcc.code = 'LA21271-4',  tcc.display = 'Chromosome 18';
  src.chromosome as s where code = '19' ->  tgt.startingSequence as t,  t.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://loinc.org',  tcc.code = 'LA21272-2',  tcc.display = 'Chromosome 19';
  src.chromosome as s where code = '20' ->  tgt.startingSequence as t,  t.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://loinc.org',  tcc.code = 'LA21273-0',  tcc.display = 'Chromosome 20';
  src.chromosome as s where code = '21' ->  tgt.startingSequence as t,  t.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://loinc.org',  tcc.code = 'LA21274-8',  tcc.display = 'Chromosome 21';
  src.chromosome as s where code = '22' ->  tgt.startingSequence as t,  t.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://loinc.org',  tcc.code = 'LA21275-5',  tcc.display = 'Chromosome 22';
  src.chromosome as s where code = 'X' ->  tgt.startingSequence as t,  t.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://loinc.org',  tcc.code = 'LA21276-3',  tcc.display = 'Chromosome X';
  src.chromosome as s where code = 'Y' ->  tgt.startingSequence as t,  t.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://loinc.org',  tcc.code = 'LA21277-1',  tcc.display = 'Chromosome Y';
  src.referenceSeqId : CodeableConcept as s ->  tgt.startingSequence as t,  t.sequence = s;
  src.referenceSeqPointer : Reference as s ->  tgt.startingSequence as t,  t.sequence = s;
  src.referenceSeqString : string as s ->  tgt.startingSequence as t,  t.sequence = s;
  src.windowStart : integer as s ->  tgt.startingSequence as t,  t.windowStart = s;
  src.windowEnd : integer as s ->  tgt.startingSequence as t,  t.windowEnd = s;
  src.orientation as v ->  tgt.startingSequence as t,  t.orientation = translate(v, '#orientationType', 'code');
  src.strand as v ->  tgt.startingSequence as t,  t.strand = translate(v, '#strandType', 'code');
}

group MolecularSequenceVariant(source src, target tgt) extends BackboneElement {
  src.start : integer as s ->  tgt.edit as t,  t.start = s;
  src.end : integer as s ->  tgt.edit as t,  t.end = s;
  src.observedAllele as s ->  tgt.edit as t,  t.replacementSequence = s;
  src.referenceAllele as s ->  tgt.edit as t,  t.replacedSequence = s;
}

FML Conversion for MolecularSequence: R4 to R5 (Ready for Use/Trial Use)

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

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

  s:sense - t:sense
  s:antisense - t:antisense
}

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

  s:aa - t:aa
  s:dna - t:dna
  s:rna - t:rna
}

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

  s:watson - t:watson
  s:crick - t:crick
}

uses "http://hl7.org/fhir/4.0/StructureDefinition/MolecularSequence" alias MolecularSequenceR4 as source
uses "http://hl7.org/fhir/StructureDefinition/MolecularSequence" alias MolecularSequenceR5 as target

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

group MolecularSequence(source src : MolecularSequenceR4, target tgt : MolecularSequenceR5) extends DomainResource <<type+>> {
  src.identifier -> tgt.identifier;
  src.type as v -> tgt.type = translate(v, '#sequenceType', 'code');
  src.patient -> tgt.subject;
  src.specimen -> tgt.specimen; // src.focus -> tgt.focus;
  src.device -> tgt.device;
  src.performer -> tgt.performer;
  src.referenceSeq as s -> tgt.relative as t then MolecularSequenceReferenceSeq(s, t); // src.literal as s -> tgt.literal as t, t.observedSeq = s;
  src.variant as s -> tgt.relative as t then MolecularSequenceVariant(s, t);
}

group MolecularSequenceReferenceSeq(source src, target tgt) extends BackboneElement {
  src.chromosome as s where code = '1' ->  tgt.startingSequence as t,  t.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://loinc.org',  tcc.code = 'LA21254-0',  tcc.display = 'Chromosome 1';
  src.chromosome as s where code = '2' ->  tgt.startingSequence as t,  t.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://loinc.org',  tcc.code = 'LA21255-7',  tcc.display = 'Chromosome 2';
  src.chromosome as s where code = '3' ->  tgt.startingSequence as t,  t.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://loinc.org',  tcc.code = 'LA21256-5',  tcc.display = 'Chromosome 3';
  src.chromosome as s where code = '4' ->  tgt.startingSequence as t,  t.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://loinc.org',  tcc.code = 'LA21257-3',  tcc.display = 'Chromosome 4';
  src.chromosome as s where code = '5' ->  tgt.startingSequence as t,  t.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://loinc.org',  tcc.code = 'LA21258-1',  tcc.display = 'Chromosome 5';
  src.chromosome as s where code = '6' ->  tgt.startingSequence as t,  t.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://loinc.org',  tcc.code = 'LA21259-9',  tcc.display = 'Chromosome 6';
  src.chromosome as s where code = '7' ->  tgt.startingSequence as t,  t.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://loinc.org',  tcc.code = 'LA21260-7',  tcc.display = 'Chromosome 7';
  src.chromosome as s where code = '8' ->  tgt.startingSequence as t,  t.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://loinc.org',  tcc.code = 'LA21261-5',  tcc.display = 'Chromosome 8';
  src.chromosome as s where code = '9' ->  tgt.startingSequence as t,  t.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://loinc.org',  tcc.code = 'LA21262-3',  tcc.display = 'Chromosome 9';
  src.chromosome as s where code = '10' ->  tgt.startingSequence as t,  t.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://loinc.org',  tcc.code = 'LA21263-1',  tcc.display = 'Chromosome 10';
  src.chromosome as s where code = '11' ->  tgt.startingSequence as t,  t.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://loinc.org',  tcc.code = 'LA21264-9',  tcc.display = 'Chromosome 11';
  src.chromosome as s where code = '12' ->  tgt.startingSequence as t,  t.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://loinc.org',  tcc.code = 'LA21265-6',  tcc.display = 'Chromosome 12';
  src.chromosome as s where code = '13' ->  tgt.startingSequence as t,  t.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://loinc.org',  tcc.code = 'LA21266-4',  tcc.display = 'Chromosome 13';
  src.chromosome as s where code = '14' ->  tgt.startingSequence as t,  t.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://loinc.org',  tcc.code = 'LA21267-2',  tcc.display = 'Chromosome 14';
  src.chromosome as s where code = '15' ->  tgt.startingSequence as t,  t.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://loinc.org',  tcc.code = 'LA21268-0',  tcc.display = 'Chromosome 15';
  src.chromosome as s where code = '16' ->  tgt.startingSequence as t,  t.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://loinc.org',  tcc.code = 'LA21269-8',  tcc.display = 'Chromosome 16';
  src.chromosome as s where code = '17' ->  tgt.startingSequence as t,  t.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://loinc.org',  tcc.code = 'LA21270-6',  tcc.display = 'Chromosome 17';
  src.chromosome as s where code = '18' ->  tgt.startingSequence as t,  t.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://loinc.org',  tcc.code = 'LA21271-4',  tcc.display = 'Chromosome 18';
  src.chromosome as s where code = '19' ->  tgt.startingSequence as t,  t.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://loinc.org',  tcc.code = 'LA21272-2',  tcc.display = 'Chromosome 19';
  src.chromosome as s where code = '20' ->  tgt.startingSequence as t,  t.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://loinc.org',  tcc.code = 'LA21273-0',  tcc.display = 'Chromosome 20';
  src.chromosome as s where code = '21' ->  tgt.startingSequence as t,  t.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://loinc.org',  tcc.code = 'LA21274-8',  tcc.display = 'Chromosome 21';
  src.chromosome as s where code = '22' ->  tgt.startingSequence as t,  t.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://loinc.org',  tcc.code = 'LA21275-5',  tcc.display = 'Chromosome 22';
  src.chromosome as s where code = 'X' ->  tgt.startingSequence as t,  t.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://loinc.org',  tcc.code = 'LA21276-3',  tcc.display = 'Chromosome X';
  src.chromosome as s where code = 'Y' ->  tgt.startingSequence as t,  t.chromosome = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://loinc.org',  tcc.code = 'LA21277-1',  tcc.display = 'Chromosome Y';
  src.referenceSeqId : CodeableConcept as s ->  tgt.startingSequence as t,  t.sequence = s;
  src.referenceSeqPointer : Reference as s ->  tgt.startingSequence as t,  t.sequence = s;
  src.referenceSeqString : string as s ->  tgt.startingSequence as t,  t.sequence = s;
  src.windowStart : integer as s ->  tgt.startingSequence as t,  t.windowStart = s;
  src.windowEnd : integer as s ->  tgt.startingSequence as t,  t.windowEnd = s;
  src.orientation as v ->  tgt.startingSequence as t,  t.orientation = translate(v, '#orientationType', 'code');
  src.strand as v ->  tgt.startingSequence as t,  t.strand = translate(v, '#strandType', 'code');
}

group MolecularSequenceVariant(source src, target tgt) extends BackboneElement {
  src.start : integer as s ->  tgt.edit as t,  t.start = s;
  src.end : integer as s ->  tgt.edit as t,  t.end = s;
  src.observedAllele as s ->  tgt.edit as t,  t.replacementSequence = s;
  src.referenceAllele as s ->  tgt.edit as t,  t.replacedSequence = s;
}