MeaslesLabResultsMap
type: StructureMap
node role: treeRoot
id:
  v: MeaslesLabResultsMap
text:
  status:
    v: generated
  div:
    v: Generated Narrative: StructureMap MeaslesLabResultsMap #xD; map "http://example.org/StructureMap/MeaslesLabResultsMap" = "MeaslesLabResultsMap"#xD; #xD; // Measles Lab Results QuestionnaireResponse to FHIR resources#xD; // Maps to: Observation (Measles IgM), Observation (Rubella IgM), DiagnosticReport#xD; #xD; uses "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse" alias QuestionnaireResponse as source#xD; uses "http://hl7.org/fhir/StructureDefinition/Bundle" alias Bundle as target#xD; uses "http://hl7.org/fhir/StructureDefinition/Observation" alias Observation as target#xD; uses "http://hl7.org/fhir/StructureDefinition/DiagnosticReport" alias DiagnosticReport as target#xD; #xD; group MeaslesLabResultsMap(source src : QuestionnaireResponse, target bundle : Bundle) {#xD; src -> bundle.id = uuid() "bundleId";#xD; src -> bundle.type = 'transaction' "bundleType";#xD; // Measles IgM Observation#xD; src -> bundle.entry as e then {#xD; src -> e.resource = create('Observation') as measlesObs then MapMeaslesIgM(src, measlesObs) "execMeaslesIgM";#xD; src -> e.request as req, req.method = 'POST', req.url = 'Observation' "measlesObsReq";#xD; } "measlesIgMEntry";#xD; // Rubella IgM Observation#xD; src -> bundle.entry as e then {#xD; src -> e.resource = create('Observation') as rubellaObs then MapRubellaIgM(src, rubellaObs) "execRubellaIgM";#xD; src -> e.request as req, req.method = 'POST', req.url = 'Observation' "rubellaObsReq";#xD; } "rubellaIgMEntry";#xD; // DiagnosticReport#xD; src -> bundle.entry as e then {#xD; src -> e.resource = create('DiagnosticReport') as report then MapLabDiagnosticReport(src, report) "execReport";#xD; src -> e.request as req, req.method = 'POST', req.url = 'DiagnosticReport' "reportReq";#xD; } "diagnosticReportEntry";#xD; }#xD; #xD; group MapMeaslesIgM(source src : QuestionnaireResponse, target obs : Observation) {#xD; src -> obs.id = uuid() "obsId";#xD; src -> obs.status = 'final' "status";#xD; // LOINC code for Measles virus IgM Ab in…
url:
  v: http://example.org/StructureMap/MeaslesLabResultsMap
  l: MeaslesLabResultsMap
version:
  v: 0.1.0
name:
  v: MeaslesLabResultsMap
status:
  v: draft
date:
  v: 2026-05-04T06:19:40+00:00
publisher:
  v: Kenya National Public Health Institute
contact:
  name:
    v: Kenya National Public Health Institute
  telecom:
    system:
      v: url
    value:
      v: https://www.nphi.go.ke/
contact:
  name:
    v: Kenya National Public Health Institute
  telecom:
    system:
      v: url
    value:
      v: https://www.nphi.go.ke/
    use:
      v: work
description:
  v: Measles Lab Results QuestionnaireResponse to FHIR resources Maps to: Observation (Measles IgM), Observation (Rubella IgM), DiagnosticReport
jurisdiction:
  coding:
    system:
      v: urn:iso:std:iso:3166
      l: 3166
    code:
      v: KE
    display:
      v: Kenya
structure:
  url:
    v: http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse
    l: QuestionnaireResponse
  mode:
    v: source
  alias:
    v: QuestionnaireResponse
structure:
  url:
    v: http://hl7.org/fhir/StructureDefinition/Bundle
    l: Bundle
  mode:
    v: target
  alias:
    v: Bundle
structure:
  url:
    v: http://hl7.org/fhir/StructureDefinition/Observation
    l: Observation
  mode:
    v: target
  alias:
    v: Observation
structure:
  url:
    v: http://hl7.org/fhir/StructureDefinition/DiagnosticReport
    l: DiagnosticReport
  mode:
    v: target
  alias:
    v: DiagnosticReport
group:
  name:
    v: MeaslesLabResultsMap
  type mode:
    v: none
  input:
    name:
      v: src
    type:
      v: QuestionnaireResponse
    mode:
      v: source
  input:
    name:
      v: bundle
    type:
      v: Bundle
    mode:
      v: target
  rule:
    name:
      v: bundleId
    source:
      context:
        v: src
    target:
      context:
        v: bundle
      context type:
        v: variable
      element:
        v: id
      transform:
        v: uuid
  rule:
    name:
      v: bundleType
    source:
      context:
        v: src
    target:
      context:
        v: bundle
      context type:
        v: variable
      element:
        v: type
      transform:
        v: copy
      parameter:
        value: String
  rule:
    name:
      v: measlesIgMEntry
    source:
      context:
        v: src
    target:
      context:
        v: bundle
      context type:
        v: variable
      element:
        v: entry
      variable:
        v: e
    rule:
      name:
        v: execMeaslesIgM
    rule:
      name:
        v: measlesObsReq
  rule:
    name:
      v: rubellaIgMEntry
    source:
      context:
        v: src
    target:
      context:
        v: bundle
      context type:
        v: variable
      element:
        v: entry
      variable:
        v: e
    rule:
      name:
        v: execRubellaIgM
    rule:
      name:
        v: rubellaObsReq
  rule:
    name:
      v: diagnosticReportEntry
    source:
      context:
        v: src
    target:
      context:
        v: bundle
      context type:
        v: variable
      element:
        v: entry
      variable:
        v: e
    rule:
      name:
        v: execReport
    rule:
      name:
        v: reportReq
group:
  name:
    v: MapMeaslesIgM
  type mode:
    v: none

String
v: transaction

v: src

v: e

v: variable

v: resource

v: measlesObs

v: create

value: String
  v: Observation

v: MapMeaslesIgM

v: src

v: measlesObs

v: src

v: e

v: variable

v: request

v: req

v: req

v: variable

v: method

v: copy

value: String
  v: POST

v: req

v: variable

v: url

v: copy

value: String
  v: Observation

v: src

v: e

v: variable

v: resource

v: rubellaObs

v: create

value: String
  v: Observation

v: MapRubellaIgM

v: src

v: rubellaObs

v: src

v: e

v: variable

v: request

v: req

v: req

v: variable

v: method

v: copy

value: String
  v: POST

v: req

v: variable

v: url

v: copy

value: String
  v: Observation

v: src

v: e

v: variable

v: resource

v: report

v: create

value: String
  v: DiagnosticReport

v: MapLabDiagnosticReport

v: src

v: report

v: src

v: e

v: variable

v: request

v: req

v: req

v: variable

v: method

v: copy

value: String
  v: POST

v: req

v: variable

v: url

v: copy

value: String
  v: DiagnosticReport

name:
  v: src
type:
  v: QuestionnaireResponse
mode:
  v: source

name:
  v: obs
type:
  v: Observation
mode:
  v: target

name:
  v: obsId
source:
  context:
    v: src
target:
  context:
    v: obs
  context type:
    v: variable
  element:
    v: id
  transform:
    v: uuid

name:
  v: status
source:
  context:
    v: src
target:
  context:
    v: obs
  context type:
    v: variable
  element:
    v: status
  transform:
    v: copy
  parameter:
    value: String
      v: final

name:
  v: codeBlock
source:
  context:
    v: src
target:
  context:
    v: obs
  context type:
    v: variable
  element:
    v: code
  variable:
    v: code
rule:
  name:
    v: measlesIgMCoding
  source:
    context:
      v: src
  target:
    context:
      v: code
    context type:
      v: variable
    element:
      v: coding
    variable:
      v: coding
  rule:
    name:
      v: loincSys
    source:
      context:
        v: src
    target:
      context:
        v: coding
      context type:
        v: variable
      element:
        v: system
      transform:
        v: copy
      parameter:
        value: String
  rule:
    name:
      v: measlesIgMCode
    source:
      context:
        v: src
    target:
      context:
        v: coding
      context type:
        v: variable
      element:
        v: code
      transform:
        v: copy
      parameter:
        value: String
  rule:
    name:
      v: measlesIgMDisplay
    source:
      context:
        v: src
    target:
      context:
        v: coding
      context type:
        v: variable
      element:
        v: display
      transform:
        v: copy
      parameter:
        value: String
rule:
  name:
    v: obsText
  source:
    context:
      v: src
  target:
    context:
      v: code
    context type:
      v: variable
    element:
      v: text
    transform:
      v: copy
    parameter:
      value: String
        v: Measles IgM

String
v: 20479-4

String
v: Measles virus IgM Ab [Presence] in Serum

name:
  v: subject
source:
  context:
    v: src
  element:
    v: subject
  variable:
    v: subj
target:
  context:
    v: obs
  context type:
    v: variable
  element:
    v: subject
  variable:
    v: ref
target:
  context:
    v: ref
  context type:
    v: variable
  element:
    v: reference
  transform:
    v: evaluate
  parameter:
    value: String
      v: 'Patient/' + subj.reference

name:
  v: labIdItem
source:
  context:
    v: src
  element:
    v: item
  variable:
    v: item
  condition:
    v: linkId = '8732404074721'
rule:
  name:
    v: labId
  source:
    context:
      v: item
    element:
      v: answer
    list mode:
      v: first
    variable:
      v: ans
  target:
    context:
      v: obs
    context type:
      v: variable
    element:
      v: identifier
    variable:
      v: id
  rule:
    name:
      v: labIdSys
    source:
      context:
        v: ans
    target:
      context:
        v: id
      context type:
        v: variable
      element:
        v: system
      transform:
        v: copy
      parameter:
        value: String
  rule:
    name:
      v: labIdValue
    source:
      context:
        v: ans
    target:
      context:
        v: id
      context type:
        v: variable
      element:
        v: value
      transform:
        v: copy
      parameter:
        value: Id

Id
v: ans.valueString

name:
  v: specimenSentDate
source:
  context:
    v: src
  element:
    v: item
  variable:
    v: item
  condition:
    v: linkId = '718251724172'
rule:
  name:
    v: effectiveDate
  source:
    context:
      v: item
    element:
      v: answer
    list mode:
      v: first
    variable:
      v: ans
  target:
    context:
      v: obs
    context type:
      v: variable
    element:
      v: effective
    transform:
      v: copy
    parameter:
      value: Id
        v: ans.valueDate

name:
  v: receivedDate
source:
  context:
    v: src
  element:
    v: item
  variable:
    v: item
  condition:
    v: linkId = 'date-specimen-received'
rule:
  name:
    v: issued
  source:
    context:
      v: item
    element:
      v: answer
    list mode:
      v: first
    variable:
      v: ans
  target:
    context:
      v: obs
    context type:
      v: variable
    element:
      v: issued
    transform:
      v: copy
    parameter:
      value: Id
        v: ans.valueDate

name:
  v: specimenCondition
source:
  context:
    v: src
  element:
    v: item
  variable:
    v: item
  condition:
    v: linkId = 'specimen-condition'
rule:
  name:
    v: conditionNote
  source:
    context:
      v: item
    element:
      v: answer
    list mode:
      v: first
    variable:
      v: ans
  target:
    context:
      v: obs
    context type:
      v: variable
    element:
      v: note
    variable:
      v: note
  target:
    context:
      v: note
    context type:
      v: variable
    element:
      v: text
    transform:
      v: evaluate
    parameter:
      value: String
        v: 'Specimen condition: ' + ans.valueCoding.display

name:
  v: measlesIgMItem
source:
  context:
    v: src
  element:
    v: item
  variable:
    v: item
  condition:
    v: linkId = 'measles-igm'
rule:
  name:
    v: measlesIgMResult
  source:
    context:
      v: item
    element:
      v: answer
    list mode:
      v: first
    variable:
      v: ans
  target:
    context:
      v: obs
    context type:
      v: variable
    element:
      v: valueCodeableConcept
    variable:
      v: coding
  rule:
    name:
      v: resultCoding
    source:
      context:
        v: ans
    target:
      context:
        v: coding
      context type:
        v: variable
      element:
        v: coding
      variable:
        v: cod
    rule:
      name:
        v: resultSys
    rule:
      name:
        v: resultCode
    rule:
      name:
        v: resultDisplay
rule:
  name:
    v: interpretation
  source:
    context:
      v: item
    element:
      v: answer
    list mode:
      v: first
    variable:
      v: ans
  target:
    context:
      v: obs
    context type:
      v: variable
    element:
      v: interpretation
    variable:
      v: interp
  rule:
    name:
      v: posInterp
    source:
      context:
        v: ans
      element:
        v: valueCoding
      variable:
        v: val
      condition:
        v: code = 'Positive'
    target:
      context:
        v: interp
      context type:
        v: variable
      element:
        v: coding
      variable:
        v: cod
    target:
      context:
        v: cod
      context type:
        v: variable
      element:
        v: system
      transform:
        v: copy
      parameter:
        value: String
    target:
      context:
        v: cod
      context type:
        v: variable
      element:
        v: code
      transform:
        v: copy
      parameter:
        value: String
    target:
      context:
        v: cod
      context type:
        v: variable
      element:
        v: display
      transform:
        v: copy
      parameter:
        value: String
  rule:
    name:
      v: negInterp
    source:
      context:
        v: ans
      element:
        v: valueCoding
      variable:
        v: val
      condition:
        v: code = 'Negative'
    target:
      context:
        v: interp
      context type:
        v: variable
      element:
        v: coding
      variable:
        v: cod
    target:
      context:
        v: cod
      context type:
        v: variable
      element:
        v: system
      transform:
        v: copy
      parameter:
        value: String
    target:
      context:
        v: cod
      context type:
        v: variable
      element:
        v: code
      transform:
        v: copy
      parameter:
        value: String
    target:
      context:
        v: cod
      context type:
        v: variable
      element:
        v: display
      transform:
        v: copy
      parameter:
        value: String
  rule:
    name:
      v: indInterp
    source:
      context:
        v: ans
      element:
        v: valueCoding
      variable:
        v: val
      condition:
        v: code = 'Indeterminate'
    target:
      context:
        v: interp
      context type:
        v: variable
      element:
        v: coding

v: ans

v: cod

v: variable

v: system

v: copy

v: ans

v: cod

v: variable

v: code

v: evaluate

value: String
  v: ans.valueCoding.code

v: ans

v: cod

v: variable

v: display

v: evaluate

value: String
  v: ans.valueCoding.display

String
v: POS

String
v: Positive

String
v: NEG

String
v: Negative

v: cod

context:
  v: cod
context type:
  v: variable
element:
  v: system
transform:
  v: copy
parameter:
  value: String
    v: http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation

context:
  v: cod
context type:
  v: variable
element:
  v: code
transform:
  v: copy
parameter:
  value: String
    v: IND

context:
  v: cod
context type:
  v: variable
element:
  v: display
transform:
  v: copy
parameter:
  value: String
    v: Indeterminate

name:
  v: resultsSentDate
source:
  context:
    v: src
  element:
    v: item
  variable:
    v: item
  condition:
    v: linkId = 'date-lab-sent-results'
rule:
  name:
    v: resultsSentExt
  source:
    context:
      v: item
    element:
      v: answer
    list mode:
      v: first
    variable:
      v: ans
  target:
    context:
      v: obs
    context type:
      v: variable
    element:
      v: extension
    variable:
      v: ext
  rule:
    name:
      v: extUrl
    source:
      context:
        v: ans
    target:
      context:
        v: ext
      context type:
        v: variable
      element:
        v: url
      transform:
        v: copy
      parameter:
        value: String
  rule:
    name:
      v: extValue
    source:
      context:
        v: ans
    target:
      context:
        v: ext
      context type:
        v: variable
      element:
        v: valueDate
      transform:
        v: copy
      parameter:
        value: Id

Id
v: ans.valueDate

name:
  v: regionalLabDate
source:
  context:
    v: src
  element:
    v: item
  variable:
    v: item
  condition:
    v: linkId = '655865451155'
rule:
  name:
    v: regionalLabExt
  source:
    context:
      v: item
    element:
      v: answer
    list mode:
      v: first
    variable:
      v: ans
  target:
    context:
      v: obs
    context type:
      v: variable
    element:
      v: extension
    variable:
      v: ext
  rule:
    name:
      v: extUrl
    source:
      context:
        v: ans
    target:
      context:
        v: ext
      context type:
        v: variable
      element:
        v: url
      transform:
        v: copy
      parameter:
        value: String
  rule:
    name:
      v: extValue
    source:
      context:
        v: ans
    target:
      context:
        v: ext
      context type:
        v: variable
      element:
        v: valueDate
      transform:
        v: copy
      parameter:
        value: Id

Id
v: ans.valueDate

name:
  v: finalClassification
source:
  context:
    v: src
  element:
    v: item
  variable:
    v: item
  condition:
    v: linkId = 'final-classification'
rule:
  name:
    v: classificationNote
  source:
    context:
      v: item
    element:
      v: answer
    list mode:
      v: first
    variable:
      v: ans
  target:
    context:
      v: obs
    context type:
      v: variable
    element:
      v: note
    variable:
      v: note
  target:
    context:
      v: note
    context type:
      v: variable
    element:
      v: text
    transform:
      v: evaluate
    parameter:
      value: String
        v: 'Final classification: ' + ans.valueCoding.display

name:
  v: MapRubellaIgM
type mode:
  v: none
input:
  name:
    v: src
  type:
    v: QuestionnaireResponse
  mode:
    v: source
input:
  name:
    v: obs
  type:
    v: Observation
  mode:
    v: target
rule:
  name:
    v: obsId
  source:
    context:
      v: src
  target:
    context:
      v: obs
    context type:
      v: variable
    element:
      v: id
    transform:
      v: uuid
rule:
  name:
    v: status
  source:
    context:
      v: src
  target:
    context:
      v: obs
    context type:
      v: variable
    element:
      v: status
    transform:
      v: copy
    parameter:
      value: String
        v: final
rule:
  name:
    v: codeBlock
  source:
    context:
      v: src
  target:
    context:
      v: obs
    context type:
      v: variable
    element:
      v: code
    variable:
      v: code
  rule:
    name:
      v: rubellaIgMCoding
    source:
      context:
        v: src
    target:
      context:
        v: code
      context type:
        v: variable
      element:
        v: coding
      variable:
        v: coding
    rule:
      name:
        v: loincSys
    rule:
      name:
        v: rubellaIgMCode
    rule:
      name:
        v: rubellaIgMDisplay
  rule:
    name:
      v: obsText
    source:
      context:
        v: src
    target:
      context:
        v: code
      context type:
        v: variable
      element:
        v: text
      transform:
        v: copy
      parameter:
        value: String
rule:
  name:
    v: subject
  source:
    context:
      v: src
    element:
      v: subject
    variable:
      v: subj
  target:
    context:
      v: obs
    context type:
      v: variable
    element:
      v: subject
    variable:
      v: ref
  target:
    context:
      v: ref
    context type:
      v: variable
    element:
      v: reference
    transform:
      v: evaluate
    parameter:
      value: String
        v: 'Patient/' + subj.reference
rule:
  name:
    v: labIdItem
  source:
    context:
      v: src
    element:
      v: item
    variable:
      v: item
    condition:
      v: linkId = '8732404074721'
  rule:
    name:
      v: labId
    source:
      context:
        v: item
      element:
        v: answer
      list mode:
        v: first
      variable:
        v: ans
    target:
      context:
        v: obs
      context type:
        v: variable
      element:
        v: identifier
      variable:
        v: id
    rule:
      name:
        v: labIdSys
    rule:
      name:
        v: labIdValue
rule:
  name:
    v: receivedDate
  source:
    context:
      v: src
    element:
      v: item
    variable:
      v: item
    condition:
      v: linkId = 'date-specimen-received'
  rule:
    name:
      v: effectiveDate
    source:
      context:
        v: item
      element:
        v: answer
      list mode:
        v: first
      variable:
        v: ans
    target:
      context:
        v: obs

v: src

v: coding

v: variable

v: system

v: copy

v: src

v: coding

v: variable

v: code

v: copy

value: String
  v: 22501-3

v: src

v: coding

v: variable

v: display

v: copy

value: String
  v: Rubella virus IgM Ab [Presence] in Serum

String
v: Rubella IgM

v: ans

v: id

v: variable

v: system

v: copy

v: ans

v: id

v: variable

v: value

v: copy

value: Id
  v: ans.valueString

v: variable

v: effective

v: copy

value: Id
  v: ans.valueDate

name:
  v: rubellaIgMItem
source:
  context:
    v: src
  element:
    v: item
  variable:
    v: item
  condition:
    v: linkId = 'rubella-igm'
rule:
  name:
    v: rubellaIgMResult
  source:
    context:
      v: item
    element:
      v: answer
    list mode:
      v: first
    variable:
      v: ans
  target:
    context:
      v: obs
    context type:
      v: variable
    element:
      v: valueCodeableConcept
    variable:
      v: coding
  rule:
    name:
      v: resultCoding
    source:
      context:
        v: ans
    target:
      context:
        v: coding
      context type:
        v: variable
      element:
        v: coding
      variable:
        v: cod
    rule:
      name:
        v: resultSys
    rule:
      name:
        v: resultCode
    rule:
      name:
        v: resultDisplay
rule:
  name:
    v: interpretation
  source:
    context:
      v: item
    element:
      v: answer
    list mode:
      v: first
    variable:
      v: ans
  target:
    context:
      v: obs
    context type:
      v: variable
    element:
      v: interpretation
    variable:
      v: interp
  rule:
    name:
      v: posInterp
    source:
      context:
        v: ans
      element:
        v: valueCoding
      variable:
        v: val
      condition:
        v: code = 'Positive'
    target:
      context:
        v: interp
      context type:
        v: variable
      element:
        v: coding
      variable:
        v: cod
    target:
      context:
        v: cod
      context type:
        v: variable
      element:
        v: system
      transform:
        v: copy
      parameter:
        value: String
    target:
      context:
        v: cod
      context type:
        v: variable
      element:
        v: code
      transform:
        v: copy
      parameter:
        value: String
    target:
      context:
        v: cod
      context type:
        v: variable
      element:
        v: display
      transform:
        v: copy
      parameter:
        value: String
  rule:
    name:
      v: negInterp
    source:
      context:
        v: ans
      element:
        v: valueCoding
      variable:
        v: val
      condition:
        v: code = 'Negative'
    target:
      context:
        v: interp
      context type:
        v: variable
      element:
        v: coding
      variable:
        v: cod
    target:
      context:
        v: cod
      context type:
        v: variable
      element:
        v: system
      transform:
        v: copy
      parameter:
        value: String
    target:
      context:
        v: cod
      context type:
        v: variable
      element:
        v: code
      transform:
        v: copy
      parameter:
        value: String
    target:
      context:
        v: cod
      context type:
        v: variable
      element:
        v: display
      transform:
        v: copy
      parameter:
        value: String
  rule:
    name:
      v: indInterp
    source:
      context:
        v: ans
      element:
        v: valueCoding
      variable:
        v: val
      condition:
        v: code = 'Indeterminate'
    target:
      context:
        v: interp
      context type:
        v: variable
      element:
        v: coding

v: ans

v: cod

v: variable

v: system

v: copy

v: ans

v: cod

v: variable

v: code

v: evaluate

value: String
  v: ans.valueCoding.code

v: ans

v: cod

v: variable

v: display

v: evaluate

value: String
  v: ans.valueCoding.display

String
v: POS

String
v: Positive

String
v: NEG

String
v: Negative

v: cod

context:
  v: cod
context type:
  v: variable
element:
  v: system
transform:
  v: copy
parameter:
  value: String
    v: http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation

context:
  v: cod
context type:
  v: variable
element:
  v: code
transform:
  v: copy
parameter:
  value: String
    v: IND

context:
  v: cod
context type:
  v: variable
element:
  v: display
transform:
  v: copy
parameter:
  value: String
    v: Indeterminate

name:
  v: rubellaNotDone
source:
  context:
    v: src
  element:
    v: item
  variable:
    v: item
  condition:
    v: linkId = 'rubella-igm'
rule:
  name:
    v: notDone
  source:
    context:
      v: item
    condition:
      v: answer.empty()
  target:
    context:
      v: obs
    context type:
      v: variable
    element:
      v: status
    transform:
      v: copy
    parameter:
      value: String
        v: cancelled
  target:
    context:
      v: obs
    context type:
      v: variable
    element:
      v: dataAbsentReason
    variable:
      v: reason
  target:
    context:
      v: reason
    context type:
      v: variable
    element:
      v: coding
    variable:
      v: cod
  target:
    context:
      v: cod
    context type:
      v: variable
    element:
      v: system
    transform:
      v: copy
    parameter:
      value: String
        v: http://terminology.hl7.org/CodeSystem/data-absent-reason
  target:
    context:
      v: cod
    context type:
      v: variable
    element:
      v: code
    transform:
      v: copy
    parameter:
      value: String
        v: not-performed

name:
  v: MapLabDiagnosticReport
type mode:
  v: none
input:
  name:
    v: src
  type:
    v: QuestionnaireResponse
  mode:
    v: source
input:
  name:
    v: report
  type:
    v: DiagnosticReport
  mode:
    v: target
rule:
  name:
    v: reportId
  source:
    context:
      v: src
  target:
    context:
      v: report
    context type:
      v: variable
    element:
      v: id
    transform:
      v: uuid
rule:
  name:
    v: status
  source:
    context:
      v: src
  target:
    context:
      v: report
    context type:
      v: variable
    element:
      v: status
    transform:
      v: copy
    parameter:
      value: String
        v: final
rule:
  name:
    v: category
  source:
    context:
      v: src
  target:
    context:
      v: report
    context type:
      v: variable
    element:
      v: category
    variable:
      v: cat
  rule:
    name:
      v: catCoding
    source:
      context:
        v: src
    target:
      context:
        v: cat
      context type:
        v: variable
      element:
        v: coding
      variable:
        v: coding
    rule:
      name:
        v: catSys
    rule:
      name:
        v: catCode
    rule:
      name:
        v: catDisplay
rule:
  name:
    v: codeBlock
  source:
    context:
      v: src
  target:
    context:
      v: report
    context type:
      v: variable
    element:
      v: code
    variable:
      v: code
  rule:
    name:
      v: panelCoding
    source:
      context:
        v: src
    target:
      context:
        v: code
      context type:
        v: variable
      element:
        v: coding
      variable:
        v: coding
    rule:
      name:
        v: loincSys
    rule:
      name:
        v: panelCode
    rule:
      name:
        v: panelDisplay
  rule:
    name:
      v: codeText
    source:
      context:
        v: src
    target:
      context:
        v: code
      context type:
        v: variable
      element:
        v: text
      transform:
        v: copy
      parameter:
        value: String
rule:
  name:
    v: subject
  source:
    context:
      v: src
    element:
      v: subject
    variable:
      v: subj
  target:
    context:
      v: report
    context type:
      v: variable
    element:
      v: subject
    variable:
      v: ref
  target:
    context:
      v: ref
    context type:
      v: variable
    element:
      v: reference
    transform:
      v: evaluate
    parameter:
      value: String
        v: 'Patient/' + subj.reference
rule:
  name:
    v: labIdItem
  source:
    context:
      v: src
    element:
      v: item
    variable:
      v: item
    condition:
      v: linkId = '8732404074721'
  rule:
    name:
      v: labId
    source:
      context:
        v: item
      element:
        v: answer
      list mode:
        v: first
      variable:
        v: ans
    target:
      context:
        v: report

v: src

v: coding

v: variable

v: system

v: copy

v: src

v: coding

v: variable

v: code

v: copy

value: String
  v: LAB

v: src

v: coding

v: variable

v: display

v: copy

value: String
  v: Laboratory

v: src

v: coding

v: variable

v: system

v: copy

v: src

v: coding

v: variable

v: code

v: copy

value: String
  v: 41852-5

v: src

v: coding

v: variable

v: display

v: copy

value: String
  v: Microorganism or agent identified in Specimen

String
v: Measles/Rubella Serology Panel

v: variable

v: identifier

v: id

name:
  v: labIdSys
source:
  context:
    v: ans
target:
  context:
    v: id
  context type:
    v: variable
  element:
    v: system
  transform:
    v: copy
  parameter:
    value: String
      v: http://example.org/identifier/lab-id

name:
  v: labIdValue
source:
  context:
    v: ans
target:
  context:
    v: id
  context type:
    v: variable
  element:
    v: value
  transform:
    v: copy
  parameter:
    value: Id
      v: ans.valueString

name:
  v: effectiveDate
source:
  context:
    v: src
  element:
    v: item
  variable:
    v: item
  condition:
    v: linkId = 'date-specimen-received'
rule:
  name:
    v: effectiveDate
  source:
    context:
      v: item
    element:
      v: answer
    list mode:
      v: first
    variable:
      v: ans
  target:
    context:
      v: report
    context type:
      v: variable
    element:
      v: effective
    transform:
      v: copy
    parameter:
      value: Id
        v: ans.valueDate

name:
  v: issuedDate
source:
  context:
    v: src
  element:
    v: item
  variable:
    v: item
  condition:
    v: linkId = 'date-lab-sent-results'
rule:
  name:
    v: issued
  source:
    context:
      v: item
    element:
      v: answer
    list mode:
      v: first
    variable:
      v: ans
  target:
    context:
      v: report
    context type:
      v: variable
    element:
      v: issued
    transform:
      v: copy
    parameter:
      value: Id
        v: ans.valueDate

name:
  v: classification
source:
  context:
    v: src
  element:
    v: item
  variable:
    v: item
  condition:
    v: linkId = 'final-classification'
rule:
  name:
    v: conclusion
  source:
    context:
      v: item
    element:
      v: answer
    list mode:
      v: first
    variable:
      v: ans
  target:
    context:
      v: report
    context type:
      v: variable
    element:
      v: conclusion
    transform:
      v: evaluate
    parameter:
      value: String
        v: ans.valueCoding.display
rule:
  name:
    v: conclusionCode
  source:
    context:
      v: item
    element:
      v: answer
    list mode:
      v: first
    variable:
      v: ans
  target:
    context:
      v: report
    context type:
      v: variable
    element:
      v: conclusionCode
    variable:
      v: code
  rule:
    name:
      v: conclusionCode
    source:
      context:
        v: ans
    target:
      context:
        v: code
      context type:
        v: variable
      element:
        v: coding
      variable:
        v: cod
    target:
      context:
        v: cod
      context type:
        v: variable
      element:
        v: system
      transform:
        v: copy
      parameter:
        value: String
    target:
      context:
        v: cod
      context type:
        v: variable
      element:
        v: code
      transform:
        v: evaluate
      parameter:
        value: String
    target:
      context:
        v: cod
      context type:
        v: variable
      element:
        v: display
      transform:
        v: evaluate
      parameter:
        value: String

String
v: ans.valueCoding.code

String
v: ans.valueCoding.display