FHIR © HL7.org  |  FHIRsmith 4.0.1  |  Server Home  |  XIG Home  |  XIG Stats  | 

FHIR IG analytics

Packagesilfhirprofileig
Resource TypeStructureMap
IdStructureMap-ExtractSurgicalSafetyChecklist.json
FHIR VersionR5
Sourcehttps://build.fhir.org/ig/savannahghi/sil_fhir_profile_ig/StructureMap-ExtractSurgicalSafetyChecklist.html
URLhttps://fhir.slade360.co.ke/fhir/StructureMap/ExtractSurgicalSafetyChecklist
Version0.1.0
Statusactive
Date2026-09-11T12:18:36+00:00
NameExtractSurgicalSafetyChecklist
TitleSurgical Safety Checklist Extraction
DescriptionThe checklist out as one Observation per WHO phase, so a sign-out that never happened is a missing resource rather than a resource full of blanks -- which is the only shape that lets a compliance audit tell an unperformed phase from an unticked one. The ward's pre-operative preparation and post-operative checks become two further panels, every investigation ticked becomes a ServiceRequest, the vital signs before and after theatre become their own Observations tagged with which side of theatre they were taken on, and the instrument count gets an Observation of its own because a wrong count is a never event.

Resources that use this resource

No resources found


Resources that this resource uses

No resources found


Narrative

Note: links and images are rebased to the (stated) source

Generated Narrative: StructureMap ExtractSurgicalSafetyChecklist

/// url = 'https://fhir.slade360.co.ke/fhir/StructureMap/ExtractSurgicalSafetyChecklist'
/// name = 'ExtractSurgicalSafetyChecklist'
/// title = 'Surgical Safety Checklist Extraction'
/// status = 'active'
/// description = 'The checklist out as one Observation per WHO phase, so a sign-out that never happened is a missing resource rather than a resource full of blanks -- which is the only shape that lets a compliance audit tell an unperformed phase from an unticked one. The ward\'s pre-operative preparation and post-operative checks become two further panels, every investigation ticked becomes a ServiceRequest, the vital signs before and after theatre become their own Observations tagged with which side of theatre they were taken on, and the instrument count gets an Observation of its own because a wrong count is a never event.'

uses "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse" alias QR as source
uses "http://hl7.org/fhir/StructureDefinition/Bundle" alias Bundle as target
uses "http://hl7.org/fhir/StructureDefinition/Observation" alias Observation as target
uses "http://hl7.org/fhir/StructureDefinition/ServiceRequest" alias ServiceRequest as target

group ExtractSurgicalSafetyChecklist(source qr : QR, target bundle : Bundle) {
  qr -> bundle.type = 'transaction' "setBundleType";
  // ── The three WHO phases ────────────────────────────────────────────────
  // One Observation each. This is the whole design decision on this form: a
  // single Observation with twenty-two components could not distinguish "the
  // team did the sign-out and confirmed nothing" from "the team never did the
  // sign-out", and those are a documentation lapse and a safety failure
  // respectively.
  // Each phase is guarded on at least one of its own items being answered, and
  // carries `Observation.effective` from the phase's own completion time when
  // the team recorded one, so the interval between induction and incision is
  // recoverable.
  qr.item as wg where (linkId = 'who-checklist') then {
    wg.item as g where ((linkId = 'who-checklist/sign-in') and item.answer.value.exists()) ->  bundle.entry as entry,  entry.resource = create('Observation') as obs then {
      qr ->  obs,  entry then BuildObsBase(qr, obs, entry) "base";
      qr -> obs then SetSurveyCategory(qr, obs) "category";
      g -> obs.code as cc then {
        g -> cc.coding as cg then {
          g -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
          g -> cg.code = 'surgical-safety-phase' "cd";
          g -> cg.display = 'Surgical safety checklist phase' "dsp";
        } "coding";
        g -> cc.text = 'Sign in — before induction of anaesthesia' "codeText";
      } "code";
      g -> obs.value = create('CodeableConcept') as vc then {
        g -> vc.coding as vcg then {
          g -> vcg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/answer-codesystem' "sys";
          g -> vcg.code = 'phase-sign-in' "cd";
          g -> vcg.display = 'Sign in — before induction of anaesthesia' "dsp";
        } "coding";
      } "phaseValue";
      // The phase's own completion time, not the form's authored time.
      g.item as ct where ((linkId = 'who-checklist/sign-in/completed-at') and answer.value.exists()) then {
        ct.answer first as a then {
          a.value as t -> obs.effective = t "phaseEffective";
        };
      } "phaseTime";
      g.item as it where ((linkId = 'who-checklist/sign-in/identity-site-procedure-consent') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
            it -> cg.code = 'who-check-patient-confirmed-identity-site-procedure-and' "cd";
            it -> cg.display = 'Patient confirmed identity, site, procedure and consent' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_who_check_patient_confirmed_identity_site_procedure_and";
      g.item as it where ((linkId = 'who-checklist/sign-in/site-marked') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
            it -> cg.code = 'who-check-site-marked' "cd";
            it -> cg.display = 'Site marked' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_who_check_site_marked";
      g.item as it where ((linkId = 'who-checklist/sign-in/anaesthesia-machine-and-medication-check') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
            it -> cg.code = 'who-check-anaesthesia-machine-and-medication-check-complete' "cd";
            it -> cg.display = 'Anaesthesia machine and medication check complete' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_who_check_anaesthesia_machine_and_medication_check_complete";
      g.item as it where ((linkId = 'who-checklist/sign-in/pulse-oximeter-on-and-functioning') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
            it -> cg.code = 'who-check-pulse-oximeter-on-the-patient-and-functioning' "cd";
            it -> cg.display = 'Pulse oximeter on the patient and functioning' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_who_check_pulse_oximeter_on_the_patient_and_functioning";
      g.item as it where ((linkId = 'who-checklist/sign-in/known-allergy-reviewed') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
            it -> cg.code = 'who-check-known-allergy-reviewed' "cd";
            it -> cg.display = 'Known allergy reviewed' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_who_check_known_allergy_reviewed";
      g.item as it where ((linkId = 'who-checklist/sign-in/difficult-airway-or-aspiration-risk') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
            it -> cg.code = 'who-check-difficult-airway-or-aspiration-risk-assessed' "cd";
            it -> cg.display = 'Difficult airway or aspiration risk assessed' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_who_check_difficult_airway_or_aspiration_risk_assessed";
      g.item as it where ((linkId = 'who-checklist/sign-in/blood-loss-risk-over-500ml') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
            it -> cg.code = 'who-check-risk-of-over-500-ml-blood-loss-assessed-access-and' "cd";
            it -> cg.display = 'Risk of over 500 ml blood loss assessed, access and fluids planned' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_who_check_risk_of_over_500_ml_blood_loss_assessed_access_and";
    } "phase_sign_in";
    wg.item as g where ((linkId = 'who-checklist/time-out') and item.answer.value.exists()) ->  bundle.entry as entry,  entry.resource = create('Observation') as obs then {
      qr ->  obs,  entry then BuildObsBase(qr, obs, entry) "base";
      qr -> obs then SetSurveyCategory(qr, obs) "category";
      g -> obs.code as cc then {
        g -> cc.coding as cg then {
          g -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
          g -> cg.code = 'surgical-safety-phase' "cd";
          g -> cg.display = 'Surgical safety checklist phase' "dsp";
        } "coding";
        g -> cc.text = 'Time out — before skin incision' "codeText";
      } "code";
      g -> obs.value = create('CodeableConcept') as vc then {
        g -> vc.coding as vcg then {
          g -> vcg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/answer-codesystem' "sys";
          g -> vcg.code = 'phase-time-out' "cd";
          g -> vcg.display = 'Time out — before skin incision' "dsp";
        } "coding";
      } "phaseValue";
      // The phase's own completion time, not the form's authored time.
      g.item as ct where ((linkId = 'who-checklist/time-out/completed-at') and answer.value.exists()) then {
        ct.answer first as a then {
          a.value as t -> obs.effective = t "phaseEffective";
        };
      } "phaseTime2";
      g.item as it where ((linkId = 'who-checklist/time-out/team-introductions') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
            it -> cg.code = 'who-check-all-team-members-introduced-by-name-and-role' "cd";
            it -> cg.display = 'All team members introduced by name and role' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_who_check_all_team_members_introduced_by_name_and_role";
      g.item as it where ((linkId = 'who-checklist/time-out/confirm-patient-procedure-incision') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
            it -> cg.code = 'who-check-patient-procedure-and-incision-site-confirmed' "cd";
            it -> cg.display = 'Patient, procedure and incision site confirmed' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_who_check_patient_procedure_and_incision_site_confirmed";
      g.item as it where ((linkId = 'who-checklist/time-out/antibiotic-prophylaxis-within-60-minutes') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
            it -> cg.code = 'who-check-antibiotic-prophylaxis-given-within-the-last-60' "cd";
            it -> cg.display = 'Antibiotic prophylaxis given within the last 60 minutes' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_who_check_antibiotic_prophylaxis_given_within_the_last_60";
      g.item as it where ((linkId = 'who-checklist/time-out/critical-steps-reviewed') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
            it -> cg.code = 'who-check-critical-or-non-routine-steps-reviewed' "cd";
            it -> cg.display = 'Critical or non-routine steps reviewed' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_who_check_critical_or_non_routine_steps_reviewed";
      g.item as it where ((linkId = 'who-checklist/time-out/case-duration-reviewed') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
            it -> cg.code = 'who-check-case-duration-reviewed' "cd";
            it -> cg.display = 'Case duration reviewed' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_who_check_case_duration_reviewed";
      g.item as it where ((linkId = 'who-checklist/time-out/anticipated-blood-loss-reviewed') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
            it -> cg.code = 'who-check-anticipated-blood-loss-reviewed' "cd";
            it -> cg.display = 'Anticipated blood loss reviewed' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_who_check_anticipated_blood_loss_reviewed";
      g.item as it where ((linkId = 'who-checklist/time-out/anaesthetist-patient-specific-concerns') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
            it -> cg.code = 'who-check-anaesthetist-s-patient-specific-concerns-reviewed' "cd";
            it -> cg.display = 'Anaesthetist\'s patient-specific concerns reviewed' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_who_check_anaesthetist_s_patient_specific_concerns_reviewed";
      g.item as it where ((linkId = 'who-checklist/time-out/sterility-confirmed') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
            it -> cg.code = 'who-check-sterility-including-indicator-results-confirmed' "cd";
            it -> cg.display = 'Sterility, including indicator results, confirmed' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_who_check_sterility_including_indicator_results_confirmed";
      g.item as it where ((linkId = 'who-checklist/time-out/equipment-issues-reviewed') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
            it -> cg.code = 'who-check-equipment-issues-or-concerns-reviewed' "cd";
            it -> cg.display = 'Equipment issues or concerns reviewed' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_who_check_equipment_issues_or_concerns_reviewed";
      g.item as it where ((linkId = 'who-checklist/time-out/essential-imaging-displayed') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
            it -> cg.code = 'who-check-essential-imaging-displayed' "cd";
            it -> cg.display = 'Essential imaging displayed' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_who_check_essential_imaging_displayed";
    } "phase_time_out";
    wg.item as g where ((linkId = 'who-checklist/sign-out') and item.answer.value.exists()) ->  bundle.entry as entry,  entry.resource = create('Observation') as obs then {
      qr ->  obs,  entry then BuildObsBase(qr, obs, entry) "base";
      qr -> obs then SetSurveyCategory(qr, obs) "category";
      g -> obs.code as cc then {
        g -> cc.coding as cg then {
          g -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
          g -> cg.code = 'surgical-safety-phase' "cd";
          g -> cg.display = 'Surgical safety checklist phase' "dsp";
        } "coding";
        g -> cc.text = 'Sign out — before the patient leaves the operating room' "codeText";
      } "code";
      g -> obs.value = create('CodeableConcept') as vc then {
        g -> vc.coding as vcg then {
          g -> vcg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/answer-codesystem' "sys";
          g -> vcg.code = 'phase-sign-out' "cd";
          g -> vcg.display = 'Sign out — before the patient leaves the operating room' "dsp";
        } "coding";
      } "phaseValue";
      // The phase's own completion time, not the form's authored time.
      g.item as ct where ((linkId = 'who-checklist/sign-out/completed-at') and answer.value.exists()) then {
        ct.answer first as a then {
          a.value as t -> obs.effective = t "phaseEffective";
        };
      } "phaseTime3";
      g.item as it where ((linkId = 'who-checklist/sign-out/procedure-name-recorded') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
            it -> cg.code = 'who-check-name-of-the-procedure-verbally-confirmed' "cd";
            it -> cg.display = 'Name of the procedure verbally confirmed' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_who_check_name_of_the_procedure_verbally_confirmed";
      g.item as it where ((linkId = 'who-checklist/sign-out/counts-complete') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
            it -> cg.code = 'who-check-instrument-sponge-and-needle-counts-complete' "cd";
            it -> cg.display = 'Instrument, sponge and needle counts complete' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_who_check_instrument_sponge_and_needle_counts_complete";
      g.item as it where ((linkId = 'who-checklist/sign-out/specimen-labelling') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
            it -> cg.code = 'who-check-specimen-labelling-read-aloud-including-the-patient' "cd";
            it -> cg.display = 'Specimen labelling read aloud, including the patient name' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_who_check_specimen_labelling_read_aloud_including_the_patient";
      g.item as it where ((linkId = 'who-checklist/sign-out/equipment-problems-addressed') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
            it -> cg.code = 'who-check-equipment-problems-to-be-addressed-identified' "cd";
            it -> cg.display = 'Equipment problems to be addressed identified' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_who_check_equipment_problems_to_be_addressed_identified";
      g.item as it where ((linkId = 'who-checklist/sign-out/recovery-key-concerns') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
            it -> cg.code = 'who-check-key-concerns-for-recovery-and-management-reviewed' "cd";
            it -> cg.display = 'Key concerns for recovery and management reviewed' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_who_check_key_concerns_for_recovery_and_management_reviewed";
    } "phase_sign_out";
  } "whoChecklistGroup";
  // ── The instrument, sponge and needle count ─────────────────────────────
  // Lifted out of the sign-out panel into an Observation of its own. An
  // incorrect count is a never event and a retained item is a serious incident;
  // a fact that triggers an incident report has to be findable by its own code
  // and not only by reading a twenty-two-component panel.
  qr.item as wg where (linkId = 'who-checklist') then {
    wg.item as g where (linkId = 'who-checklist/sign-out') then {
      g.item as it where ((linkId = 'who-checklist/sign-out/counts-complete') and answer.value.exists()) ->  bundle.entry as entry,  entry.resource = create('Observation') as obs then {
        qr ->  obs,  entry then BuildObsBase(qr, obs, entry) "base";
        qr -> obs then SetSurveyCategory(qr, obs) "category";
        it -> obs.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
            it -> cg.code = 'instrument-count-complete' "cd";
            it -> cg.display = 'Instrument, sponge and needle count complete' "dsp";
          } "coding";
        } "code";
        it.answer first as a then {
          a.value as cv -> obs.value = create('CodeableConcept') as vc then {
            cv -> vc.coding = cv "valueCoding";
            cv.display as d -> vc.text = d "valueText";
          } "codedValue";
        };
        // Anything other than a confirmed count is abnormal. Stated, not left
        // to a reader: this is the flag a theatre audit filters on.
        it.answer first as a then {
          a.value as cv where (code != 'check-confirmed') -> obs.interpretation as interp then {
            cv -> interp.coding as icg then {
              cv -> icg.system = 'http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation' "sys";
              cv -> icg.code = 'A' "cd";
              cv -> icg.display = 'Abnormal' "dsp";
            } "coding";
          } "abnormal";
        } "countInterpretation";
      } "instrumentCountObservation";
    } "signOutSub";
  } "instrumentCountGroup";
  // ── The ward's pre-operative preparation ────────────────────────────────
  qr.item as pg where (linkId = 'pre-operative') then {
    pg.item as g where ((linkId = 'pre-operative/preparation') and item.answer.value.exists()) ->  bundle.entry as entry,  entry.resource = create('Observation') as obs then {
      qr ->  obs,  entry then BuildObsBase(qr, obs, entry) "base";
      qr -> obs then SetSurveyCategory(qr, obs) "category";
      g -> obs.code as cc then {
        g -> cc.coding as cg then {
          g -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
          g -> cg.code = 'preoperative-preparation' "cd";
          g -> cg.display = 'Pre-operative preparation completed' "dsp";
        } "coding";
      } "code";
      g.item as it where ((linkId = 'pre-operative/preparation/fasting') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
            it -> cg.code = 'preop-fasting' "cd";
            it -> cg.display = 'Fasting' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_preop_fasting";
      g.item as it where ((linkId = 'pre-operative/preparation/dentures-removed') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
            it -> cg.code = 'preop-dentures-removed' "cd";
            it -> cg.display = 'Dentures removed' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_preop_dentures_removed";
      g.item as it where ((linkId = 'pre-operative/preparation/jewellery-removed') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
            it -> cg.code = 'preop-jewellery-removed' "cd";
            it -> cg.display = 'Jewellery removed' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_preop_jewellery_removed";
      g.item as it where ((linkId = 'pre-operative/preparation/artificial-limb-removed') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
            it -> cg.code = 'preop-artificial-limb-removed' "cd";
            it -> cg.display = 'Artificial limb removed' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_preop_artificial_limb_removed";
      g.item as it where ((linkId = 'pre-operative/preparation/nail-varnish-removed') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
            it -> cg.code = 'preop-nail-varnish-removed' "cd";
            it -> cg.display = 'Nail varnish removed' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_preop_nail_varnish_removed";
      g.item as it where ((linkId = 'pre-operative/preparation/shaving') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
            it -> cg.code = 'preop-shaving' "cd";
            it -> cg.display = 'Shaving' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_preop_shaving";
      g.item as it where ((linkId = 'pre-operative/preparation/bath') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
            it -> cg.code = 'preop-bath' "cd";
            it -> cg.display = 'Bath' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_preop_bath";
      g.item as it where ((linkId = 'pre-operative/preparation/theatre-gown') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
            it -> cg.code = 'preop-theatre-gown' "cd";
            it -> cg.display = 'Theatre gown' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_preop_theatre_gown";
      g.item as it where ((linkId = 'pre-operative/preparation/skin-cleaned') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
            it -> cg.code = 'preop-skin-cleaned' "cd";
            it -> cg.display = 'Skin cleaned' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_preop_skin_cleaned";
    } "preparationPanel";
    // Lines and tubes in place. A separate panel from the preparation checklist
    // because these are devices the theatre has to know about, not tasks the
    // ward has to have finished.
    pg.item as g where ((linkId = 'pre-operative/lines') and item.answer.value.exists()) ->  bundle.entry as entry,  entry.resource = create('Observation') as obs then {
      qr ->  obs,  entry then BuildObsBase(qr, obs, entry) "base";
      qr -> obs then SetExamCategory(qr, obs) "category";
      g -> obs.code as cc then {
        g -> cc.coding as cg then {
          g -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
          g -> cg.code = 'preop-lines-and-tubes-in-place-before-theatre' "cd";
          g -> cg.display = 'Lines and tubes in place before theatre' "dsp";
        } "coding";
      } "code";
      g.item as it where ((linkId = 'pre-operative/lines/catheter') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
            it -> cg.code = 'preop-catheter' "cd";
            it -> cg.display = 'Catheter' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_preop_catheter";
      g.item as it where ((linkId = 'pre-operative/lines/nasogastric-tube') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
            it -> cg.code = 'preop-nasogastric-tube' "cd";
            it -> cg.display = 'Nasogastric tube' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_preop_nasogastric_tube";
      g.item as it where ((linkId = 'pre-operative/lines/intravenous-infusion') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
            it -> cg.code = 'preop-intravenous-infusion' "cd";
            it -> cg.display = 'Intravenous infusion' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_preop_intravenous_infusion";
      g.item as it where (linkId = 'pre-operative/lines/other') then {
        it.answer first as a then {
          a.value as txt ->  obs.note as n,  n.text = txt "text";
        };
      } "note";
    } "linesPanel";
    // Blood requested, and how many pints are actually available. Two facts, and
    // the second is the one that stops a case: a request with no units against
    // it is not blood in the fridge.
    pg.item as g where ((linkId = 'pre-operative/blood') and item.answer.value.exists()) ->  bundle.entry as entry,  entry.resource = create('Observation') as obs then {
      qr ->  obs,  entry then BuildObsBase(qr, obs, entry) "base";
      qr -> obs then SetSurveyCategory(qr, obs) "category";
      g -> obs.code as cc then {
        g -> cc.coding as cg then {
          g -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
          g -> cg.code = 'preop-blood-requested-and-available-before-theatre' "cd";
          g -> cg.display = 'Blood requested and available before theatre' "dsp";
        } "coding";
      } "code";
      g.item as it where ((linkId = 'pre-operative/blood/requested') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
            it -> cg.code = 'preop-blood-requested' "cd";
            it -> cg.display = 'Blood requested' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_preop_blood_requested";
      g.item as it where ((linkId = 'pre-operative/blood/pints-available') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
            it -> cg.code = 'preop-pints-available' "cd";
            it -> cg.display = 'Pints available' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentValue(it, comp) "value";
      } "comp_preop_pints_available";
    } "bloodPanel";
  } "preOperativeGroup";
  // ── The post-operative checks ───────────────────────────────────────────
  qr.item as g where ((linkId = 'post-operative') and item.answer.value.exists()) ->  bundle.entry as entry,  entry.resource = create('Observation') as obs then {
    qr ->  obs,  entry then BuildObsBase(qr, obs, entry) "base";
    qr -> obs then SetExamCategory(qr, obs) "category";
    g -> obs.code as cc then {
      g -> cc.coding as cg then {
        g -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
        g -> cg.code = 'postoperative-check' "cd";
        g -> cg.display = 'Post-operative check' "dsp";
      } "coding";
    } "code";
    g.item as it where ((linkId = 'post-operative/wound') and answer.value.exists()) -> obs.component as comp then {
      it -> comp.code as cc then {
        it -> cc.coding as cg then {
          it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
          it -> cg.code = 'postop-wound-checked' "cd";
          it -> cg.display = 'Wound checked' "dsp";
        } "coding";
      } "code";
      it -> comp then SetComponentCodedValue(it, comp) "value";
    } "comp_postop_wound_checked";
    g.item as it where ((linkId = 'post-operative/drainage') and answer.value.exists()) -> obs.component as comp then {
      it -> comp.code as cc then {
        it -> cc.coding as cg then {
          it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
          it -> cg.code = 'postop-drainage-checked' "cd";
          it -> cg.display = 'Drainage checked' "dsp";
        } "coding";
      } "code";
      it -> comp then SetComponentCodedValue(it, comp) "value";
    } "comp_postop_drainage_checked";
    g.item as it where ((linkId = 'post-operative/vomit') and answer.value.exists()) -> obs.component as comp then {
      it -> comp.code as cc then {
        it -> cc.coding as cg then {
          it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
          it -> cg.code = 'postop-vomiting-checked' "cd";
          it -> cg.display = 'Vomiting checked' "dsp";
        } "coding";
      } "code";
      it -> comp then SetComponentCodedValue(it, comp) "value";
    } "comp_postop_vomiting_checked";
    g.item as it where ((linkId = 'post-operative/catheter') and answer.value.exists()) -> obs.component as comp then {
      it -> comp.code as cc then {
        it -> cc.coding as cg then {
          it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
          it -> cg.code = 'postop-catheter-in-place' "cd";
          it -> cg.display = 'Catheter in place' "dsp";
        } "coding";
      } "code";
      it -> comp then SetComponentCodedValue(it, comp) "value";
    } "comp_postop_catheter_in_place";
    g.item as it where ((linkId = 'post-operative/nasogastric-tube') and answer.value.exists()) -> obs.component as comp then {
      it -> comp.code as cc then {
        it -> cc.coding as cg then {
          it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
          it -> cg.code = 'postop-nasogastric-tube-in-place' "cd";
          it -> cg.display = 'Nasogastric tube in place' "dsp";
        } "coding";
      } "code";
      it -> comp then SetComponentCodedValue(it, comp) "value";
    } "comp_postop_nasogastric_tube_in_place";
    g.item as it where ((linkId = 'post-operative/infusion-therapy') and answer.value.exists()) -> obs.component as comp then {
      it -> comp.code as cc then {
        it -> cc.coding as cg then {
          it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
          it -> cg.code = 'postop-infusion-therapy-running' "cd";
          it -> cg.display = 'Infusion therapy running' "dsp";
        } "coding";
      } "code";
      it -> comp then SetComponentCodedValue(it, comp) "value";
    } "comp_postop_infusion_therapy_running";
    g.item as it where ((linkId = 'post-operative/oxygen-therapy') and answer.value.exists()) -> obs.component as comp then {
      it -> comp.code as cc then {
        it -> cc.coding as cg then {
          it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
          it -> cg.code = 'postop-oxygen-therapy-running' "cd";
          it -> cg.display = 'Oxygen therapy running' "dsp";
        } "coding";
      } "code";
      it -> comp then SetComponentCodedValue(it, comp) "value";
    } "comp_postop_oxygen_therapy_running";
    g.item as it where ((linkId = 'post-operative/analgesic-therapy') and answer.value.exists()) -> obs.component as comp then {
      it -> comp.code as cc then {
        it -> cc.coding as cg then {
          it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
          it -> cg.code = 'postop-analgesic-therapy-given' "cd";
          it -> cg.display = 'Analgesic therapy given' "dsp";
        } "coding";
      } "code";
      it -> comp then SetComponentCodedValue(it, comp) "value";
    } "comp_postop_analgesic_therapy_given";
    g.item as it where ((linkId = 'post-operative/pain') and answer.value.exists()) -> obs.component as comp then {
      it -> comp.code as cc then {
        it -> cc.coding as cg then {
          it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
          it -> cg.code = 'postop-pain' "cd";
          it -> cg.display = 'Pain' "dsp";
        } "coding";
      } "code";
      it -> comp then SetComponentCodedValue(it, comp) "value";
    } "comp_postop_pain";
    g.item as it where ((linkId = 'post-operative/level-of-consciousness') and answer.value.exists()) -> obs.component as comp then {
      it -> comp.code as cc then {
        it -> cc.coding as cg then {
          it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
          it -> cg.code = 'postop-level-of-consciousness' "cd";
          it -> cg.display = 'Level of consciousness' "dsp";
        } "coding";
      } "code";
      it -> comp then SetComponentCodedValue(it, comp) "value";
    } "comp_postop_level_of_consciousness";
    g.item as it where ((linkId = 'post-operative/checklist-complete') and answer.value.exists()) -> obs.component as comp then {
      it -> comp.code as cc then {
        it -> cc.coding as cg then {
          it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
          it -> cg.code = 'postop-check-list-operative-complete' "cd";
          it -> cg.display = 'Check-list operative complete' "dsp";
        } "coding";
      } "code";
      it -> comp then SetComponentCodedValue(it, comp) "value";
    } "comp_postop_check_list_operative_complete";
  } "postOperativePanel";
  // ── Vital signs, before and after ───────────────────────────────────────
  // The same six readings twice. Each Observation carries a note saying which
  // side of theatre it came from, because both sets have the same LOINC codes
  // and the response's authored time is one instant for the whole form -- so
  // without the note a ward could not tell the pre-operative pulse from the
  // post-operative one.
  qr.item as g where (linkId = 'pre-operative') then {
    g.item as g2 where (linkId = 'pre-operative/vitals') then {
      g2.item as it where ((linkId = 'pre-operative/vitals/temperature') and answer.value.exists()) ->  bundle.entry as entry,  entry.resource = create('Observation') as obs then {
        qr ->  obs,  entry then BuildObsBase(qr, obs, entry) "base";
        qr -> obs then SetVitalSignsCategory(qr, obs) "category";
        it -> obs.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'http://loinc.org' "sys";
            it -> cg.code = '8310-5' "cd";
            it -> cg.display = 'Body temperature' "dsp";
          } "coding";
        } "code";
        it.answer first as a then {
          a.value as v -> obs.value = v "set";
        };
        it ->  obs.note as n,  n.text = 'Taken before theatre' "phaseNote";
      } "vital_8310_5";
      g2.item as it where ((linkId = 'pre-operative/vitals/pulse') and answer.value.exists()) ->  bundle.entry as entry,  entry.resource = create('Observation') as obs then {
        qr ->  obs,  entry then BuildObsBase(qr, obs, entry) "base";
        qr -> obs then SetVitalSignsCategory(qr, obs) "category";
        it -> obs.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'http://loinc.org' "sys";
            it -> cg.code = '8867-4' "cd";
            it -> cg.display = 'Heart rate' "dsp";
          } "coding";
        } "code";
        it.answer first as a then {
          a.value as v -> obs.value = v "set";
        };
        it ->  obs.note as n,  n.text = 'Taken before theatre' "phaseNote";
      } "vital_8867_4";
      g2.item as it where ((linkId = 'pre-operative/vitals/respiratory-rate') and answer.value.exists()) ->  bundle.entry as entry,  entry.resource = create('Observation') as obs then {
        qr ->  obs,  entry then BuildObsBase(qr, obs, entry) "base";
        qr -> obs then SetVitalSignsCategory(qr, obs) "category";
        it -> obs.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'http://loinc.org' "sys";
            it -> cg.code = '9279-1' "cd";
            it -> cg.display = 'Respiratory rate' "dsp";
          } "coding";
        } "code";
        it.answer first as a then {
          a.value as v -> obs.value = v "set";
        };
        it ->  obs.note as n,  n.text = 'Taken before theatre' "phaseNote";
      } "vital_9279_1";
      g2.item as it where ((linkId = 'pre-operative/vitals/oxygen-saturation') and answer.value.exists()) ->  bundle.entry as entry,  entry.resource = create('Observation') as obs then {
        qr ->  obs,  entry then BuildObsBase(qr, obs, entry) "base";
        qr -> obs then SetVitalSignsCategory(qr, obs) "category";
        it -> obs.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'http://loinc.org' "sys";
            it -> cg.code = '59408-5' "cd";
            it -> cg.display = 'Oxygen saturation in Arterial blood by Pulse oximetry' "dsp";
          } "coding";
        } "code";
        it.answer first as a then {
          a.value as v -> obs.value = v "set";
        };
        it ->  obs.note as n,  n.text = 'Taken before theatre' "phaseNote";
      } "vital_59408_5";
      g2.item as bp where ((linkId = 'pre-operative/vitals/blood-pressure') and item.answer.value.exists()) ->  bundle.entry as entry,  entry.resource = create('Observation') as obs then {
        qr ->  obs,  entry then BuildObsBase(qr, obs, entry) "base";
        qr -> obs then SetVitalSignsCategory(qr, obs) "category";
        bp -> obs.code as cc then {
          bp -> cc.coding as cg then {
            bp -> cg.system = 'http://loinc.org' "sys";
            bp -> cg.code = '85354-9' "cd";
            bp -> cg.display = 'Blood pressure panel with all children optional' "dsp";
          } "coding";
        } "code";
        bp.item as it where ((linkId = 'pre-operative/vitals/blood-pressure/systolic') and answer.value.exists()) -> obs.component as comp then {
          it -> comp.code as cc then {
            it -> cc.coding as cg then {
              it -> cg.system = 'http://loinc.org' "sys";
              it -> cg.code = '8480-6' "cd";
              it -> cg.display = 'Systolic blood pressure' "dsp";
            } "coding";
          } "code";
          it -> comp then SetComponentValue(it, comp) "value";
        } "comp_8480_6";
        bp.item as it where ((linkId = 'pre-operative/vitals/blood-pressure/diastolic') and answer.value.exists()) -> obs.component as comp then {
          it -> comp.code as cc then {
            it -> cc.coding as cg then {
              it -> cg.system = 'http://loinc.org' "sys";
              it -> cg.code = '8462-4' "cd";
              it -> cg.display = 'Diastolic blood pressure' "dsp";
            } "coding";
          } "code";
          it -> comp then SetComponentValue(it, comp) "value";
        } "comp_8462_4";
        bp ->  obs.note as n,  n.text = 'Taken before theatre' "phaseNote";
      } "bp";
    } "vitalsSub";
  } "vitalsGrp";
  qr.item as g where (linkId = 'post-operative') then {
    g.item as g2 where (linkId = 'post-operative/vitals') then {
      g2.item as it where ((linkId = 'post-operative/vitals/temperature') and answer.value.exists()) ->  bundle.entry as entry,  entry.resource = create('Observation') as obs then {
        qr ->  obs,  entry then BuildObsBase(qr, obs, entry) "base";
        qr -> obs then SetVitalSignsCategory(qr, obs) "category";
        it -> obs.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'http://loinc.org' "sys";
            it -> cg.code = '8310-5' "cd";
            it -> cg.display = 'Body temperature' "dsp";
          } "coding";
        } "code";
        it.answer first as a then {
          a.value as v -> obs.value = v "set";
        };
        it ->  obs.note as n,  n.text = 'Taken on return from theatre' "phaseNote";
      } "vital_8310_52";
      g2.item as it where ((linkId = 'post-operative/vitals/pulse') and answer.value.exists()) ->  bundle.entry as entry,  entry.resource = create('Observation') as obs then {
        qr ->  obs,  entry then BuildObsBase(qr, obs, entry) "base";
        qr -> obs then SetVitalSignsCategory(qr, obs) "category";
        it -> obs.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'http://loinc.org' "sys";
            it -> cg.code = '8867-4' "cd";
            it -> cg.display = 'Heart rate' "dsp";
          } "coding";
        } "code";
        it.answer first as a then {
          a.value as v -> obs.value = v "set";
        };
        it ->  obs.note as n,  n.text = 'Taken on return from theatre' "phaseNote";
      } "vital_8867_42";
      g2.item as it where ((linkId = 'post-operative/vitals/respiratory-rate') and answer.value.exists()) ->  bundle.entry as entry,  entry.resource = create('Observation') as obs then {
        qr ->  obs,  entry then BuildObsBase(qr, obs, entry) "base";
        qr -> obs then SetVitalSignsCategory(qr, obs) "category";
        it -> obs.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'http://loinc.org' "sys";
            it -> cg.code = '9279-1' "cd";
            it -> cg.display = 'Respiratory rate' "dsp";
          } "coding";
        } "code";
        it.answer first as a then {
          a.value as v -> obs.value = v "set";
        };
        it ->  obs.note as n,  n.text = 'Taken on return from theatre' "phaseNote";
      } "vital_9279_12";
      g2.item as it where ((linkId = 'post-operative/vitals/oxygen-saturation') and answer.value.exists()) ->  bundle.entry as entry,  entry.resource = create('Observation') as obs then {
        qr ->  obs,  entry then BuildObsBase(qr, obs, entry) "base";
        qr -> obs then SetVitalSignsCategory(qr, obs) "category";
        it -> obs.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'http://loinc.org' "sys";
            it -> cg.code = '59408-5' "cd";
            it -> cg.display = 'Oxygen saturation in Arterial blood by Pulse oximetry' "dsp";
          } "coding";
        } "code";
        it.answer first as a then {
          a.value as v -> obs.value = v "set";
        };
        it ->  obs.note as n,  n.text = 'Taken on return from theatre' "phaseNote";
      } "vital_59408_52";
      g2.item as bp where ((linkId = 'post-operative/vitals/blood-pressure') and item.answer.value.exists()) ->  bundle.entry as entry,  entry.resource = create('Observation') as obs then {
        qr ->  obs,  entry then BuildObsBase(qr, obs, entry) "base";
        qr -> obs then SetVitalSignsCategory(qr, obs) "category";
        bp -> obs.code as cc then {
          bp -> cc.coding as cg then {
            bp -> cg.system = 'http://loinc.org' "sys";
            bp -> cg.code = '85354-9' "cd";
            bp -> cg.display = 'Blood pressure panel with all children optional' "dsp";
          } "coding";
        } "code";
        bp.item as it where ((linkId = 'post-operative/vitals/blood-pressure/systolic') and answer.value.exists()) -> obs.component as comp then {
          it -> comp.code as cc then {
            it -> cc.coding as cg then {
              it -> cg.system = 'http://loinc.org' "sys";
              it -> cg.code = '8480-6' "cd";
              it -> cg.display = 'Systolic blood pressure' "dsp";
            } "coding";
          } "code";
          it -> comp then SetComponentValue(it, comp) "value";
        } "comp_8480_62";
        bp.item as it where ((linkId = 'post-operative/vitals/blood-pressure/diastolic') and answer.value.exists()) -> obs.component as comp then {
          it -> comp.code as cc then {
            it -> cc.coding as cg then {
              it -> cg.system = 'http://loinc.org' "sys";
              it -> cg.code = '8462-4' "cd";
              it -> cg.display = 'Diastolic blood pressure' "dsp";
            } "coding";
          } "code";
          it -> comp then SetComponentValue(it, comp) "value";
        } "comp_8462_42";
        bp ->  obs.note as n,  n.text = 'Taken on return from theatre' "phaseNote";
      } "bp2";
    } "vitalsSub2";
  } "vitalsGrp2";
  // ── Investigations ordered, before and after ─────────────────────────────
  qr.item as g where (linkId = 'pre-operative') then {
    g.item as g2 where (linkId = 'pre-operative/investigations') then {
      g2.item as it where ((linkId = 'pre-operative/investigations/fhg') and (answer.value.ofType(Coding).code = 'Y')) ->  bundle.entry as entry,  entry.resource = create('ServiceRequest') as sr then {
        qr ->  sr,  entry then BuildServiceRequestBase(qr, sr, entry) "base";
        it -> sr.status = 'active' "status";
        it -> sr.intent = 'order' "intent";
        it -> sr.category as cat then {
          it -> cat.coding as cg then {
            it -> cg.system = 'http://snomed.info/sct' "sys";
            it -> cg.code = '108252007' "cd";
            it -> cg.display = 'Laboratory procedure' "dsp";
          } "coding";
        } "category";
        it ->  sr.code as cr,  cr.concept as cc,  cc.text = 'Full haemogram' "codeText";
        qr.authored as t -> sr.authoredOn = t "authoredOn";
        qr.encounter as e -> sr.encounter = e;
        qr.source as src -> sr.requester = src "requester";
        it ->  sr.note as n,  n.text = 'Ordered before theatre' "phaseNote";
      } "order_fhg";
    } "orderSub";
  } "orderGrp";
  qr.item as g where (linkId = 'pre-operative') then {
    g.item as g2 where (linkId = 'pre-operative/investigations') then {
      g2.item as it where ((linkId = 'pre-operative/investigations/coagulation') and (answer.value.ofType(Coding).code = 'Y')) ->  bundle.entry as entry,  entry.resource = create('ServiceRequest') as sr then {
        qr ->  sr,  entry then BuildServiceRequestBase(qr, sr, entry) "base";
        it -> sr.status = 'active' "status";
        it -> sr.intent = 'order' "intent";
        it -> sr.category as cat then {
          it -> cat.coding as cg then {
            it -> cg.system = 'http://snomed.info/sct' "sys";
            it -> cg.code = '108252007' "cd";
            it -> cg.display = 'Laboratory procedure' "dsp";
          } "coding";
        } "category";
        it ->  sr.code as cr,  cr.concept as cc,  cc.text = 'Coagulation profile' "codeText";
        qr.authored as t -> sr.authoredOn = t "authoredOn";
        qr.encounter as e -> sr.encounter = e;
        qr.source as src -> sr.requester = src "requester";
        it ->  sr.note as n,  n.text = 'Ordered before theatre' "phaseNote";
      } "order_coagulation";
    } "orderSub2";
  } "orderGrp2";
  qr.item as g where (linkId = 'pre-operative') then {
    g.item as g2 where (linkId = 'pre-operative/investigations') then {
      g2.item as it where ((linkId = 'pre-operative/investigations/urinalysis') and (answer.value.ofType(Coding).code = 'Y')) ->  bundle.entry as entry,  entry.resource = create('ServiceRequest') as sr then {
        qr ->  sr,  entry then BuildServiceRequestBase(qr, sr, entry) "base";
        it -> sr.status = 'active' "status";
        it -> sr.intent = 'order' "intent";
        it -> sr.category as cat then {
          it -> cat.coding as cg then {
            it -> cg.system = 'http://snomed.info/sct' "sys";
            it -> cg.code = '108252007' "cd";
            it -> cg.display = 'Laboratory procedure' "dsp";
          } "coding";
        } "category";
        it ->  sr.code as cr,  cr.concept as cc,  cc.text = 'Urinalysis' "codeText";
        qr.authored as t -> sr.authoredOn = t "authoredOn";
        qr.encounter as e -> sr.encounter = e;
        qr.source as src -> sr.requester = src "requester";
        it ->  sr.note as n,  n.text = 'Ordered before theatre' "phaseNote";
      } "order_urinalysis";
    } "orderSub3";
  } "orderGrp3";
  qr.item as g where (linkId = 'pre-operative') then {
    g.item as g2 where (linkId = 'pre-operative/investigations') then {
      g2.item as it where ((linkId = 'pre-operative/investigations/blood-group') and (answer.value.ofType(Coding).code = 'Y')) ->  bundle.entry as entry,  entry.resource = create('ServiceRequest') as sr then {
        qr ->  sr,  entry then BuildServiceRequestBase(qr, sr, entry) "base";
        it -> sr.status = 'active' "status";
        it -> sr.intent = 'order' "intent";
        it -> sr.category as cat then {
          it -> cat.coding as cg then {
            it -> cg.system = 'http://snomed.info/sct' "sys";
            it -> cg.code = '108252007' "cd";
            it -> cg.display = 'Laboratory procedure' "dsp";
          } "coding";
        } "category";
        it ->  sr.code as cr,  cr.concept as cc,  cc.text = 'Blood group' "codeText";
        qr.authored as t -> sr.authoredOn = t "authoredOn";
        qr.encounter as e -> sr.encounter = e;
        qr.source as src -> sr.requester = src "requester";
        it ->  sr.note as n,  n.text = 'Ordered before theatre' "phaseNote";
      } "order_blood_group";
    } "orderSub4";
  } "orderGrp4";
  qr.item as g where (linkId = 'pre-operative') then {
    g.item as g2 where (linkId = 'pre-operative/investigations') then {
      g2.item as it where ((linkId = 'pre-operative/investigations/x-ray') and (answer.value.ofType(Coding).code = 'Y')) ->  bundle.entry as entry,  entry.resource = create('ServiceRequest') as sr then {
        qr ->  sr,  entry then BuildServiceRequestBase(qr, sr, entry) "base";
        it -> sr.status = 'active' "status";
        it -> sr.intent = 'order' "intent";
        it -> sr.category as cat then {
          it -> cat.coding as cg then {
            it -> cg.system = 'http://snomed.info/sct' "sys";
            it -> cg.code = '363679005' "cd";
            it -> cg.display = 'Imaging' "dsp";
          } "coding";
        } "category";
        it ->  sr.code as cr,  cr.concept as cc,  cc.text = 'X-ray' "codeText";
        qr.authored as t -> sr.authoredOn = t "authoredOn";
        qr.encounter as e -> sr.encounter = e;
        qr.source as src -> sr.requester = src "requester";
        it ->  sr.note as n,  n.text = 'Ordered before theatre' "phaseNote";
      } "order_x_ray";
    } "orderSub5";
  } "orderGrp5";
  qr.item as g where (linkId = 'post-operative') then {
    g.item as g2 where (linkId = 'post-operative/investigations') then {
      g2.item as it where ((linkId = 'post-operative/investigations/fhg') and (answer.value.ofType(Coding).code = 'Y')) ->  bundle.entry as entry,  entry.resource = create('ServiceRequest') as sr then {
        qr ->  sr,  entry then BuildServiceRequestBase(qr, sr, entry) "base";
        it -> sr.status = 'active' "status";
        it -> sr.intent = 'order' "intent";
        it -> sr.category as cat then {
          it -> cat.coding as cg then {
            it -> cg.system = 'http://snomed.info/sct' "sys";
            it -> cg.code = '108252007' "cd";
            it -> cg.display = 'Laboratory procedure' "dsp";
          } "coding";
        } "category";
        it ->  sr.code as cr,  cr.concept as cc,  cc.text = 'Full haemogram' "codeText";
        qr.authored as t -> sr.authoredOn = t "authoredOn";
        qr.encounter as e -> sr.encounter = e;
        qr.source as src -> sr.requester = src "requester";
        it ->  sr.note as n,  n.text = 'Ordered on return from theatre' "phaseNote";
      } "order_fhg2";
    } "orderSub6";
  } "orderGrp6";
  qr.item as g where (linkId = 'post-operative') then {
    g.item as g2 where (linkId = 'post-operative/investigations') then {
      g2.item as it where ((linkId = 'post-operative/investigations/coagulation') and (answer.value.ofType(Coding).code = 'Y')) ->  bundle.entry as entry,  entry.resource = create('ServiceRequest') as sr then {
        qr ->  sr,  entry then BuildServiceRequestBase(qr, sr, entry) "base";
        it -> sr.status = 'active' "status";
        it -> sr.intent = 'order' "intent";
        it -> sr.category as cat then {
          it -> cat.coding as cg then {
            it -> cg.system = 'http://snomed.info/sct' "sys";
            it -> cg.code = '108252007' "cd";
            it -> cg.display = 'Laboratory procedure' "dsp";
          } "coding";
        } "category";
        it ->  sr.code as cr,  cr.concept as cc,  cc.text = 'Coagulation profile' "codeText";
        qr.authored as t -> sr.authoredOn = t "authoredOn";
        qr.encounter as e -> sr.encounter = e;
        qr.source as src -> sr.requester = src "requester";
        it ->  sr.note as n,  n.text = 'Ordered on return from theatre' "phaseNote";
      } "order_coagulation2";
    } "orderSub7";
  } "orderGrp7";
  qr.item as g where (linkId = 'post-operative') then {
    g.item as g2 where (linkId = 'post-operative/investigations') then {
      g2.item as it where ((linkId = 'post-operative/investigations/urinalysis') and (answer.value.ofType(Coding).code = 'Y')) ->  bundle.entry as entry,  entry.resource = create('ServiceRequest') as sr then {
        qr ->  sr,  entry then BuildServiceRequestBase(qr, sr, entry) "base";
        it -> sr.status = 'active' "status";
        it -> sr.intent = 'order' "intent";
        it -> sr.category as cat then {
          it -> cat.coding as cg then {
            it -> cg.system = 'http://snomed.info/sct' "sys";
            it -> cg.code = '108252007' "cd";
            it -> cg.display = 'Laboratory procedure' "dsp";
          } "coding";
        } "category";
        it ->  sr.code as cr,  cr.concept as cc,  cc.text = 'Urinalysis' "codeText";
        qr.authored as t -> sr.authoredOn = t "authoredOn";
        qr.encounter as e -> sr.encounter = e;
        qr.source as src -> sr.requester = src "requester";
        it ->  sr.note as n,  n.text = 'Ordered on return from theatre' "phaseNote";
      } "order_urinalysis2";
    } "orderSub8";
  } "orderGrp8";
  qr.item as g where (linkId = 'post-operative') then {
    g.item as g2 where (linkId = 'post-operative/investigations') then {
      g2.item as it where ((linkId = 'post-operative/investigations/x-ray') and (answer.value.ofType(Coding).code = 'Y')) ->  bundle.entry as entry,  entry.resource = create('ServiceRequest') as sr then {
        qr ->  sr,  entry then BuildServiceRequestBase(qr, sr, entry) "base";
        it -> sr.status = 'active' "status";
        it -> sr.intent = 'order' "intent";
        it -> sr.category as cat then {
          it -> cat.coding as cg then {
            it -> cg.system = 'http://snomed.info/sct' "sys";
            it -> cg.code = '363679005' "cd";
            it -> cg.display = 'Imaging' "dsp";
          } "coding";
        } "category";
        it ->  sr.code as cr,  cr.concept as cc,  cc.text = 'X-ray' "codeText";
        qr.authored as t -> sr.authoredOn = t "authoredOn";
        qr.encounter as e -> sr.encounter = e;
        qr.source as src -> sr.requester = src "requester";
        it ->  sr.note as n,  n.text = 'Ordered on return from theatre' "phaseNote";
      } "order_x_ray2";
    } "orderSub9";
  } "orderGrp9";
  // ── Allergy recorded on the checklist ───────────────────────────────────
  // Recorded as an Observation, not an AllergyIntolerance. The checklist asks
  // the team to *review* a known allergy, not to record a new one; the drug,
  // anaesthetic and other lines are what they read out, and creating an
  // AllergyIntolerance from a read-back would duplicate whatever the pharmacy
  // already holds.
  qr.item as g where ((linkId = 'allergy') and item.answer.value.exists()) ->  bundle.entry as entry,  entry.resource = create('Observation') as obs then {
    qr ->  obs,  entry then BuildObsBase(qr, obs, entry) "base";
    qr -> obs then SetSurveyCategory(qr, obs) "category";
    g -> obs.code as cc then {
      g -> cc.coding as cg then {
        g -> cg.system = 'http://loinc.org' "sys";
        g -> cg.code = '48765-2' "cd";
        g -> cg.display = 'Allergies and adverse reactions Document' "dsp";
      } "coding";
      g -> cc.text = 'Allergy reviewed at the surgical safety checklist' "codeText";
    } "code";
    g.item as it where (linkId = 'allergy/drug') then {
      it.answer first as a then {
        a.value as txt ->  obs.note as n,  n.text = txt "text";
      };
    } "note2";
    g.item as it where (linkId = 'allergy/anaesthesia') then {
      it.answer first as a then {
        a.value as txt ->  obs.note as n,  n.text = txt "text";
      };
    } "note3";
    g.item as it where (linkId = 'allergy/other') then {
      it.answer first as a then {
        a.value as txt ->  obs.note as n,  n.text = txt "text";
      };
    } "note4";
    g.item as it where ((linkId = 'allergy/none-known') and answer.value.exists()) -> obs.component as comp then {
      it -> comp.code as cc then {
        it -> cc.coding as cg then {
          it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
          it -> cg.code = 'who-check-no-known-allergies' "cd";
          it -> cg.display = 'No known allergies' "dsp";
        } "coding";
      } "code";
      it -> comp then SetComponentCodedValue(it, comp) "value";
    } "comp_who_check_no_known_allergies";
  } "allergyObservation";
}

// ─────────────────────────────────────────────────────────────────────────────
// Shared scaffolding. Repeated in each map rather than imported: the transform
// engine resolves `imports` against whatever StructureMaps happen to be on the
// server, and a form that stops extracting because a shared map was not
// uploaded is a worse failure than a duplicated group.
// Two notes on what the publisher's StructureMap validator says about this file.
// Source parameters below are left untyped on purpose. Writing `: Element` makes
// the validator compare QuestionnaireResponse.item against the literal 'Element'
// and report them as incompatible with each other, which is noise, not a finding.
// `evaluate(context, expression)` is flagged as "takes 1 parameter but 2 were
// found". Leave it. The FML parser in the same jar refuses the one-argument form
// outright -- it wants a parameter, a comma, then the FHIRPath -- so the
// publisher is objecting to what its own compiler emits. Two arguments is the
// only form that compiles, and it is what the R5 transform engine executes.
// ─────────────────────────────────────────────────────────────────────────────
group BuildObsBase(source qr : QR, target obs : Observation, target entry) {
  qr -> obs then SetResponseProvenance(qr, obs) "responseProvenance";
  qr -> obs.id = uuid() then SetObservationFullUrl(obs, entry) "idAndFullUrl";
  qr -> entry.request as request then {
    qr -> request.method = 'POST' "requestMethod";
    qr -> request.url = 'Observation' "requestUrl";
  } "entryRequest";
  qr -> obs.status = 'final' "status";
  qr.subject as s -> obs.subject = s;
  qr.encounter as e -> obs.encounter = e;
  qr.authored as t -> obs.effective = t "effective";
  qr.source as src -> obs.performer = src "performerFromSource";
  qr where (source.exists().not()) then {
    qr.author as a -> obs.performer = a "performerFromAuthor";
  } "performerFallback";
  // A stored response's id already reads "QuestionnaireResponse/<id>", so it is
  // a relative reference as it stands. The hasValue() guard is what stops an
  // unsaved response -- one posted straight to $extract rather than saved first
  // -- from writing "QuestionnaireResponse/null" into the record.
  qr.id as qid where ($this.hasValue()) ->  obs.derivedFrom = create('Reference') as ref,  ref.reference = qid "linkQuestionnaireResponse";
}

group SetObservationFullUrl(source obs : Observation, target entry) {
  obs.id as id -> entry.fullUrl = append('https://fhir.slade360.co.ke/fhir/Observation/', id) "assignFullUrl";
}

// The two answer shapes a component can carry. Both read the answer through the
// untyped `.value` accessor: reading `valueCoding` or `valueQuantity` by its
// typed property name fails at transform time on HAPI R5 with "Attempt to read
// invalid property ... on QuestionnaireResponse.item.answer".
group SetComponentCodedValue(source it, target comp) {
  it.answer first as a then {
    a.value as cv -> comp.value = create('CodeableConcept') as cc then {
      cv -> cc.coding = cv "valueCoding";
      cv.display as d -> cc.text = d "valueText";
    } "codedValue";
  } "componentAnswer";
}

group SetComponentValue(source it, target comp) {
  it.answer first as a then {
    a.value as v -> comp.value = v "plainValue";
  } "componentAnswer";
}

group SetSurveyCategory(source qr : QR, target obs : Observation) {
  qr -> obs.category as cat then {
    qr -> cat.coding as coding then {
      qr -> coding.system = 'http://terminology.hl7.org/CodeSystem/observation-category' "categorySystem";
      qr -> coding.code = 'survey' "categoryCode";
      qr -> coding.display = 'Survey' "categoryDisplay";
    } "categoryCoding";
  } "category";
}

group SetVitalSignsCategory(source qr : QR, target obs : Observation) {
  qr -> obs.category as cat then {
    qr -> cat.coding as coding then {
      qr -> coding.system = 'http://terminology.hl7.org/CodeSystem/observation-category' "categorySystem";
      qr -> coding.code = 'vital-signs' "categoryCode";
      qr -> coding.display = 'Vital Signs' "categoryDisplay";
    } "categoryCoding";
  } "category";
}

group SetExamCategory(source qr : QR, target obs : Observation) {
  qr -> obs.category as cat then {
    qr -> cat.coding as coding then {
      qr -> coding.system = 'http://terminology.hl7.org/CodeSystem/observation-category' "categorySystem";
      qr -> coding.code = 'exam' "categoryCode";
      qr -> coding.display = 'Exam' "categoryDisplay";
    } "categoryCoding";
  } "category";
}

group BuildServiceRequestBase(source qr : QR, target r : ServiceRequest, target entry) {
  qr -> r then SetResponseProvenance(qr, r) "responseProvenance";
  qr -> r.id = uuid() then SetServiceRequestFullUrl(r, entry) "idAndFullUrl";
  qr -> entry.request as request then {
    qr -> request.method = 'POST' "requestMethod";
    qr -> request.url = 'ServiceRequest' "requestUrl";
  } "entryRequest";
  qr.subject as s -> r.subject = s;
}

group SetServiceRequestFullUrl(source r : ServiceRequest, target entry) {
  r.id as id -> entry.fullUrl = append('https://fhir.slade360.co.ke/fhir/ServiceRequest/', id) "assignFullUrl";
}

// ── Provenance and tenancy ───────────────────────────────────────────────────
// Two tags on everything this map creates. The first says which questionnaire
// produced it, so a form that reopens mid-admission recalls its own earlier
// entries and not another form's. The second copies the tenant tags off the
// response, because nothing else on the path puts them there.
// The code is the form's document type, not the questionnaire's id: every
// environment mints its own ids, and there is only one set of maps, so an id
// here would tie the tag to whichever environment stamped it.
// ── Provenance and tenancy ───────────────────────────────────────────────────
group SetResponseProvenance(source qr : QR, target r) {
  qr -> r.meta as m then {
    qr -> m.tag as t then {
      qr -> t.system = 'http://slade360edi.com/questionnaire-provenance' "provenanceSystem";
      qr -> t.code = 'surgical-safety-checklist' "provenanceCode";
      qr -> t.display = 'Surgical safety checklist' "provenanceDisplay";
    } "provenanceTag";
  } "provenanceMeta";
  // Every tag the response carries, onto the resource. `meta` is 0..1, so this
  // lands on the same meta the rule above created rather than a second one.
  qr.meta as qm then {
    qm.tag as qt ->  r.meta as m,  m.tag = qt "copyTag";
  } "tenantTags";
}


Source1

{
  "resourceType": "StructureMap",
  "id": "ExtractSurgicalSafetyChecklist",
  "text": {
    "status": "generated",
    "div": "<!-- snip (see above) -->"
  },
  "url": "https://fhir.slade360.co.ke/fhir/StructureMap/ExtractSurgicalSafetyChecklist",
  "version": "0.1.0",
  "name": "ExtractSurgicalSafetyChecklist",
  "title": "Surgical Safety Checklist Extraction",
  "status": "active",
  "date": "2026-09-11T12:18:36+00:00",
  "publisher": "Kathurima Kimathi",
  "contact": [
    {
      "name": "Kathurima Kimathi",
      "telecom": [
        {
          "system": "url",
          "value": "https://www.linkedin.com/in/kathurima-kimathi/"
        },
        {
          "system": "email",
          "value": "kathurimakimathi415@gmail.com"
        }
      ]
    },
    {
      "name": "Oscar John",
      "telecom": [
        {
          "system": "email",
          "value": "oscarjohnotieno@gmail.com",
          "use": "work"
        }
      ]
    },
    {
      "name": "Kennedy Omondi",
      "telecom": [
        {
          "system": "email",
          "value": "kennankole@gmail.com",
          "use": "work"
        }
      ]
    }
  ],
  "description": "The checklist out as one Observation per WHO phase, so a sign-out that never happened is a missing resource rather than a resource full of blanks -- which is the only shape that lets a compliance audit tell an unperformed phase from an unticked one. The ward's pre-operative preparation and post-operative checks become two further panels, every investigation ticked becomes a ServiceRequest, the vital signs before and after theatre become their own Observations tagged with which side of theatre they were taken on, and the instrument count gets an Observation of its own because a wrong count is a never event.",
  "structure": [
    {
      "url": "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse",
      "mode": "source",
      "alias": "QR"
    },
    {
      "url": "http://hl7.org/fhir/StructureDefinition/Bundle",
      "mode": "target",
      "alias": "Bundle"
    },
    {
      "url": "http://hl7.org/fhir/StructureDefinition/Observation",
      "mode": "target",
      "alias": "Observation"
    },
    {
      "url": "http://hl7.org/fhir/StructureDefinition/ServiceRequest",
      "mode": "target",
      "alias": "ServiceRequest"
    }
  ],
  "group": [
    {
      "name": "ExtractSurgicalSafetyChecklist",
      "input": [
        {
          "name": "qr",
          "type": "QR",
          "mode": "source"
        },
        {
          "name": "bundle",
          "type": "Bundle",
          "mode": "target"
        }
      ],
      "rule": [
        {
          "name": "setBundleType",
          "source": [
            {
              "context": "qr"
            }
          ],
          "target": [
            {
              "context": "bundle",
              "element": "type",
              "transform": "copy",
              "parameter": [
                {
                  "valueString": "transaction"
                }
              ]
            }
          ]
        },
        {
          "name": "whoChecklistGroup",
          "source": [
            {
              "context": "qr",
              "element": "item",
              "variable": "wg",
              "condition": "linkId = 'who-checklist'"
            }
          ],
          "rule": [
            {
              "name": "phase_sign_in",
              "source": [
                {
                  "context": "wg",
                  "element": "item",
                  "variable": "g",
                  "condition": "(linkId = 'who-checklist/sign-in') and item.answer.value.exists()"
                }
              ],
              "target": [
                {
                  "context": "bundle",
                  "element": "entry",
                  "variable": "entry"
                },
                {
                  "context": "entry",
                  "element": "resource",
                  "variable": "obs",
                  "transform": "create",
                  "parameter": [
                    {
                      "valueString": "Observation"
                    }
                  ]
                }
              ],
              "rule": [
                {
                  "name": "base",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs"
                    },
                    {
                      "context": "entry"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "BuildObsBase",
                      "parameter": [
                        {
                          "valueId": "qr"
                        },
                        {
                          "valueId": "obs"
                        },
                        {
                          "valueId": "entry"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "category",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "SetSurveyCategory",
                      "parameter": [
                        {
                          "valueId": "qr"
                        },
                        {
                          "valueId": "obs"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "code",
                  "source": [
                    {
                      "context": "g"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "code",
                      "variable": "cc"
                    }
                  ],
                  "rule": [
                    {
                      "name": "coding",
                      "source": [
                        {
                          "context": "g"
                        }
                      ],
                      "target": [
                        {
                          "context": "cc",
                          "element": "coding",
                          "variable": "cg"
                        }
                      ],
                      "rule": [
                        {
                          "name": "sys",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "system",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "cd",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "code",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "surgical-safety-phase"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "dsp",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "display",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "Surgical safety checklist phase"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "codeText",
                      "source": [
                        {
                          "context": "g"
                        }
                      ],
                      "target": [
                        {
                          "context": "cc",
                          "element": "text",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "Sign in — before induction of anaesthesia"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "phaseValue",
                  "source": [
                    {
                      "context": "g"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "value",
                      "variable": "vc",
                      "transform": "create",
                      "parameter": [
                        {
                          "valueString": "CodeableConcept"
                        }
                      ]
                    }
                  ],
                  "rule": [
                    {
                      "name": "coding",
                      "source": [
                        {
                          "context": "g"
                        }
                      ],
                      "target": [
                        {
                          "context": "vc",
                          "element": "coding",
                          "variable": "vcg"
                        }
                      ],
                      "rule": [
                        {
                          "name": "sys",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "vcg",
                              "element": "system",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/answer-codesystem"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "cd",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "vcg",
                              "element": "code",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "phase-sign-in"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "dsp",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "vcg",
                              "element": "display",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "Sign in — before induction of anaesthesia"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "phaseTime",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "ct",
                      "condition": "(linkId = 'who-checklist/sign-in/completed-at') and answer.value.exists()"
                    }
                  ],
                  "rule": [
                    {
                      "name": "answer",
                      "source": [
                        {
                          "context": "ct",
                          "element": "answer",
                          "listMode": "first",
                          "variable": "a"
                        }
                      ],
                      "rule": [
                        {
                          "name": "phaseEffective",
                          "source": [
                            {
                              "context": "a",
                              "element": "value",
                              "variable": "t"
                            }
                          ],
                          "target": [
                            {
                              "context": "obs",
                              "element": "effective",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueId": "t"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ],
                  "documentation": "The phase's own completion time, not the form's authored time."
                },
                {
                  "name": "comp_who_check_patient_confirmed_identity_site_procedure_and",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'who-checklist/sign-in/identity-site-procedure-consent') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "who-check-patient-confirmed-identity-site-procedure-and"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Patient confirmed identity, site, procedure and consent"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_who_check_site_marked",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'who-checklist/sign-in/site-marked') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "who-check-site-marked"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Site marked"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_who_check_anaesthesia_machine_and_medication_check_complete",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'who-checklist/sign-in/anaesthesia-machine-and-medication-check') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "who-check-anaesthesia-machine-and-medication-check-complete"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Anaesthesia machine and medication check complete"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_who_check_pulse_oximeter_on_the_patient_and_functioning",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'who-checklist/sign-in/pulse-oximeter-on-and-functioning') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "who-check-pulse-oximeter-on-the-patient-and-functioning"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Pulse oximeter on the patient and functioning"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_who_check_known_allergy_reviewed",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'who-checklist/sign-in/known-allergy-reviewed') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "who-check-known-allergy-reviewed"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Known allergy reviewed"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_who_check_difficult_airway_or_aspiration_risk_assessed",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'who-checklist/sign-in/difficult-airway-or-aspiration-risk') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "who-check-difficult-airway-or-aspiration-risk-assessed"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Difficult airway or aspiration risk assessed"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_who_check_risk_of_over_500_ml_blood_loss_assessed_access_and",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'who-checklist/sign-in/blood-loss-risk-over-500ml') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "who-check-risk-of-over-500-ml-blood-loss-assessed-access-and"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Risk of over 500 ml blood loss assessed, access and fluids planned"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name": "phase_time_out",
              "source": [
                {
                  "context": "wg",
                  "element": "item",
                  "variable": "g",
                  "condition": "(linkId = 'who-checklist/time-out') and item.answer.value.exists()"
                }
              ],
              "target": [
                {
                  "context": "bundle",
                  "element": "entry",
                  "variable": "entry"
                },
                {
                  "context": "entry",
                  "element": "resource",
                  "variable": "obs",
                  "transform": "create",
                  "parameter": [
                    {
                      "valueString": "Observation"
                    }
                  ]
                }
              ],
              "rule": [
                {
                  "name": "base",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs"
                    },
                    {
                      "context": "entry"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "BuildObsBase",
                      "parameter": [
                        {
                          "valueId": "qr"
                        },
                        {
                          "valueId": "obs"
                        },
                        {
                          "valueId": "entry"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "category",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "SetSurveyCategory",
                      "parameter": [
                        {
                          "valueId": "qr"
                        },
                        {
                          "valueId": "obs"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "code",
                  "source": [
                    {
                      "context": "g"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "code",
                      "variable": "cc"
                    }
                  ],
                  "rule": [
                    {
                      "name": "coding",
                      "source": [
                        {
                          "context": "g"
                        }
                      ],
                      "target": [
                        {
                          "context": "cc",
                          "element": "coding",
                          "variable": "cg"
                        }
                      ],
                      "rule": [
                        {
                          "name": "sys",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "system",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "cd",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "code",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "surgical-safety-phase"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "dsp",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "display",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "Surgical safety checklist phase"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "codeText",
                      "source": [
                        {
                          "context": "g"
                        }
                      ],
                      "target": [
                        {
                          "context": "cc",
                          "element": "text",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "Time out — before skin incision"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "phaseValue",
                  "source": [
                    {
                      "context": "g"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "value",
                      "variable": "vc",
                      "transform": "create",
                      "parameter": [
                        {
                          "valueString": "CodeableConcept"
                        }
                      ]
                    }
                  ],
                  "rule": [
                    {
                      "name": "coding",
                      "source": [
                        {
                          "context": "g"
                        }
                      ],
                      "target": [
                        {
                          "context": "vc",
                          "element": "coding",
                          "variable": "vcg"
                        }
                      ],
                      "rule": [
                        {
                          "name": "sys",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "vcg",
                              "element": "system",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/answer-codesystem"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "cd",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "vcg",
                              "element": "code",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "phase-time-out"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "dsp",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "vcg",
                              "element": "display",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "Time out — before skin incision"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "phaseTime2",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "ct",
                      "condition": "(linkId = 'who-checklist/time-out/completed-at') and answer.value.exists()"
                    }
                  ],
                  "rule": [
                    {
                      "name": "answer",
                      "source": [
                        {
                          "context": "ct",
                          "element": "answer",
                          "listMode": "first",
                          "variable": "a"
                        }
                      ],
                      "rule": [
                        {
                          "name": "phaseEffective",
                          "source": [
                            {
                              "context": "a",
                              "element": "value",
                              "variable": "t"
                            }
                          ],
                          "target": [
                            {
                              "context": "obs",
                              "element": "effective",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueId": "t"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ],
                  "documentation": "The phase's own completion time, not the form's authored time."
                },
                {
                  "name": "comp_who_check_all_team_members_introduced_by_name_and_role",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'who-checklist/time-out/team-introductions') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "who-check-all-team-members-introduced-by-name-and-role"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "All team members introduced by name and role"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_who_check_patient_procedure_and_incision_site_confirmed",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'who-checklist/time-out/confirm-patient-procedure-incision') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "who-check-patient-procedure-and-incision-site-confirmed"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Patient, procedure and incision site confirmed"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_who_check_antibiotic_prophylaxis_given_within_the_last_60",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'who-checklist/time-out/antibiotic-prophylaxis-within-60-minutes') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "who-check-antibiotic-prophylaxis-given-within-the-last-60"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Antibiotic prophylaxis given within the last 60 minutes"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_who_check_critical_or_non_routine_steps_reviewed",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'who-checklist/time-out/critical-steps-reviewed') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "who-check-critical-or-non-routine-steps-reviewed"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Critical or non-routine steps reviewed"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_who_check_case_duration_reviewed",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'who-checklist/time-out/case-duration-reviewed') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "who-check-case-duration-reviewed"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Case duration reviewed"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_who_check_anticipated_blood_loss_reviewed",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'who-checklist/time-out/anticipated-blood-loss-reviewed') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "who-check-anticipated-blood-loss-reviewed"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Anticipated blood loss reviewed"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_who_check_anaesthetist_s_patient_specific_concerns_reviewed",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'who-checklist/time-out/anaesthetist-patient-specific-concerns') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "who-check-anaesthetist-s-patient-specific-concerns-reviewed"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Anaesthetist's patient-specific concerns reviewed"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_who_check_sterility_including_indicator_results_confirmed",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'who-checklist/time-out/sterility-confirmed') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "who-check-sterility-including-indicator-results-confirmed"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Sterility, including indicator results, confirmed"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_who_check_equipment_issues_or_concerns_reviewed",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'who-checklist/time-out/equipment-issues-reviewed') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "who-check-equipment-issues-or-concerns-reviewed"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Equipment issues or concerns reviewed"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_who_check_essential_imaging_displayed",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'who-checklist/time-out/essential-imaging-displayed') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "who-check-essential-imaging-displayed"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Essential imaging displayed"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name": "phase_sign_out",
              "source": [
                {
                  "context": "wg",
                  "element": "item",
                  "variable": "g",
                  "condition": "(linkId = 'who-checklist/sign-out') and item.answer.value.exists()"
                }
              ],
              "target": [
                {
                  "context": "bundle",
                  "element": "entry",
                  "variable": "entry"
                },
                {
                  "context": "entry",
                  "element": "resource",
                  "variable": "obs",
                  "transform": "create",
                  "parameter": [
                    {
                      "valueString": "Observation"
                    }
                  ]
                }
              ],
              "rule": [
                {
                  "name": "base",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs"
                    },
                    {
                      "context": "entry"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "BuildObsBase",
                      "parameter": [
                        {
                          "valueId": "qr"
                        },
                        {
                          "valueId": "obs"
                        },
                        {
                          "valueId": "entry"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "category",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "SetSurveyCategory",
                      "parameter": [
                        {
                          "valueId": "qr"
                        },
                        {
                          "valueId": "obs"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "code",
                  "source": [
                    {
                      "context": "g"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "code",
                      "variable": "cc"
                    }
                  ],
                  "rule": [
                    {
                      "name": "coding",
                      "source": [
                        {
                          "context": "g"
                        }
                      ],
                      "target": [
                        {
                          "context": "cc",
                          "element": "coding",
                          "variable": "cg"
                        }
                      ],
                      "rule": [
                        {
                          "name": "sys",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "system",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "cd",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "code",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "surgical-safety-phase"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "dsp",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "display",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "Surgical safety checklist phase"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "codeText",
                      "source": [
                        {
                          "context": "g"
                        }
                      ],
                      "target": [
                        {
                          "context": "cc",
                          "element": "text",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "Sign out — before the patient leaves the operating room"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "phaseValue",
                  "source": [
                    {
                      "context": "g"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "value",
                      "variable": "vc",
                      "transform": "create",
                      "parameter": [
                        {
                          "valueString": "CodeableConcept"
                        }
                      ]
                    }
                  ],
                  "rule": [
                    {
                      "name": "coding",
                      "source": [
                        {
                          "context": "g"
                        }
                      ],
                      "target": [
                        {
                          "context": "vc",
                          "element": "coding",
                          "variable": "vcg"
                        }
                      ],
                      "rule": [
                        {
                          "name": "sys",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "vcg",
                              "element": "system",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/answer-codesystem"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "cd",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "vcg",
                              "element": "code",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "phase-sign-out"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "dsp",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "vcg",
                              "element": "display",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "Sign out — before the patient leaves the operating room"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "phaseTime3",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "ct",
                      "condition": "(linkId = 'who-checklist/sign-out/completed-at') and answer.value.exists()"
                    }
                  ],
                  "rule": [
                    {
                      "name": "answer",
                      "source": [
                        {
                          "context": "ct",
                          "element": "answer",
                          "listMode": "first",
                          "variable": "a"
                        }
                      ],
                      "rule": [
                        {
                          "name": "phaseEffective",
                          "source": [
                            {
                              "context": "a",
                              "element": "value",
                              "variable": "t"
                            }
                          ],
                          "target": [
                            {
                              "context": "obs",
                              "element": "effective",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueId": "t"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ],
                  "documentation": "The phase's own completion time, not the form's authored time."
                },
                {
                  "name": "comp_who_check_name_of_the_procedure_verbally_confirmed",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'who-checklist/sign-out/procedure-name-recorded') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "who-check-name-of-the-procedure-verbally-confirmed"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Name of the procedure verbally confirmed"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_who_check_instrument_sponge_and_needle_counts_complete",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'who-checklist/sign-out/counts-complete') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "who-check-instrument-sponge-and-needle-counts-complete"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Instrument, sponge and needle counts complete"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_who_check_specimen_labelling_read_aloud_including_the_patient",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'who-checklist/sign-out/specimen-labelling') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "who-check-specimen-labelling-read-aloud-including-the-patient"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Specimen labelling read aloud, including the patient name"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_who_check_equipment_problems_to_be_addressed_identified",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'who-checklist/sign-out/equipment-problems-addressed') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "who-check-equipment-problems-to-be-addressed-identified"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Equipment problems to be addressed identified"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_who_check_key_concerns_for_recovery_and_management_reviewed",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'who-checklist/sign-out/recovery-key-concerns') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "who-check-key-concerns-for-recovery-and-management-reviewed"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Key concerns for recovery and management reviewed"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ],
          "documentation": "── The three WHO phases ────────────────────────────────────────────────\r\nOne Observation each. This is the whole design decision on this form: a\r\nsingle Observation with twenty-two components could not distinguish \"the\r\nteam did the sign-out and confirmed nothing\" from \"the team never did the\r\nsign-out\", and those are a documentation lapse and a safety failure\r\nrespectively.\r\nEach phase is guarded on at least one of its own items being answered, and\r\ncarries `Observation.effective` from the phase's own completion time when\r\nthe team recorded one, so the interval between induction and incision is\r\nrecoverable."
        },
        {
          "name": "instrumentCountGroup",
          "source": [
            {
              "context": "qr",
              "element": "item",
              "variable": "wg",
              "condition": "linkId = 'who-checklist'"
            }
          ],
          "rule": [
            {
              "name": "signOutSub",
              "source": [
                {
                  "context": "wg",
                  "element": "item",
                  "variable": "g",
                  "condition": "linkId = 'who-checklist/sign-out'"
                }
              ],
              "rule": [
                {
                  "name": "instrumentCountObservation",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'who-checklist/sign-out/counts-complete') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "bundle",
                      "element": "entry",
                      "variable": "entry"
                    },
                    {
                      "context": "entry",
                      "element": "resource",
                      "variable": "obs",
                      "transform": "create",
                      "parameter": [
                        {
                          "valueString": "Observation"
                        }
                      ]
                    }
                  ],
                  "rule": [
                    {
                      "name": "base",
                      "source": [
                        {
                          "context": "qr"
                        }
                      ],
                      "target": [
                        {
                          "context": "obs"
                        },
                        {
                          "context": "entry"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "BuildObsBase",
                          "parameter": [
                            {
                              "valueId": "qr"
                            },
                            {
                              "valueId": "obs"
                            },
                            {
                              "valueId": "entry"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "category",
                      "source": [
                        {
                          "context": "qr"
                        }
                      ],
                      "target": [
                        {
                          "context": "obs"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetSurveyCategory",
                          "parameter": [
                            {
                              "valueId": "qr"
                            },
                            {
                              "valueId": "obs"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "obs",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "instrument-count-complete"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Instrument, sponge and needle count complete"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "answer",
                      "source": [
                        {
                          "context": "it",
                          "element": "answer",
                          "listMode": "first",
                          "variable": "a"
                        }
                      ],
                      "rule": [
                        {
                          "name": "codedValue",
                          "source": [
                            {
                              "context": "a",
                              "element": "value",
                              "variable": "cv"
                            }
                          ],
                          "target": [
                            {
                              "context": "obs",
                              "element": "value",
                              "variable": "vc",
                              "transform": "create",
                              "parameter": [
                                {
                                  "valueString": "CodeableConcept"
                                }
                              ]
                            }
                          ],
                          "rule": [
                            {
                              "name": "valueCoding",
                              "source": [
                                {
                                  "context": "cv"
                                }
                              ],
                              "target": [
                                {
                                  "context": "vc",
                                  "element": "coding",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueId": "cv"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "valueText",
                              "source": [
                                {
                                  "context": "cv",
                                  "element": "display",
                                  "variable": "d"
                                }
                              ],
                              "target": [
                                {
                                  "context": "vc",
                                  "element": "text",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueId": "d"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "countInterpretation",
                      "source": [
                        {
                          "context": "it",
                          "element": "answer",
                          "listMode": "first",
                          "variable": "a"
                        }
                      ],
                      "rule": [
                        {
                          "name": "abnormal",
                          "source": [
                            {
                              "context": "a",
                              "element": "value",
                              "variable": "cv",
                              "condition": "code != 'check-confirmed'"
                            }
                          ],
                          "target": [
                            {
                              "context": "obs",
                              "element": "interpretation",
                              "variable": "interp"
                            }
                          ],
                          "rule": [
                            {
                              "name": "coding",
                              "source": [
                                {
                                  "context": "cv"
                                }
                              ],
                              "target": [
                                {
                                  "context": "interp",
                                  "element": "coding",
                                  "variable": "icg"
                                }
                              ],
                              "rule": [
                                {
                                  "name": "sys",
                                  "source": [
                                    {
                                      "context": "cv"
                                    }
                                  ],
                                  "target": [
                                    {
                                      "context": "icg",
                                      "element": "system",
                                      "transform": "copy",
                                      "parameter": [
                                        {
                                          "valueString": "http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation"
                                        }
                                      ]
                                    }
                                  ]
                                },
                                {
                                  "name": "cd",
                                  "source": [
                                    {
                                      "context": "cv"
                                    }
                                  ],
                                  "target": [
                                    {
                                      "context": "icg",
                                      "element": "code",
                                      "transform": "copy",
                                      "parameter": [
                                        {
                                          "valueString": "A"
                                        }
                                      ]
                                    }
                                  ]
                                },
                                {
                                  "name": "dsp",
                                  "source": [
                                    {
                                      "context": "cv"
                                    }
                                  ],
                                  "target": [
                                    {
                                      "context": "icg",
                                      "element": "display",
                                      "transform": "copy",
                                      "parameter": [
                                        {
                                          "valueString": "Abnormal"
                                        }
                                      ]
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ],
                      "documentation": "Anything other than a confirmed count is abnormal. Stated, not left\r\nto a reader: this is the flag a theatre audit filters on."
                    }
                  ]
                }
              ]
            }
          ],
          "documentation": "── The instrument, sponge and needle count ─────────────────────────────\r\nLifted out of the sign-out panel into an Observation of its own. An\r\nincorrect count is a never event and a retained item is a serious incident;\r\na fact that triggers an incident report has to be findable by its own code\r\nand not only by reading a twenty-two-component panel."
        },
        {
          "name": "preOperativeGroup",
          "source": [
            {
              "context": "qr",
              "element": "item",
              "variable": "pg",
              "condition": "linkId = 'pre-operative'"
            }
          ],
          "rule": [
            {
              "name": "preparationPanel",
              "source": [
                {
                  "context": "pg",
                  "element": "item",
                  "variable": "g",
                  "condition": "(linkId = 'pre-operative/preparation') and item.answer.value.exists()"
                }
              ],
              "target": [
                {
                  "context": "bundle",
                  "element": "entry",
                  "variable": "entry"
                },
                {
                  "context": "entry",
                  "element": "resource",
                  "variable": "obs",
                  "transform": "create",
                  "parameter": [
                    {
                      "valueString": "Observation"
                    }
                  ]
                }
              ],
              "rule": [
                {
                  "name": "base",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs"
                    },
                    {
                      "context": "entry"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "BuildObsBase",
                      "parameter": [
                        {
                          "valueId": "qr"
                        },
                        {
                          "valueId": "obs"
                        },
                        {
                          "valueId": "entry"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "category",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "SetSurveyCategory",
                      "parameter": [
                        {
                          "valueId": "qr"
                        },
                        {
                          "valueId": "obs"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "code",
                  "source": [
                    {
                      "context": "g"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "code",
                      "variable": "cc"
                    }
                  ],
                  "rule": [
                    {
                      "name": "coding",
                      "source": [
                        {
                          "context": "g"
                        }
                      ],
                      "target": [
                        {
                          "context": "cc",
                          "element": "coding",
                          "variable": "cg"
                        }
                      ],
                      "rule": [
                        {
                          "name": "sys",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "system",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "cd",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "code",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "preoperative-preparation"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "dsp",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "display",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "Pre-operative preparation completed"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_preop_fasting",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'pre-operative/preparation/fasting') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "preop-fasting"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Fasting"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_preop_dentures_removed",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'pre-operative/preparation/dentures-removed') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "preop-dentures-removed"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Dentures removed"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_preop_jewellery_removed",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'pre-operative/preparation/jewellery-removed') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "preop-jewellery-removed"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Jewellery removed"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_preop_artificial_limb_removed",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'pre-operative/preparation/artificial-limb-removed') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "preop-artificial-limb-removed"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Artificial limb removed"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_preop_nail_varnish_removed",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'pre-operative/preparation/nail-varnish-removed') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "preop-nail-varnish-removed"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Nail varnish removed"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_preop_shaving",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'pre-operative/preparation/shaving') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "preop-shaving"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Shaving"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_preop_bath",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'pre-operative/preparation/bath') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "preop-bath"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Bath"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_preop_theatre_gown",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'pre-operative/preparation/theatre-gown') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "preop-theatre-gown"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Theatre gown"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_preop_skin_cleaned",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'pre-operative/preparation/skin-cleaned') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "preop-skin-cleaned"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Skin cleaned"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name": "linesPanel",
              "source": [
                {
                  "context": "pg",
                  "element": "item",
                  "variable": "g",
                  "condition": "(linkId = 'pre-operative/lines') and item.answer.value.exists()"
                }
              ],
              "target": [
                {
                  "context": "bundle",
                  "element": "entry",
                  "variable": "entry"
                },
                {
                  "context": "entry",
                  "element": "resource",
                  "variable": "obs",
                  "transform": "create",
                  "parameter": [
                    {
                      "valueString": "Observation"
                    }
                  ]
                }
              ],
              "rule": [
                {
                  "name": "base",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs"
                    },
                    {
                      "context": "entry"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "BuildObsBase",
                      "parameter": [
                        {
                          "valueId": "qr"
                        },
                        {
                          "valueId": "obs"
                        },
                        {
                          "valueId": "entry"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "category",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "SetExamCategory",
                      "parameter": [
                        {
                          "valueId": "qr"
                        },
                        {
                          "valueId": "obs"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "code",
                  "source": [
                    {
                      "context": "g"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "code",
                      "variable": "cc"
                    }
                  ],
                  "rule": [
                    {
                      "name": "coding",
                      "source": [
                        {
                          "context": "g"
                        }
                      ],
                      "target": [
                        {
                          "context": "cc",
                          "element": "coding",
                          "variable": "cg"
                        }
                      ],
                      "rule": [
                        {
                          "name": "sys",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "system",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "cd",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "code",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "preop-lines-and-tubes-in-place-before-theatre"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "dsp",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "display",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "Lines and tubes in place before theatre"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_preop_catheter",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'pre-operative/lines/catheter') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "preop-catheter"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Catheter"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_preop_nasogastric_tube",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'pre-operative/lines/nasogastric-tube') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "preop-nasogastric-tube"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Nasogastric tube"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_preop_intravenous_infusion",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'pre-operative/lines/intravenous-infusion') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "preop-intravenous-infusion"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Intravenous infusion"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "note",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "linkId = 'pre-operative/lines/other'"
                    }
                  ],
                  "rule": [
                    {
                      "name": "answer",
                      "source": [
                        {
                          "context": "it",
                          "element": "answer",
                          "listMode": "first",
                          "variable": "a"
                        }
                      ],
                      "rule": [
                        {
                          "name": "text",
                          "source": [
                            {
                              "context": "a",
                              "element": "value",
                              "variable": "txt"
                            }
                          ],
                          "target": [
                            {
                              "context": "obs",
                              "element": "note",
                              "variable": "n"
                            },
                            {
                              "context": "n",
                              "element": "text",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueId": "txt"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ],
              "documentation": "Lines and tubes in place. A separate panel from the preparation checklist\r\nbecause these are devices the theatre has to know about, not tasks the\r\nward has to have finished."
            },
            {
              "name": "bloodPanel",
              "source": [
                {
                  "context": "pg",
                  "element": "item",
                  "variable": "g",
                  "condition": "(linkId = 'pre-operative/blood') and item.answer.value.exists()"
                }
              ],
              "target": [
                {
                  "context": "bundle",
                  "element": "entry",
                  "variable": "entry"
                },
                {
                  "context": "entry",
                  "element": "resource",
                  "variable": "obs",
                  "transform": "create",
                  "parameter": [
                    {
                      "valueString": "Observation"
                    }
                  ]
                }
              ],
              "rule": [
                {
                  "name": "base",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs"
                    },
                    {
                      "context": "entry"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "BuildObsBase",
                      "parameter": [
                        {
                          "valueId": "qr"
                        },
                        {
                          "valueId": "obs"
                        },
                        {
                          "valueId": "entry"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "category",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "SetSurveyCategory",
                      "parameter": [
                        {
                          "valueId": "qr"
                        },
                        {
                          "valueId": "obs"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "code",
                  "source": [
                    {
                      "context": "g"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "code",
                      "variable": "cc"
                    }
                  ],
                  "rule": [
                    {
                      "name": "coding",
                      "source": [
                        {
                          "context": "g"
                        }
                      ],
                      "target": [
                        {
                          "context": "cc",
                          "element": "coding",
                          "variable": "cg"
                        }
                      ],
                      "rule": [
                        {
                          "name": "sys",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "system",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "cd",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "code",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "preop-blood-requested-and-available-before-theatre"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "dsp",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "display",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "Blood requested and available before theatre"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_preop_blood_requested",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'pre-operative/blood/requested') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "preop-blood-requested"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Blood requested"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_preop_pints_available",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'pre-operative/blood/pints-available') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "preop-pints-available"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Pints available"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ],
              "documentation": "Blood requested, and how many pints are actually available. Two facts, and\r\nthe second is the one that stops a case: a request with no units against\r\nit is not blood in the fridge."
            }
          ],
          "documentation": "── The ward's pre-operative preparation ────────────────────────────────"
        },
        {
          "name": "postOperativePanel",
          "source": [
            {
              "context": "qr",
              "element": "item",
              "variable": "g",
              "condition": "(linkId = 'post-operative') and item.answer.value.exists()"
            }
          ],
          "target": [
            {
              "context": "bundle",
              "element": "entry",
              "variable": "entry"
            },
            {
              "context": "entry",
              "element": "resource",
              "variable": "obs",
              "transform": "create",
              "parameter": [
                {
                  "valueString": "Observation"
                }
              ]
            }
          ],
          "rule": [
            {
              "name": "base",
              "source": [
                {
                  "context": "qr"
                }
              ],
              "target": [
                {
                  "context": "obs"
                },
                {
                  "context": "entry"
                }
              ],
              "dependent": [
                {
                  "name": "BuildObsBase",
                  "parameter": [
                    {
                      "valueId": "qr"
                    },
                    {
                      "valueId": "obs"
                    },
                    {
                      "valueId": "entry"
                    }
                  ]
                }
              ]
            },
            {
              "name": "category",
              "source": [
                {
                  "context": "qr"
                }
              ],
              "target": [
                {
                  "context": "obs"
                }
              ],
              "dependent": [
                {
                  "name": "SetExamCategory",
                  "parameter": [
                    {
                      "valueId": "qr"
                    },
                    {
                      "valueId": "obs"
                    }
                  ]
                }
              ]
            },
            {
              "name": "code",
              "source": [
                {
                  "context": "g"
                }
              ],
              "target": [
                {
                  "context": "obs",
                  "element": "code",
                  "variable": "cc"
                }
              ],
              "rule": [
                {
                  "name": "coding",
                  "source": [
                    {
                      "context": "g"
                    }
                  ],
                  "target": [
                    {
                      "context": "cc",
                      "element": "coding",
                      "variable": "cg"
                    }
                  ],
                  "rule": [
                    {
                      "name": "sys",
                      "source": [
                        {
                          "context": "g"
                        }
                      ],
                      "target": [
                        {
                          "context": "cg",
                          "element": "system",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "cd",
                      "source": [
                        {
                          "context": "g"
                        }
                      ],
                      "target": [
                        {
                          "context": "cg",
                          "element": "code",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "postoperative-check"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "dsp",
                      "source": [
                        {
                          "context": "g"
                        }
                      ],
                      "target": [
                        {
                          "context": "cg",
                          "element": "display",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "Post-operative check"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name": "comp_postop_wound_checked",
              "source": [
                {
                  "context": "g",
                  "element": "item",
                  "variable": "it",
                  "condition": "(linkId = 'post-operative/wound') and answer.value.exists()"
                }
              ],
              "target": [
                {
                  "context": "obs",
                  "element": "component",
                  "variable": "comp"
                }
              ],
              "rule": [
                {
                  "name": "code",
                  "source": [
                    {
                      "context": "it"
                    }
                  ],
                  "target": [
                    {
                      "context": "comp",
                      "element": "code",
                      "variable": "cc"
                    }
                  ],
                  "rule": [
                    {
                      "name": "coding",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "cc",
                          "element": "coding",
                          "variable": "cg"
                        }
                      ],
                      "rule": [
                        {
                          "name": "sys",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "system",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "cd",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "code",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "postop-wound-checked"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "dsp",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "display",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "Wound checked"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "value",
                  "source": [
                    {
                      "context": "it"
                    }
                  ],
                  "target": [
                    {
                      "context": "comp"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "SetComponentCodedValue",
                      "parameter": [
                        {
                          "valueId": "it"
                        },
                        {
                          "valueId": "comp"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name": "comp_postop_drainage_checked",
              "source": [
                {
                  "context": "g",
                  "element": "item",
                  "variable": "it",
                  "condition": "(linkId = 'post-operative/drainage') and answer.value.exists()"
                }
              ],
              "target": [
                {
                  "context": "obs",
                  "element": "component",
                  "variable": "comp"
                }
              ],
              "rule": [
                {
                  "name": "code",
                  "source": [
                    {
                      "context": "it"
                    }
                  ],
                  "target": [
                    {
                      "context": "comp",
                      "element": "code",
                      "variable": "cc"
                    }
                  ],
                  "rule": [
                    {
                      "name": "coding",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "cc",
                          "element": "coding",
                          "variable": "cg"
                        }
                      ],
                      "rule": [
                        {
                          "name": "sys",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "system",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "cd",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "code",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "postop-drainage-checked"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "dsp",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "display",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "Drainage checked"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "value",
                  "source": [
                    {
                      "context": "it"
                    }
                  ],
                  "target": [
                    {
                      "context": "comp"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "SetComponentCodedValue",
                      "parameter": [
                        {
                          "valueId": "it"
                        },
                        {
                          "valueId": "comp"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name": "comp_postop_vomiting_checked",
              "source": [
                {
                  "context": "g",
                  "element": "item",
                  "variable": "it",
                  "condition": "(linkId = 'post-operative/vomit') and answer.value.exists()"
                }
              ],
              "target": [
                {
                  "context": "obs",
                  "element": "component",
                  "variable": "comp"
                }
              ],
              "rule": [
                {
                  "name": "code",
                  "source": [
                    {
                      "context": "it"
                    }
                  ],
                  "target": [
                    {
                      "context": "comp",
                      "element": "code",
                      "variable": "cc"
                    }
                  ],
                  "rule": [
                    {
                      "name": "coding",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "cc",
                          "element": "coding",
                          "variable": "cg"
                        }
                      ],
                      "rule": [
                        {
                          "name": "sys",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "system",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "cd",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "code",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "postop-vomiting-checked"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "dsp",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "display",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "Vomiting checked"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "value",
                  "source": [
                    {
                      "context": "it"
                    }
                  ],
                  "target": [
                    {
                      "context": "comp"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "SetComponentCodedValue",
                      "parameter": [
                        {
                          "valueId": "it"
                        },
                        {
                          "valueId": "comp"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name": "comp_postop_catheter_in_place",
              "source": [
                {
                  "context": "g",
                  "element": "item",
                  "variable": "it",
                  "condition": "(linkId = 'post-operative/catheter') and answer.value.exists()"
                }
              ],
              "target": [
                {
                  "context": "obs",
                  "element": "component",
                  "variable": "comp"
                }
              ],
              "rule": [
                {
                  "name": "code",
                  "source": [
                    {
                      "context": "it"
                    }
                  ],
                  "target": [
                    {
                      "context": "comp",
                      "element": "code",
                      "variable": "cc"
                    }
                  ],
                  "rule": [
                    {
                      "name": "coding",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "cc",
                          "element": "coding",
                          "variable": "cg"
                        }
                      ],
                      "rule": [
                        {
                          "name": "sys",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "system",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "cd",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "code",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "postop-catheter-in-place"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "dsp",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "display",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "Catheter in place"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "value",
                  "source": [
                    {
                      "context": "it"
                    }
                  ],
                  "target": [
                    {
                      "context": "comp"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "SetComponentCodedValue",
                      "parameter": [
                        {
                          "valueId": "it"
                        },
                        {
                          "valueId": "comp"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name": "comp_postop_nasogastric_tube_in_place",
              "source": [
                {
                  "context": "g",
                  "element": "item",
                  "variable": "it",
                  "condition": "(linkId = 'post-operative/nasogastric-tube') and answer.value.exists()"
                }
              ],
              "target": [
                {
                  "context": "obs",
                  "element": "component",
                  "variable": "comp"
                }
              ],
              "rule": [
                {
                  "name": "code",
                  "source": [
                    {
                      "context": "it"
                    }
                  ],
                  "target": [
                    {
                      "context": "comp",
                      "element": "code",
                      "variable": "cc"
                    }
                  ],
                  "rule": [
                    {
                      "name": "coding",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "cc",
                          "element": "coding",
                          "variable": "cg"
                        }
                      ],
                      "rule": [
                        {
                          "name": "sys",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "system",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "cd",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "code",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "postop-nasogastric-tube-in-place"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "dsp",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "display",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "Nasogastric tube in place"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "value",
                  "source": [
                    {
                      "context": "it"
                    }
                  ],
                  "target": [
                    {
                      "context": "comp"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "SetComponentCodedValue",
                      "parameter": [
                        {
                          "valueId": "it"
                        },
                        {
                          "valueId": "comp"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name": "comp_postop_infusion_therapy_running",
              "source": [
                {
                  "context": "g",
                  "element": "item",
                  "variable": "it",
                  "condition": "(linkId = 'post-operative/infusion-therapy') and answer.value.exists()"
                }
              ],
              "target": [
                {
                  "context": "obs",
                  "element": "component",
                  "variable": "comp"
                }
              ],
              "rule": [
                {
                  "name": "code",
                  "source": [
                    {
                      "context": "it"
                    }
                  ],
                  "target": [
                    {
                      "context": "comp",
                      "element": "code",
                      "variable": "cc"
                    }
                  ],
                  "rule": [
                    {
                      "name": "coding",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "cc",
                          "element": "coding",
                          "variable": "cg"
                        }
                      ],
                      "rule": [
                        {
                          "name": "sys",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "system",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "cd",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "code",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "postop-infusion-therapy-running"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "dsp",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "display",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "Infusion therapy running"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "value",
                  "source": [
                    {
                      "context": "it"
                    }
                  ],
                  "target": [
                    {
                      "context": "comp"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "SetComponentCodedValue",
                      "parameter": [
                        {
                          "valueId": "it"
                        },
                        {
                          "valueId": "comp"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name": "comp_postop_oxygen_therapy_running",
              "source": [
                {
                  "context": "g",
                  "element": "item",
                  "variable": "it",
                  "condition": "(linkId = 'post-operative/oxygen-therapy') and answer.value.exists()"
                }
              ],
              "target": [
                {
                  "context": "obs",
                  "element": "component",
                  "variable": "comp"
                }
              ],
              "rule": [
                {
                  "name": "code",
                  "source": [
                    {
                      "context": "it"
                    }
                  ],
                  "target": [
                    {
                      "context": "comp",
                      "element": "code",
                      "variable": "cc"
                    }
                  ],
                  "rule": [
                    {
                      "name": "coding",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "cc",
                          "element": "coding",
                          "variable": "cg"
                        }
                      ],
                      "rule": [
                        {
                          "name": "sys",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "system",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "cd",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "code",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "postop-oxygen-therapy-running"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "dsp",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "display",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "Oxygen therapy running"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "value",
                  "source": [
                    {
                      "context": "it"
                    }
                  ],
                  "target": [
                    {
                      "context": "comp"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "SetComponentCodedValue",
                      "parameter": [
                        {
                          "valueId": "it"
                        },
                        {
                          "valueId": "comp"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name": "comp_postop_analgesic_therapy_given",
              "source": [
                {
                  "context": "g",
                  "element": "item",
                  "variable": "it",
                  "condition": "(linkId = 'post-operative/analgesic-therapy') and answer.value.exists()"
                }
              ],
              "target": [
                {
                  "context": "obs",
                  "element": "component",
                  "variable": "comp"
                }
              ],
              "rule": [
                {
                  "name": "code",
                  "source": [
                    {
                      "context": "it"
                    }
                  ],
                  "target": [
                    {
                      "context": "comp",
                      "element": "code",
                      "variable": "cc"
                    }
                  ],
                  "rule": [
                    {
                      "name": "coding",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "cc",
                          "element": "coding",
                          "variable": "cg"
                        }
                      ],
                      "rule": [
                        {
                          "name": "sys",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "system",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "cd",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "code",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "postop-analgesic-therapy-given"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "dsp",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "display",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "Analgesic therapy given"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "value",
                  "source": [
                    {
                      "context": "it"
                    }
                  ],
                  "target": [
                    {
                      "context": "comp"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "SetComponentCodedValue",
                      "parameter": [
                        {
                          "valueId": "it"
                        },
                        {
                          "valueId": "comp"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name": "comp_postop_pain",
              "source": [
                {
                  "context": "g",
                  "element": "item",
                  "variable": "it",
                  "condition": "(linkId = 'post-operative/pain') and answer.value.exists()"
                }
              ],
              "target": [
                {
                  "context": "obs",
                  "element": "component",
                  "variable": "comp"
                }
              ],
              "rule": [
                {
                  "name": "code",
                  "source": [
                    {
                      "context": "it"
                    }
                  ],
                  "target": [
                    {
                      "context": "comp",
                      "element": "code",
                      "variable": "cc"
                    }
                  ],
                  "rule": [
                    {
                      "name": "coding",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "cc",
                          "element": "coding",
                          "variable": "cg"
                        }
                      ],
                      "rule": [
                        {
                          "name": "sys",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "system",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "cd",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "code",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "postop-pain"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "dsp",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "display",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "Pain"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "value",
                  "source": [
                    {
                      "context": "it"
                    }
                  ],
                  "target": [
                    {
                      "context": "comp"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "SetComponentCodedValue",
                      "parameter": [
                        {
                          "valueId": "it"
                        },
                        {
                          "valueId": "comp"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name": "comp_postop_level_of_consciousness",
              "source": [
                {
                  "context": "g",
                  "element": "item",
                  "variable": "it",
                  "condition": "(linkId = 'post-operative/level-of-consciousness') and answer.value.exists()"
                }
              ],
              "target": [
                {
                  "context": "obs",
                  "element": "component",
                  "variable": "comp"
                }
              ],
              "rule": [
                {
                  "name": "code",
                  "source": [
                    {
                      "context": "it"
                    }
                  ],
                  "target": [
                    {
                      "context": "comp",
                      "element": "code",
                      "variable": "cc"
                    }
                  ],
                  "rule": [
                    {
                      "name": "coding",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "cc",
                          "element": "coding",
                          "variable": "cg"
                        }
                      ],
                      "rule": [
                        {
                          "name": "sys",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "system",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "cd",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "code",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "postop-level-of-consciousness"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "dsp",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "display",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "Level of consciousness"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "value",
                  "source": [
                    {
                      "context": "it"
                    }
                  ],
                  "target": [
                    {
                      "context": "comp"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "SetComponentCodedValue",
                      "parameter": [
                        {
                          "valueId": "it"
                        },
                        {
                          "valueId": "comp"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name": "comp_postop_check_list_operative_complete",
              "source": [
                {
                  "context": "g",
                  "element": "item",
                  "variable": "it",
                  "condition": "(linkId = 'post-operative/checklist-complete') and answer.value.exists()"
                }
              ],
              "target": [
                {
                  "context": "obs",
                  "element": "component",
                  "variable": "comp"
                }
              ],
              "rule": [
                {
                  "name": "code",
                  "source": [
                    {
                      "context": "it"
                    }
                  ],
                  "target": [
                    {
                      "context": "comp",
                      "element": "code",
                      "variable": "cc"
                    }
                  ],
                  "rule": [
                    {
                      "name": "coding",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "cc",
                          "element": "coding",
                          "variable": "cg"
                        }
                      ],
                      "rule": [
                        {
                          "name": "sys",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "system",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "cd",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "code",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "postop-check-list-operative-complete"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "dsp",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "display",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "Check-list operative complete"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "value",
                  "source": [
                    {
                      "context": "it"
                    }
                  ],
                  "target": [
                    {
                      "context": "comp"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "SetComponentCodedValue",
                      "parameter": [
                        {
                          "valueId": "it"
                        },
                        {
                          "valueId": "comp"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ],
          "documentation": "── The post-operative checks ───────────────────────────────────────────"
        },
        {
          "name": "vitalsGrp",
          "source": [
            {
              "context": "qr",
              "element": "item",
              "variable": "g",
              "condition": "linkId = 'pre-operative'"
            }
          ],
          "rule": [
            {
              "name": "vitalsSub",
              "source": [
                {
                  "context": "g",
                  "element": "item",
                  "variable": "g2",
                  "condition": "linkId = 'pre-operative/vitals'"
                }
              ],
              "rule": [
                {
                  "name": "vital_8310_5",
                  "source": [
                    {
                      "context": "g2",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'pre-operative/vitals/temperature') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "bundle",
                      "element": "entry",
                      "variable": "entry"
                    },
                    {
                      "context": "entry",
                      "element": "resource",
                      "variable": "obs",
                      "transform": "create",
                      "parameter": [
                        {
                          "valueString": "Observation"
                        }
                      ]
                    }
                  ],
                  "rule": [
                    {
                      "name": "base",
                      "source": [
                        {
                          "context": "qr"
                        }
                      ],
                      "target": [
                        {
                          "context": "obs"
                        },
                        {
                          "context": "entry"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "BuildObsBase",
                          "parameter": [
                            {
                              "valueId": "qr"
                            },
                            {
                              "valueId": "obs"
                            },
                            {
                              "valueId": "entry"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "category",
                      "source": [
                        {
                          "context": "qr"
                        }
                      ],
                      "target": [
                        {
                          "context": "obs"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetVitalSignsCategory",
                          "parameter": [
                            {
                              "valueId": "qr"
                            },
                            {
                              "valueId": "obs"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "obs",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "http://loinc.org"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "8310-5"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Body temperature"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "answer",
                      "source": [
                        {
                          "context": "it",
                          "element": "answer",
                          "listMode": "first",
                          "variable": "a"
                        }
                      ],
                      "rule": [
                        {
                          "name": "set",
                          "source": [
                            {
                              "context": "a",
                              "element": "value",
                              "variable": "v"
                            }
                          ],
                          "target": [
                            {
                              "context": "obs",
                              "element": "value",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueId": "v"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "phaseNote",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "obs",
                          "element": "note",
                          "variable": "n"
                        },
                        {
                          "context": "n",
                          "element": "text",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "Taken before theatre"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "vital_8867_4",
                  "source": [
                    {
                      "context": "g2",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'pre-operative/vitals/pulse') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "bundle",
                      "element": "entry",
                      "variable": "entry"
                    },
                    {
                      "context": "entry",
                      "element": "resource",
                      "variable": "obs",
                      "transform": "create",
                      "parameter": [
                        {
                          "valueString": "Observation"
                        }
                      ]
                    }
                  ],
                  "rule": [
                    {
                      "name": "base",
                      "source": [
                        {
                          "context": "qr"
                        }
                      ],
                      "target": [
                        {
                          "context": "obs"
                        },
                        {
                          "context": "entry"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "BuildObsBase",
                          "parameter": [
                            {
                              "valueId": "qr"
                            },
                            {
                              "valueId": "obs"
                            },
                            {
                              "valueId": "entry"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "category",
                      "source": [
                        {
                          "context": "qr"
                        }
                      ],
                      "target": [
                        {
                          "context": "obs"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetVitalSignsCategory",
                          "parameter": [
                            {
                              "valueId": "qr"
                            },
                            {
                              "valueId": "obs"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "obs",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "http://loinc.org"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "8867-4"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Heart rate"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "answer",
                      "source": [
                        {
                          "context": "it",
                          "element": "answer",
                          "listMode": "first",
                          "variable": "a"
                        }
                      ],
                      "rule": [
                        {
                          "name": "set",
                          "source": [
                            {
                              "context": "a",
                              "element": "value",
                              "variable": "v"
                            }
                          ],
                          "target": [
                            {
                              "context": "obs",
                              "element": "value",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueId": "v"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "phaseNote",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "obs",
                          "element": "note",
                          "variable": "n"
                        },
                        {
                          "context": "n",
                          "element": "text",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "Taken before theatre"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "vital_9279_1",
                  "source": [
                    {
                      "context": "g2",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'pre-operative/vitals/respiratory-rate') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "bundle",
                      "element": "entry",
                      "variable": "entry"
                    },
                    {
                      "context": "entry",
                      "element": "resource",
                      "variable": "obs",
                      "transform": "create",
                      "parameter": [
                        {
                          "valueString": "Observation"
                        }
                      ]
                    }
                  ],
                  "rule": [
                    {
                      "name": "base",
                      "source": [
                        {
                          "context": "qr"
                        }
                      ],
                      "target": [
                        {
                          "context": "obs"
                        },
                        {
                          "context": "entry"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "BuildObsBase",
                          "parameter": [
                            {
                              "valueId": "qr"
                            },
                            {
                              "valueId": "obs"
                            },
                            {
                              "valueId": "entry"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "category",
                      "source": [
                        {
                          "context": "qr"
                        }
                      ],
                      "target": [
                        {
                          "context": "obs"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetVitalSignsCategory",
                          "parameter": [
                            {
                              "valueId": "qr"
                            },
                            {
                              "valueId": "obs"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "obs",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "http://loinc.org"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "9279-1"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Respiratory rate"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "answer",
                      "source": [
                        {
                          "context": "it",
                          "element": "answer",
                          "listMode": "first",
                          "variable": "a"
                        }
                      ],
                      "rule": [
                        {
                          "name": "set",
                          "source": [
                            {
                              "context": "a",
                              "element": "value",
                              "variable": "v"
                            }
                          ],
                          "target": [
                            {
                              "context": "obs",
                              "element": "value",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueId": "v"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "phaseNote",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "obs",
                          "element": "note",
                          "variable": "n"
                        },
                        {
                          "context": "n",
                          "element": "text",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "Taken before theatre"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "vital_59408_5",
                  "source": [
                    {
                      "context": "g2",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'pre-operative/vitals/oxygen-saturation') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "bundle",
                      "element": "entry",
                      "variable": "entry"
                    },
                    {
                      "context": "entry",
                      "element": "resource",
                      "variable": "obs",
                      "transform": "create",
                      "parameter": [
                        {
                          "valueString": "Observation"
                        }
                      ]
                    }
                  ],
                  "rule": [
                    {
                      "name": "base",
                      "source": [
                        {
                          "context": "qr"
                        }
                      ],
                      "target": [
                        {
                          "context": "obs"
                        },
                        {
                          "context": "entry"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "BuildObsBase",
                          "parameter": [
                            {
                              "valueId": "qr"
                            },
                            {
                              "valueId": "obs"
                            },
                            {
                              "valueId": "entry"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "category",
                      "source": [
                        {
                          "context": "qr"
                        }
                      ],
                      "target": [
                        {
                          "context": "obs"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetVitalSignsCategory",
                          "parameter": [
                            {
                              "valueId": "qr"
                            },
                            {
                              "valueId": "obs"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "obs",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "http://loinc.org"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "59408-5"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Oxygen saturation in Arterial blood by Pulse oximetry"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "answer",
                      "source": [
                        {
                          "context": "it",
                          "element": "answer",
                          "listMode": "first",
                          "variable": "a"
                        }
                      ],
                      "rule": [
                        {
                          "name": "set",
                          "source": [
                            {
                              "context": "a",
                              "element": "value",
                              "variable": "v"
                            }
                          ],
                          "target": [
                            {
                              "context": "obs",
                              "element": "value",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueId": "v"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "phaseNote",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "obs",
                          "element": "note",
                          "variable": "n"
                        },
                        {
                          "context": "n",
                          "element": "text",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "Taken before theatre"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "bp",
                  "source": [
                    {
                      "context": "g2",
                      "element": "item",
                      "variable": "bp",
                      "condition": "(linkId = 'pre-operative/vitals/blood-pressure') and item.answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "bundle",
                      "element": "entry",
                      "variable": "entry"
                    },
                    {
                      "context": "entry",
                      "element": "resource",
                      "variable": "obs",
                      "transform": "create",
                      "parameter": [
                        {
                          "valueString": "Observation"
                        }
                      ]
                    }
                  ],
                  "rule": [
                    {
                      "name": "base",
                      "source": [
                        {
                          "context": "qr"
                        }
                      ],
                      "target": [
                        {
                          "context": "obs"
                        },
                        {
                          "context": "entry"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "BuildObsBase",
                          "parameter": [
                            {
                              "valueId": "qr"
                            },
                            {
                              "valueId": "obs"
                            },
                            {
                              "valueId": "entry"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "category",
                      "source": [
                        {
                          "context": "qr"
                        }
                      ],
                      "target": [
                        {
                          "context": "obs"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetVitalSignsCategory",
                          "parameter": [
                            {
                              "valueId": "qr"
                            },
                            {
                              "valueId": "obs"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "bp"
                        }
                      ],
                      "target": [
                        {
                          "context": "obs",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "bp"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "bp"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "http://loinc.org"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "bp"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "85354-9"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "bp"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Blood pressure panel with all children optional"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "comp_8480_6",
                      "source": [
                        {
                          "context": "bp",
                          "element": "item",
                          "variable": "it",
                          "condition": "(linkId = 'pre-operative/vitals/blood-pressure/systolic') and answer.value.exists()"
                        }
                      ],
                      "target": [
                        {
                          "context": "obs",
                          "element": "component",
                          "variable": "comp"
                        }
                      ],
                      "rule": [
                        {
                          "name": "code",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "comp",
                              "element": "code",
                              "variable": "cc"
                            }
                          ],
                          "rule": [
                            {
                              "name": "coding",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cc",
                                  "element": "coding",
                                  "variable": "cg"
                                }
                              ],
                              "rule": [
                                {
                                  "name": "sys",
                                  "source": [
                                    {
                                      "context": "it"
                                    }
                                  ],
                                  "target": [
                                    {
                                      "context": "cg",
                                      "element": "system",
                                      "transform": "copy",
                                      "parameter": [
                                        {
                                          "valueString": "http://loinc.org"
                                        }
                                      ]
                                    }
                                  ]
                                },
                                {
                                  "name": "cd",
                                  "source": [
                                    {
                                      "context": "it"
                                    }
                                  ],
                                  "target": [
                                    {
                                      "context": "cg",
                                      "element": "code",
                                      "transform": "copy",
                                      "parameter": [
                                        {
                                          "valueString": "8480-6"
                                        }
                                      ]
                                    }
                                  ]
                                },
                                {
                                  "name": "dsp",
                                  "source": [
                                    {
                                      "context": "it"
                                    }
                                  ],
                                  "target": [
                                    {
                                      "context": "cg",
                                      "element": "display",
                                      "transform": "copy",
                                      "parameter": [
                                        {
                                          "valueString": "Systolic blood pressure"
                                        }
                                      ]
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "value",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "comp"
                            }
                          ],
                          "dependent": [
                            {
                              "name": "SetComponentValue",
                              "parameter": [
                                {
                                  "valueId": "it"
                                },
                                {
                                  "valueId": "comp"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "comp_8462_4",
                      "source": [
                        {
                          "context": "bp",
                          "element": "item",
                          "variable": "it",
                          "condition": "(linkId = 'pre-operative/vitals/blood-pressure/diastolic') and answer.value.exists()"
                        }
                      ],
                      "target": [
                        {
                          "context": "obs",
                          "element": "component",
                          "variable": "comp"
                        }
                      ],
                      "rule": [
                        {
                          "name": "code",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "comp",
                              "element": "code",
                              "variable": "cc"
                            }
                          ],
                          "rule": [
                            {
                              "name": "coding",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cc",
                                  "element": "coding",
                                  "variable": "cg"
                                }
                              ],
                              "rule": [
                                {
                                  "name": "sys",
                                  "source": [
                                    {
                                      "context": "it"
                                    }
                                  ],
                                  "target": [
                                    {
                                      "context": "cg",
                                      "element": "system",
                                      "transform": "copy",
                                      "parameter": [
                                        {
                                          "valueString": "http://loinc.org"
                                        }
                                      ]
                                    }
                                  ]
                                },
                                {
                                  "name": "cd",
                                  "source": [
                                    {
                                      "context": "it"
                                    }
                                  ],
                                  "target": [
                                    {
                                      "context": "cg",
                                      "element": "code",
                                      "transform": "copy",
                                      "parameter": [
                                        {
                                          "valueString": "8462-4"
                                        }
                                      ]
                                    }
                                  ]
                                },
                                {
                                  "name": "dsp",
                                  "source": [
                                    {
                                      "context": "it"
                                    }
                                  ],
                                  "target": [
                                    {
                                      "context": "cg",
                                      "element": "display",
                                      "transform": "copy",
                                      "parameter": [
                                        {
                                          "valueString": "Diastolic blood pressure"
                                        }
                                      ]
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "value",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "comp"
                            }
                          ],
                          "dependent": [
                            {
                              "name": "SetComponentValue",
                              "parameter": [
                                {
                                  "valueId": "it"
                                },
                                {
                                  "valueId": "comp"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "phaseNote",
                      "source": [
                        {
                          "context": "bp"
                        }
                      ],
                      "target": [
                        {
                          "context": "obs",
                          "element": "note",
                          "variable": "n"
                        },
                        {
                          "context": "n",
                          "element": "text",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "Taken before theatre"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ],
          "documentation": "── Vital signs, before and after ───────────────────────────────────────\r\nThe same six readings twice. Each Observation carries a note saying which\r\nside of theatre it came from, because both sets have the same LOINC codes\r\nand the response's authored time is one instant for the whole form -- so\r\nwithout the note a ward could not tell the pre-operative pulse from the\r\npost-operative one."
        },
        {
          "name": "vitalsGrp2",
          "source": [
            {
              "context": "qr",
              "element": "item",
              "variable": "g",
              "condition": "linkId = 'post-operative'"
            }
          ],
          "rule": [
            {
              "name": "vitalsSub2",
              "source": [
                {
                  "context": "g",
                  "element": "item",
                  "variable": "g2",
                  "condition": "linkId = 'post-operative/vitals'"
                }
              ],
              "rule": [
                {
                  "name": "vital_8310_52",
                  "source": [
                    {
                      "context": "g2",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'post-operative/vitals/temperature') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "bundle",
                      "element": "entry",
                      "variable": "entry"
                    },
                    {
                      "context": "entry",
                      "element": "resource",
                      "variable": "obs",
                      "transform": "create",
                      "parameter": [
                        {
                          "valueString": "Observation"
                        }
                      ]
                    }
                  ],
                  "rule": [
                    {
                      "name": "base",
                      "source": [
                        {
                          "context": "qr"
                        }
                      ],
                      "target": [
                        {
                          "context": "obs"
                        },
                        {
                          "context": "entry"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "BuildObsBase",
                          "parameter": [
                            {
                              "valueId": "qr"
                            },
                            {
                              "valueId": "obs"
                            },
                            {
                              "valueId": "entry"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "category",
                      "source": [
                        {
                          "context": "qr"
                        }
                      ],
                      "target": [
                        {
                          "context": "obs"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetVitalSignsCategory",
                          "parameter": [
                            {
                              "valueId": "qr"
                            },
                            {
                              "valueId": "obs"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "obs",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "http://loinc.org"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "8310-5"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Body temperature"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "answer",
                      "source": [
                        {
                          "context": "it",
                          "element": "answer",
                          "listMode": "first",
                          "variable": "a"
                        }
                      ],
                      "rule": [
                        {
                          "name": "set",
                          "source": [
                            {
                              "context": "a",
                              "element": "value",
                              "variable": "v"
                            }
                          ],
                          "target": [
                            {
                              "context": "obs",
                              "element": "value",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueId": "v"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "phaseNote",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "obs",
                          "element": "note",
                          "variable": "n"
                        },
                        {
                          "context": "n",
                          "element": "text",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "Taken on return from theatre"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "vital_8867_42",
                  "source": [
                    {
                      "context": "g2",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'post-operative/vitals/pulse') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "bundle",
                      "element": "entry",
                      "variable": "entry"
                    },
                    {
                      "context": "entry",
                      "element": "resource",
                      "variable": "obs",
                      "transform": "create",
                      "parameter": [
                        {
                          "valueString": "Observation"
                        }
                      ]
                    }
                  ],
                  "rule": [
                    {
                      "name": "base",
                      "source": [
                        {
                          "context": "qr"
                        }
                      ],
                      "target": [
                        {
                          "context": "obs"
                        },
                        {
                          "context": "entry"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "BuildObsBase",
                          "parameter": [
                            {
                              "valueId": "qr"
                            },
                            {
                              "valueId": "obs"
                            },
                            {
                              "valueId": "entry"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "category",
                      "source": [
                        {
                          "context": "qr"
                        }
                      ],
                      "target": [
                        {
                          "context": "obs"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetVitalSignsCategory",
                          "parameter": [
                            {
                              "valueId": "qr"
                            },
                            {
                              "valueId": "obs"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "obs",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "http://loinc.org"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "8867-4"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Heart rate"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "answer",
                      "source": [
                        {
                          "context": "it",
                          "element": "answer",
                          "listMode": "first",
                          "variable": "a"
                        }
                      ],
                      "rule": [
                        {
                          "name": "set",
                          "source": [
                            {
                              "context": "a",
                              "element": "value",
                              "variable": "v"
                            }
                          ],
                          "target": [
                            {
                              "context": "obs",
                              "element": "value",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueId": "v"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "phaseNote",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "obs",
                          "element": "note",
                          "variable": "n"
                        },
                        {
                          "context": "n",
                          "element": "text",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "Taken on return from theatre"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "vital_9279_12",
                  "source": [
                    {
                      "context": "g2",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'post-operative/vitals/respiratory-rate') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "bundle",
                      "element": "entry",
                      "variable": "entry"
                    },
                    {
                      "context": "entry",
                      "element": "resource",
                      "variable": "obs",
                      "transform": "create",
                      "parameter": [
                        {
                          "valueString": "Observation"
                        }
                      ]
                    }
                  ],
                  "rule": [
                    {
                      "name": "base",
                      "source": [
                        {
                          "context": "qr"
                        }
                      ],
                      "target": [
                        {
                          "context": "obs"
                        },
                        {
                          "context": "entry"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "BuildObsBase",
                          "parameter": [
                            {
                              "valueId": "qr"
                            },
                            {
                              "valueId": "obs"
                            },
                            {
                              "valueId": "entry"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "category",
                      "source": [
                        {
                          "context": "qr"
                        }
                      ],
                      "target": [
                        {
                          "context": "obs"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetVitalSignsCategory",
                          "parameter": [
                            {
                              "valueId": "qr"
                            },
                            {
                              "valueId": "obs"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "obs",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "http://loinc.org"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "9279-1"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Respiratory rate"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "answer",
                      "source": [
                        {
                          "context": "it",
                          "element": "answer",
                          "listMode": "first",
                          "variable": "a"
                        }
                      ],
                      "rule": [
                        {
                          "name": "set",
                          "source": [
                            {
                              "context": "a",
                              "element": "value",
                              "variable": "v"
                            }
                          ],
                          "target": [
                            {
                              "context": "obs",
                              "element": "value",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueId": "v"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "phaseNote",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "obs",
                          "element": "note",
                          "variable": "n"
                        },
                        {
                          "context": "n",
                          "element": "text",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "Taken on return from theatre"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "vital_59408_52",
                  "source": [
                    {
                      "context": "g2",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'post-operative/vitals/oxygen-saturation') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "bundle",
                      "element": "entry",
                      "variable": "entry"
                    },
                    {
                      "context": "entry",
                      "element": "resource",
                      "variable": "obs",
                      "transform": "create",
                      "parameter": [
                        {
                          "valueString": "Observation"
                        }
                      ]
                    }
                  ],
                  "rule": [
                    {
                      "name": "base",
                      "source": [
                        {
                          "context": "qr"
                        }
                      ],
                      "target": [
                        {
                          "context": "obs"
                        },
                        {
                          "context": "entry"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "BuildObsBase",
                          "parameter": [
                            {
                              "valueId": "qr"
                            },
                            {
                              "valueId": "obs"
                            },
                            {
                              "valueId": "entry"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "category",
                      "source": [
                        {
                          "context": "qr"
                        }
                      ],
                      "target": [
                        {
                          "context": "obs"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetVitalSignsCategory",
                          "parameter": [
                            {
                              "valueId": "qr"
                            },
                            {
                              "valueId": "obs"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "obs",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "http://loinc.org"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "59408-5"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Oxygen saturation in Arterial blood by Pulse oximetry"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "answer",
                      "source": [
                        {
                          "context": "it",
                          "element": "answer",
                          "listMode": "first",
                          "variable": "a"
                        }
                      ],
                      "rule": [
                        {
                          "name": "set",
                          "source": [
                            {
                              "context": "a",
                              "element": "value",
                              "variable": "v"
                            }
                          ],
                          "target": [
                            {
                              "context": "obs",
                              "element": "value",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueId": "v"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "phaseNote",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "obs",
                          "element": "note",
                          "variable": "n"
                        },
                        {
                          "context": "n",
                          "element": "text",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "Taken on return from theatre"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "bp2",
                  "source": [
                    {
                      "context": "g2",
                      "element": "item",
                      "variable": "bp",
                      "condition": "(linkId = 'post-operative/vitals/blood-pressure') and item.answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "bundle",
                      "element": "entry",
                      "variable": "entry"
                    },
                    {
                      "context": "entry",
                      "element": "resource",
                      "variable": "obs",
                      "transform": "create",
                      "parameter": [
                        {
                          "valueString": "Observation"
                        }
                      ]
                    }
                  ],
                  "rule": [
                    {
                      "name": "base",
                      "source": [
                        {
                          "context": "qr"
                        }
                      ],
                      "target": [
                        {
                          "context": "obs"
                        },
                        {
                          "context": "entry"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "BuildObsBase",
                          "parameter": [
                            {
                              "valueId": "qr"
                            },
                            {
                              "valueId": "obs"
                            },
                            {
                              "valueId": "entry"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "category",
                      "source": [
                        {
                          "context": "qr"
                        }
                      ],
                      "target": [
                        {
                          "context": "obs"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetVitalSignsCategory",
                          "parameter": [
                            {
                              "valueId": "qr"
                            },
                            {
                              "valueId": "obs"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "bp"
                        }
                      ],
                      "target": [
                        {
                          "context": "obs",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "bp"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "bp"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "http://loinc.org"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "bp"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "85354-9"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "bp"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Blood pressure panel with all children optional"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "comp_8480_62",
                      "source": [
                        {
                          "context": "bp",
                          "element": "item",
                          "variable": "it",
                          "condition": "(linkId = 'post-operative/vitals/blood-pressure/systolic') and answer.value.exists()"
                        }
                      ],
                      "target": [
                        {
                          "context": "obs",
                          "element": "component",
                          "variable": "comp"
                        }
                      ],
                      "rule": [
                        {
                          "name": "code",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "comp",
                              "element": "code",
                              "variable": "cc"
                            }
                          ],
                          "rule": [
                            {
                              "name": "coding",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cc",
                                  "element": "coding",
                                  "variable": "cg"
                                }
                              ],
                              "rule": [
                                {
                                  "name": "sys",
                                  "source": [
                                    {
                                      "context": "it"
                                    }
                                  ],
                                  "target": [
                                    {
                                      "context": "cg",
                                      "element": "system",
                                      "transform": "copy",
                                      "parameter": [
                                        {
                                          "valueString": "http://loinc.org"
                                        }
                                      ]
                                    }
                                  ]
                                },
                                {
                                  "name": "cd",
                                  "source": [
                                    {
                                      "context": "it"
                                    }
                                  ],
                                  "target": [
                                    {
                                      "context": "cg",
                                      "element": "code",
                                      "transform": "copy",
                                      "parameter": [
                                        {
                                          "valueString": "8480-6"
                                        }
                                      ]
                                    }
                                  ]
                                },
                                {
                                  "name": "dsp",
                                  "source": [
                                    {
                                      "context": "it"
                                    }
                                  ],
                                  "target": [
                                    {
                                      "context": "cg",
                                      "element": "display",
                                      "transform": "copy",
                                      "parameter": [
                                        {
                                          "valueString": "Systolic blood pressure"
                                        }
                                      ]
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "value",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "comp"
                            }
                          ],
                          "dependent": [
                            {
                              "name": "SetComponentValue",
                              "parameter": [
                                {
                                  "valueId": "it"
                                },
                                {
                                  "valueId": "comp"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "comp_8462_42",
                      "source": [
                        {
                          "context": "bp",
                          "element": "item",
                          "variable": "it",
                          "condition": "(linkId = 'post-operative/vitals/blood-pressure/diastolic') and answer.value.exists()"
                        }
                      ],
                      "target": [
                        {
                          "context": "obs",
                          "element": "component",
                          "variable": "comp"
                        }
                      ],
                      "rule": [
                        {
                          "name": "code",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "comp",
                              "element": "code",
                              "variable": "cc"
                            }
                          ],
                          "rule": [
                            {
                              "name": "coding",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cc",
                                  "element": "coding",
                                  "variable": "cg"
                                }
                              ],
                              "rule": [
                                {
                                  "name": "sys",
                                  "source": [
                                    {
                                      "context": "it"
                                    }
                                  ],
                                  "target": [
                                    {
                                      "context": "cg",
                                      "element": "system",
                                      "transform": "copy",
                                      "parameter": [
                                        {
                                          "valueString": "http://loinc.org"
                                        }
                                      ]
                                    }
                                  ]
                                },
                                {
                                  "name": "cd",
                                  "source": [
                                    {
                                      "context": "it"
                                    }
                                  ],
                                  "target": [
                                    {
                                      "context": "cg",
                                      "element": "code",
                                      "transform": "copy",
                                      "parameter": [
                                        {
                                          "valueString": "8462-4"
                                        }
                                      ]
                                    }
                                  ]
                                },
                                {
                                  "name": "dsp",
                                  "source": [
                                    {
                                      "context": "it"
                                    }
                                  ],
                                  "target": [
                                    {
                                      "context": "cg",
                                      "element": "display",
                                      "transform": "copy",
                                      "parameter": [
                                        {
                                          "valueString": "Diastolic blood pressure"
                                        }
                                      ]
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "value",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "comp"
                            }
                          ],
                          "dependent": [
                            {
                              "name": "SetComponentValue",
                              "parameter": [
                                {
                                  "valueId": "it"
                                },
                                {
                                  "valueId": "comp"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "phaseNote",
                      "source": [
                        {
                          "context": "bp"
                        }
                      ],
                      "target": [
                        {
                          "context": "obs",
                          "element": "note",
                          "variable": "n"
                        },
                        {
                          "context": "n",
                          "element": "text",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "Taken on return from theatre"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name": "orderGrp",
          "source": [
            {
              "context": "qr",
              "element": "item",
              "variable": "g",
              "condition": "linkId = 'pre-operative'"
            }
          ],
          "rule": [
            {
              "name": "orderSub",
              "source": [
                {
                  "context": "g",
                  "element": "item",
                  "variable": "g2",
                  "condition": "linkId = 'pre-operative/investigations'"
                }
              ],
              "rule": [
                {
                  "name": "order_fhg",
                  "source": [
                    {
                      "context": "g2",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'pre-operative/investigations/fhg') and (answer.value.ofType(Coding).code = 'Y')"
                    }
                  ],
                  "target": [
                    {
                      "context": "bundle",
                      "element": "entry",
                      "variable": "entry"
                    },
                    {
                      "context": "entry",
                      "element": "resource",
                      "variable": "sr",
                      "transform": "create",
                      "parameter": [
                        {
                          "valueString": "ServiceRequest"
                        }
                      ]
                    }
                  ],
                  "rule": [
                    {
                      "name": "base",
                      "source": [
                        {
                          "context": "qr"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr"
                        },
                        {
                          "context": "entry"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "BuildServiceRequestBase",
                          "parameter": [
                            {
                              "valueId": "qr"
                            },
                            {
                              "valueId": "sr"
                            },
                            {
                              "valueId": "entry"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "status",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "status",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "active"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "intent",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "intent",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "order"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "category",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "category",
                          "variable": "cat"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cat",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "http://snomed.info/sct"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "108252007"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Laboratory procedure"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "codeText",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "code",
                          "variable": "cr"
                        },
                        {
                          "context": "cr",
                          "element": "concept",
                          "variable": "cc"
                        },
                        {
                          "context": "cc",
                          "element": "text",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "Full haemogram"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "authoredOn",
                      "source": [
                        {
                          "context": "qr",
                          "element": "authored",
                          "variable": "t"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "authoredOn",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueId": "t"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "encounter",
                      "source": [
                        {
                          "context": "qr",
                          "element": "encounter",
                          "variable": "e"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "encounter",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueId": "e"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "requester",
                      "source": [
                        {
                          "context": "qr",
                          "element": "source",
                          "variable": "src"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "requester",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueId": "src"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "phaseNote",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "note",
                          "variable": "n"
                        },
                        {
                          "context": "n",
                          "element": "text",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "Ordered before theatre"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ],
          "documentation": "── Investigations ordered, before and after ─────────────────────────────"
        },
        {
          "name": "orderGrp2",
          "source": [
            {
              "context": "qr",
              "element": "item",
              "variable": "g",
              "condition": "linkId = 'pre-operative'"
            }
          ],
          "rule": [
            {
              "name": "orderSub2",
              "source": [
                {
                  "context": "g",
                  "element": "item",
                  "variable": "g2",
                  "condition": "linkId = 'pre-operative/investigations'"
                }
              ],
              "rule": [
                {
                  "name": "order_coagulation",
                  "source": [
                    {
                      "context": "g2",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'pre-operative/investigations/coagulation') and (answer.value.ofType(Coding).code = 'Y')"
                    }
                  ],
                  "target": [
                    {
                      "context": "bundle",
                      "element": "entry",
                      "variable": "entry"
                    },
                    {
                      "context": "entry",
                      "element": "resource",
                      "variable": "sr",
                      "transform": "create",
                      "parameter": [
                        {
                          "valueString": "ServiceRequest"
                        }
                      ]
                    }
                  ],
                  "rule": [
                    {
                      "name": "base",
                      "source": [
                        {
                          "context": "qr"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr"
                        },
                        {
                          "context": "entry"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "BuildServiceRequestBase",
                          "parameter": [
                            {
                              "valueId": "qr"
                            },
                            {
                              "valueId": "sr"
                            },
                            {
                              "valueId": "entry"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "status",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "status",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "active"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "intent",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "intent",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "order"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "category",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "category",
                          "variable": "cat"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cat",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "http://snomed.info/sct"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "108252007"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Laboratory procedure"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "codeText",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "code",
                          "variable": "cr"
                        },
                        {
                          "context": "cr",
                          "element": "concept",
                          "variable": "cc"
                        },
                        {
                          "context": "cc",
                          "element": "text",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "Coagulation profile"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "authoredOn",
                      "source": [
                        {
                          "context": "qr",
                          "element": "authored",
                          "variable": "t"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "authoredOn",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueId": "t"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "encounter",
                      "source": [
                        {
                          "context": "qr",
                          "element": "encounter",
                          "variable": "e"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "encounter",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueId": "e"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "requester",
                      "source": [
                        {
                          "context": "qr",
                          "element": "source",
                          "variable": "src"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "requester",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueId": "src"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "phaseNote",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "note",
                          "variable": "n"
                        },
                        {
                          "context": "n",
                          "element": "text",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "Ordered before theatre"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name": "orderGrp3",
          "source": [
            {
              "context": "qr",
              "element": "item",
              "variable": "g",
              "condition": "linkId = 'pre-operative'"
            }
          ],
          "rule": [
            {
              "name": "orderSub3",
              "source": [
                {
                  "context": "g",
                  "element": "item",
                  "variable": "g2",
                  "condition": "linkId = 'pre-operative/investigations'"
                }
              ],
              "rule": [
                {
                  "name": "order_urinalysis",
                  "source": [
                    {
                      "context": "g2",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'pre-operative/investigations/urinalysis') and (answer.value.ofType(Coding).code = 'Y')"
                    }
                  ],
                  "target": [
                    {
                      "context": "bundle",
                      "element": "entry",
                      "variable": "entry"
                    },
                    {
                      "context": "entry",
                      "element": "resource",
                      "variable": "sr",
                      "transform": "create",
                      "parameter": [
                        {
                          "valueString": "ServiceRequest"
                        }
                      ]
                    }
                  ],
                  "rule": [
                    {
                      "name": "base",
                      "source": [
                        {
                          "context": "qr"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr"
                        },
                        {
                          "context": "entry"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "BuildServiceRequestBase",
                          "parameter": [
                            {
                              "valueId": "qr"
                            },
                            {
                              "valueId": "sr"
                            },
                            {
                              "valueId": "entry"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "status",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "status",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "active"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "intent",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "intent",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "order"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "category",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "category",
                          "variable": "cat"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cat",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "http://snomed.info/sct"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "108252007"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Laboratory procedure"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "codeText",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "code",
                          "variable": "cr"
                        },
                        {
                          "context": "cr",
                          "element": "concept",
                          "variable": "cc"
                        },
                        {
                          "context": "cc",
                          "element": "text",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "Urinalysis"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "authoredOn",
                      "source": [
                        {
                          "context": "qr",
                          "element": "authored",
                          "variable": "t"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "authoredOn",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueId": "t"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "encounter",
                      "source": [
                        {
                          "context": "qr",
                          "element": "encounter",
                          "variable": "e"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "encounter",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueId": "e"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "requester",
                      "source": [
                        {
                          "context": "qr",
                          "element": "source",
                          "variable": "src"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "requester",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueId": "src"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "phaseNote",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "note",
                          "variable": "n"
                        },
                        {
                          "context": "n",
                          "element": "text",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "Ordered before theatre"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name": "orderGrp4",
          "source": [
            {
              "context": "qr",
              "element": "item",
              "variable": "g",
              "condition": "linkId = 'pre-operative'"
            }
          ],
          "rule": [
            {
              "name": "orderSub4",
              "source": [
                {
                  "context": "g",
                  "element": "item",
                  "variable": "g2",
                  "condition": "linkId = 'pre-operative/investigations'"
                }
              ],
              "rule": [
                {
                  "name": "order_blood_group",
                  "source": [
                    {
                      "context": "g2",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'pre-operative/investigations/blood-group') and (answer.value.ofType(Coding).code = 'Y')"
                    }
                  ],
                  "target": [
                    {
                      "context": "bundle",
                      "element": "entry",
                      "variable": "entry"
                    },
                    {
                      "context": "entry",
                      "element": "resource",
                      "variable": "sr",
                      "transform": "create",
                      "parameter": [
                        {
                          "valueString": "ServiceRequest"
                        }
                      ]
                    }
                  ],
                  "rule": [
                    {
                      "name": "base",
                      "source": [
                        {
                          "context": "qr"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr"
                        },
                        {
                          "context": "entry"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "BuildServiceRequestBase",
                          "parameter": [
                            {
                              "valueId": "qr"
                            },
                            {
                              "valueId": "sr"
                            },
                            {
                              "valueId": "entry"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "status",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "status",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "active"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "intent",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "intent",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "order"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "category",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "category",
                          "variable": "cat"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cat",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "http://snomed.info/sct"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "108252007"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Laboratory procedure"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "codeText",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "code",
                          "variable": "cr"
                        },
                        {
                          "context": "cr",
                          "element": "concept",
                          "variable": "cc"
                        },
                        {
                          "context": "cc",
                          "element": "text",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "Blood group"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "authoredOn",
                      "source": [
                        {
                          "context": "qr",
                          "element": "authored",
                          "variable": "t"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "authoredOn",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueId": "t"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "encounter",
                      "source": [
                        {
                          "context": "qr",
                          "element": "encounter",
                          "variable": "e"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "encounter",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueId": "e"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "requester",
                      "source": [
                        {
                          "context": "qr",
                          "element": "source",
                          "variable": "src"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "requester",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueId": "src"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "phaseNote",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "note",
                          "variable": "n"
                        },
                        {
                          "context": "n",
                          "element": "text",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "Ordered before theatre"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name": "orderGrp5",
          "source": [
            {
              "context": "qr",
              "element": "item",
              "variable": "g",
              "condition": "linkId = 'pre-operative'"
            }
          ],
          "rule": [
            {
              "name": "orderSub5",
              "source": [
                {
                  "context": "g",
                  "element": "item",
                  "variable": "g2",
                  "condition": "linkId = 'pre-operative/investigations'"
                }
              ],
              "rule": [
                {
                  "name": "order_x_ray",
                  "source": [
                    {
                      "context": "g2",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'pre-operative/investigations/x-ray') and (answer.value.ofType(Coding).code = 'Y')"
                    }
                  ],
                  "target": [
                    {
                      "context": "bundle",
                      "element": "entry",
                      "variable": "entry"
                    },
                    {
                      "context": "entry",
                      "element": "resource",
                      "variable": "sr",
                      "transform": "create",
                      "parameter": [
                        {
                          "valueString": "ServiceRequest"
                        }
                      ]
                    }
                  ],
                  "rule": [
                    {
                      "name": "base",
                      "source": [
                        {
                          "context": "qr"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr"
                        },
                        {
                          "context": "entry"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "BuildServiceRequestBase",
                          "parameter": [
                            {
                              "valueId": "qr"
                            },
                            {
                              "valueId": "sr"
                            },
                            {
                              "valueId": "entry"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "status",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "status",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "active"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "intent",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "intent",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "order"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "category",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "category",
                          "variable": "cat"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cat",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "http://snomed.info/sct"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "363679005"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Imaging"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "codeText",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "code",
                          "variable": "cr"
                        },
                        {
                          "context": "cr",
                          "element": "concept",
                          "variable": "cc"
                        },
                        {
                          "context": "cc",
                          "element": "text",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "X-ray"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "authoredOn",
                      "source": [
                        {
                          "context": "qr",
                          "element": "authored",
                          "variable": "t"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "authoredOn",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueId": "t"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "encounter",
                      "source": [
                        {
                          "context": "qr",
                          "element": "encounter",
                          "variable": "e"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "encounter",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueId": "e"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "requester",
                      "source": [
                        {
                          "context": "qr",
                          "element": "source",
                          "variable": "src"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "requester",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueId": "src"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "phaseNote",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "note",
                          "variable": "n"
                        },
                        {
                          "context": "n",
                          "element": "text",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "Ordered before theatre"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name": "orderGrp6",
          "source": [
            {
              "context": "qr",
              "element": "item",
              "variable": "g",
              "condition": "linkId = 'post-operative'"
            }
          ],
          "rule": [
            {
              "name": "orderSub6",
              "source": [
                {
                  "context": "g",
                  "element": "item",
                  "variable": "g2",
                  "condition": "linkId = 'post-operative/investigations'"
                }
              ],
              "rule": [
                {
                  "name": "order_fhg2",
                  "source": [
                    {
                      "context": "g2",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'post-operative/investigations/fhg') and (answer.value.ofType(Coding).code = 'Y')"
                    }
                  ],
                  "target": [
                    {
                      "context": "bundle",
                      "element": "entry",
                      "variable": "entry"
                    },
                    {
                      "context": "entry",
                      "element": "resource",
                      "variable": "sr",
                      "transform": "create",
                      "parameter": [
                        {
                          "valueString": "ServiceRequest"
                        }
                      ]
                    }
                  ],
                  "rule": [
                    {
                      "name": "base",
                      "source": [
                        {
                          "context": "qr"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr"
                        },
                        {
                          "context": "entry"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "BuildServiceRequestBase",
                          "parameter": [
                            {
                              "valueId": "qr"
                            },
                            {
                              "valueId": "sr"
                            },
                            {
                              "valueId": "entry"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "status",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "status",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "active"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "intent",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "intent",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "order"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "category",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "category",
                          "variable": "cat"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cat",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "http://snomed.info/sct"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "108252007"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Laboratory procedure"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "codeText",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "code",
                          "variable": "cr"
                        },
                        {
                          "context": "cr",
                          "element": "concept",
                          "variable": "cc"
                        },
                        {
                          "context": "cc",
                          "element": "text",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "Full haemogram"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "authoredOn",
                      "source": [
                        {
                          "context": "qr",
                          "element": "authored",
                          "variable": "t"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "authoredOn",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueId": "t"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "encounter",
                      "source": [
                        {
                          "context": "qr",
                          "element": "encounter",
                          "variable": "e"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "encounter",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueId": "e"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "requester",
                      "source": [
                        {
                          "context": "qr",
                          "element": "source",
                          "variable": "src"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "requester",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueId": "src"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "phaseNote",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "note",
                          "variable": "n"
                        },
                        {
                          "context": "n",
                          "element": "text",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "Ordered on return from theatre"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name": "orderGrp7",
          "source": [
            {
              "context": "qr",
              "element": "item",
              "variable": "g",
              "condition": "linkId = 'post-operative'"
            }
          ],
          "rule": [
            {
              "name": "orderSub7",
              "source": [
                {
                  "context": "g",
                  "element": "item",
                  "variable": "g2",
                  "condition": "linkId = 'post-operative/investigations'"
                }
              ],
              "rule": [
                {
                  "name": "order_coagulation2",
                  "source": [
                    {
                      "context": "g2",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'post-operative/investigations/coagulation') and (answer.value.ofType(Coding).code = 'Y')"
                    }
                  ],
                  "target": [
                    {
                      "context": "bundle",
                      "element": "entry",
                      "variable": "entry"
                    },
                    {
                      "context": "entry",
                      "element": "resource",
                      "variable": "sr",
                      "transform": "create",
                      "parameter": [
                        {
                          "valueString": "ServiceRequest"
                        }
                      ]
                    }
                  ],
                  "rule": [
                    {
                      "name": "base",
                      "source": [
                        {
                          "context": "qr"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr"
                        },
                        {
                          "context": "entry"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "BuildServiceRequestBase",
                          "parameter": [
                            {
                              "valueId": "qr"
                            },
                            {
                              "valueId": "sr"
                            },
                            {
                              "valueId": "entry"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "status",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "status",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "active"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "intent",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "intent",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "order"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "category",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "category",
                          "variable": "cat"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cat",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "http://snomed.info/sct"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "108252007"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Laboratory procedure"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "codeText",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "code",
                          "variable": "cr"
                        },
                        {
                          "context": "cr",
                          "element": "concept",
                          "variable": "cc"
                        },
                        {
                          "context": "cc",
                          "element": "text",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "Coagulation profile"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "authoredOn",
                      "source": [
                        {
                          "context": "qr",
                          "element": "authored",
                          "variable": "t"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "authoredOn",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueId": "t"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "encounter",
                      "source": [
                        {
                          "context": "qr",
                          "element": "encounter",
                          "variable": "e"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "encounter",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueId": "e"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "requester",
                      "source": [
                        {
                          "context": "qr",
                          "element": "source",
                          "variable": "src"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "requester",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueId": "src"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "phaseNote",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "note",
                          "variable": "n"
                        },
                        {
                          "context": "n",
                          "element": "text",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "Ordered on return from theatre"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name": "orderGrp8",
          "source": [
            {
              "context": "qr",
              "element": "item",
              "variable": "g",
              "condition": "linkId = 'post-operative'"
            }
          ],
          "rule": [
            {
              "name": "orderSub8",
              "source": [
                {
                  "context": "g",
                  "element": "item",
                  "variable": "g2",
                  "condition": "linkId = 'post-operative/investigations'"
                }
              ],
              "rule": [
                {
                  "name": "order_urinalysis2",
                  "source": [
                    {
                      "context": "g2",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'post-operative/investigations/urinalysis') and (answer.value.ofType(Coding).code = 'Y')"
                    }
                  ],
                  "target": [
                    {
                      "context": "bundle",
                      "element": "entry",
                      "variable": "entry"
                    },
                    {
                      "context": "entry",
                      "element": "resource",
                      "variable": "sr",
                      "transform": "create",
                      "parameter": [
                        {
                          "valueString": "ServiceRequest"
                        }
                      ]
                    }
                  ],
                  "rule": [
                    {
                      "name": "base",
                      "source": [
                        {
                          "context": "qr"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr"
                        },
                        {
                          "context": "entry"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "BuildServiceRequestBase",
                          "parameter": [
                            {
                              "valueId": "qr"
                            },
                            {
                              "valueId": "sr"
                            },
                            {
                              "valueId": "entry"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "status",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "status",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "active"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "intent",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "intent",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "order"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "category",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "category",
                          "variable": "cat"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cat",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "http://snomed.info/sct"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "108252007"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Laboratory procedure"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "codeText",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "code",
                          "variable": "cr"
                        },
                        {
                          "context": "cr",
                          "element": "concept",
                          "variable": "cc"
                        },
                        {
                          "context": "cc",
                          "element": "text",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "Urinalysis"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "authoredOn",
                      "source": [
                        {
                          "context": "qr",
                          "element": "authored",
                          "variable": "t"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "authoredOn",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueId": "t"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "encounter",
                      "source": [
                        {
                          "context": "qr",
                          "element": "encounter",
                          "variable": "e"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "encounter",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueId": "e"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "requester",
                      "source": [
                        {
                          "context": "qr",
                          "element": "source",
                          "variable": "src"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "requester",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueId": "src"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "phaseNote",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "note",
                          "variable": "n"
                        },
                        {
                          "context": "n",
                          "element": "text",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "Ordered on return from theatre"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name": "orderGrp9",
          "source": [
            {
              "context": "qr",
              "element": "item",
              "variable": "g",
              "condition": "linkId = 'post-operative'"
            }
          ],
          "rule": [
            {
              "name": "orderSub9",
              "source": [
                {
                  "context": "g",
                  "element": "item",
                  "variable": "g2",
                  "condition": "linkId = 'post-operative/investigations'"
                }
              ],
              "rule": [
                {
                  "name": "order_x_ray2",
                  "source": [
                    {
                      "context": "g2",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'post-operative/investigations/x-ray') and (answer.value.ofType(Coding).code = 'Y')"
                    }
                  ],
                  "target": [
                    {
                      "context": "bundle",
                      "element": "entry",
                      "variable": "entry"
                    },
                    {
                      "context": "entry",
                      "element": "resource",
                      "variable": "sr",
                      "transform": "create",
                      "parameter": [
                        {
                          "valueString": "ServiceRequest"
                        }
                      ]
                    }
                  ],
                  "rule": [
                    {
                      "name": "base",
                      "source": [
                        {
                          "context": "qr"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr"
                        },
                        {
                          "context": "entry"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "BuildServiceRequestBase",
                          "parameter": [
                            {
                              "valueId": "qr"
                            },
                            {
                              "valueId": "sr"
                            },
                            {
                              "valueId": "entry"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "status",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "status",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "active"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "intent",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "intent",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "order"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "category",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "category",
                          "variable": "cat"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cat",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "http://snomed.info/sct"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "363679005"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Imaging"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "codeText",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "code",
                          "variable": "cr"
                        },
                        {
                          "context": "cr",
                          "element": "concept",
                          "variable": "cc"
                        },
                        {
                          "context": "cc",
                          "element": "text",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "X-ray"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "authoredOn",
                      "source": [
                        {
                          "context": "qr",
                          "element": "authored",
                          "variable": "t"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "authoredOn",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueId": "t"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "encounter",
                      "source": [
                        {
                          "context": "qr",
                          "element": "encounter",
                          "variable": "e"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "encounter",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueId": "e"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "requester",
                      "source": [
                        {
                          "context": "qr",
                          "element": "source",
                          "variable": "src"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "requester",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueId": "src"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "phaseNote",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "sr",
                          "element": "note",
                          "variable": "n"
                        },
                        {
                          "context": "n",
                          "element": "text",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "Ordered on return from theatre"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name": "allergyObservation",
          "source": [
            {
              "context": "qr",
              "element": "item",
              "variable": "g",
              "condition": "(linkId = 'allergy') and item.answer.value.exists()"
            }
          ],
          "target": [
            {
              "context": "bundle",
              "element": "entry",
              "variable": "entry"
            },
            {
              "context": "entry",
              "element": "resource",
              "variable": "obs",
              "transform": "create",
              "parameter": [
                {
                  "valueString": "Observation"
                }
              ]
            }
          ],
          "rule": [
            {
              "name": "base",
              "source": [
                {
                  "context": "qr"
                }
              ],
              "target": [
                {
                  "context": "obs"
                },
                {
                  "context": "entry"
                }
              ],
              "dependent": [
                {
                  "name": "BuildObsBase",
                  "parameter": [
                    {
                      "valueId": "qr"
                    },
                    {
                      "valueId": "obs"
                    },
                    {
                      "valueId": "entry"
                    }
                  ]
                }
              ]
            },
            {
              "name": "category",
              "source": [
                {
                  "context": "qr"
                }
              ],
              "target": [
                {
                  "context": "obs"
                }
              ],
              "dependent": [
                {
                  "name": "SetSurveyCategory",
                  "parameter": [
                    {
                      "valueId": "qr"
                    },
                    {
                      "valueId": "obs"
                    }
                  ]
                }
              ]
            },
            {
              "name": "code",
              "source": [
                {
                  "context": "g"
                }
              ],
              "target": [
                {
                  "context": "obs",
                  "element": "code",
                  "variable": "cc"
                }
              ],
              "rule": [
                {
                  "name": "coding",
                  "source": [
                    {
                      "context": "g"
                    }
                  ],
                  "target": [
                    {
                      "context": "cc",
                      "element": "coding",
                      "variable": "cg"
                    }
                  ],
                  "rule": [
                    {
                      "name": "sys",
                      "source": [
                        {
                          "context": "g"
                        }
                      ],
                      "target": [
                        {
                          "context": "cg",
                          "element": "system",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "http://loinc.org"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "cd",
                      "source": [
                        {
                          "context": "g"
                        }
                      ],
                      "target": [
                        {
                          "context": "cg",
                          "element": "code",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "48765-2"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "dsp",
                      "source": [
                        {
                          "context": "g"
                        }
                      ],
                      "target": [
                        {
                          "context": "cg",
                          "element": "display",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "Allergies and adverse reactions Document"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "codeText",
                  "source": [
                    {
                      "context": "g"
                    }
                  ],
                  "target": [
                    {
                      "context": "cc",
                      "element": "text",
                      "transform": "copy",
                      "parameter": [
                        {
                          "valueString": "Allergy reviewed at the surgical safety checklist"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name": "note2",
              "source": [
                {
                  "context": "g",
                  "element": "item",
                  "variable": "it",
                  "condition": "linkId = 'allergy/drug'"
                }
              ],
              "rule": [
                {
                  "name": "answer",
                  "source": [
                    {
                      "context": "it",
                      "element": "answer",
                      "listMode": "first",
                      "variable": "a"
                    }
                  ],
                  "rule": [
                    {
                      "name": "text",
                      "source": [
                        {
                          "context": "a",
                          "element": "value",
                          "variable": "txt"
                        }
                      ],
                      "target": [
                        {
                          "context": "obs",
                          "element": "note",
                          "variable": "n"
                        },
                        {
                          "context": "n",
                          "element": "text",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueId": "txt"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name": "note3",
              "source": [
                {
                  "context": "g",
                  "element": "item",
                  "variable": "it",
                  "condition": "linkId = 'allergy/anaesthesia'"
                }
              ],
              "rule": [
                {
                  "name": "answer",
                  "source": [
                    {
                      "context": "it",
                      "element": "answer",
                      "listMode": "first",
                      "variable": "a"
                    }
                  ],
                  "rule": [
                    {
                      "name": "text",
                      "source": [
                        {
                          "context": "a",
                          "element": "value",
                          "variable": "txt"
                        }
                      ],
                      "target": [
                        {
                          "context": "obs",
                          "element": "note",
                          "variable": "n"
                        },
                        {
                          "context": "n",
                          "element": "text",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueId": "txt"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name": "note4",
              "source": [
                {
                  "context": "g",
                  "element": "item",
                  "variable": "it",
                  "condition": "linkId = 'allergy/other'"
                }
              ],
              "rule": [
                {
                  "name": "answer",
                  "source": [
                    {
                      "context": "it",
                      "element": "answer",
                      "listMode": "first",
                      "variable": "a"
                    }
                  ],
                  "rule": [
                    {
                      "name": "text",
                      "source": [
                        {
                          "context": "a",
                          "element": "value",
                          "variable": "txt"
                        }
                      ],
                      "target": [
                        {
                          "context": "obs",
                          "element": "note",
                          "variable": "n"
                        },
                        {
                          "context": "n",
                          "element": "text",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueId": "txt"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name": "comp_who_check_no_known_allergies",
              "source": [
                {
                  "context": "g",
                  "element": "item",
                  "variable": "it",
                  "condition": "(linkId = 'allergy/none-known') and answer.value.exists()"
                }
              ],
              "target": [
                {
                  "context": "obs",
                  "element": "component",
                  "variable": "comp"
                }
              ],
              "rule": [
                {
                  "name": "code",
                  "source": [
                    {
                      "context": "it"
                    }
                  ],
                  "target": [
                    {
                      "context": "comp",
                      "element": "code",
                      "variable": "cc"
                    }
                  ],
                  "rule": [
                    {
                      "name": "coding",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "cc",
                          "element": "coding",
                          "variable": "cg"
                        }
                      ],
                      "rule": [
                        {
                          "name": "sys",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "system",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "cd",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "code",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "who-check-no-known-allergies"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "dsp",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "display",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "No known allergies"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "value",
                  "source": [
                    {
                      "context": "it"
                    }
                  ],
                  "target": [
                    {
                      "context": "comp"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "SetComponentCodedValue",
                      "parameter": [
                        {
                          "valueId": "it"
                        },
                        {
                          "valueId": "comp"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ],
          "documentation": "── Allergy recorded on the checklist ───────────────────────────────────\r\nRecorded as an Observation, not an AllergyIntolerance. The checklist asks\r\nthe team to *review* a known allergy, not to record a new one; the drug,\r\nanaesthetic and other lines are what they read out, and creating an\r\nAllergyIntolerance from a read-back would duplicate whatever the pharmacy\r\nalready holds."
        }
      ]
    },
    {
      "name": "BuildObsBase",
      "documentation": "─────────────────────────────────────────────────────────────────────────────\r\nShared scaffolding. Repeated in each map rather than imported: the transform\r\nengine resolves `imports` against whatever StructureMaps happen to be on the\r\nserver, and a form that stops extracting because a shared map was not\r\nuploaded is a worse failure than a duplicated group.\r\nTwo notes on what the publisher's StructureMap validator says about this file.\r\nSource parameters below are left untyped on purpose. Writing `: Element` makes\r\nthe validator compare QuestionnaireResponse.item against the literal 'Element'\r\nand report them as incompatible with each other, which is noise, not a finding.\r\n`evaluate(context, expression)` is flagged as \"takes 1 parameter but 2 were\r\nfound\". Leave it. The FML parser in the same jar refuses the one-argument form\r\noutright -- it wants a parameter, a comma, then the FHIRPath -- so the\r\npublisher is objecting to what its own compiler emits. Two arguments is the\r\nonly form that compiles, and it is what the R5 transform engine executes.\r\n─────────────────────────────────────────────────────────────────────────────",
      "input": [
        {
          "name": "qr",
          "type": "QR",
          "mode": "source"
        },
        {
          "name": "obs",
          "type": "Observation",
          "mode": "target"
        },
        {
          "name": "entry",
          "mode": "target"
        }
      ],
      "rule": [
        {
          "name": "responseProvenance",
          "source": [
            {
              "context": "qr"
            }
          ],
          "target": [
            {
              "context": "obs"
            }
          ],
          "dependent": [
            {
              "name": "SetResponseProvenance",
              "parameter": [
                {
                  "valueId": "qr"
                },
                {
                  "valueId": "obs"
                }
              ]
            }
          ]
        },
        {
          "name": "idAndFullUrl",
          "source": [
            {
              "context": "qr"
            }
          ],
          "target": [
            {
              "context": "obs",
              "element": "id",
              "transform": "uuid"
            }
          ],
          "dependent": [
            {
              "name": "SetObservationFullUrl",
              "parameter": [
                {
                  "valueId": "obs"
                },
                {
                  "valueId": "entry"
                }
              ]
            }
          ]
        },
        {
          "name": "entryRequest",
          "source": [
            {
              "context": "qr"
            }
          ],
          "target": [
            {
              "context": "entry",
              "element": "request",
              "variable": "request"
            }
          ],
          "rule": [
            {
              "name": "requestMethod",
              "source": [
                {
                  "context": "qr"
                }
              ],
              "target": [
                {
                  "context": "request",
                  "element": "method",
                  "transform": "copy",
                  "parameter": [
                    {
                      "valueString": "POST"
                    }
                  ]
                }
              ]
            },
            {
              "name": "requestUrl",
              "source": [
                {
                  "context": "qr"
                }
              ],
              "target": [
                {
                  "context": "request",
                  "element": "url",
                  "transform": "copy",
                  "parameter": [
                    {
                      "valueString": "Observation"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name": "status",
          "source": [
            {
              "context": "qr"
            }
          ],
          "target": [
            {
              "context": "obs",
              "element": "status",
              "transform": "copy",
              "parameter": [
                {
                  "valueString": "final"
                }
              ]
            }
          ]
        },
        {
          "name": "subject",
          "source": [
            {
              "context": "qr",
              "element": "subject",
              "variable": "s"
            }
          ],
          "target": [
            {
              "context": "obs",
              "element": "subject",
              "transform": "copy",
              "parameter": [
                {
                  "valueId": "s"
                }
              ]
            }
          ]
        },
        {
          "name": "encounter",
          "source": [
            {
              "context": "qr",
              "element": "encounter",
              "variable": "e"
            }
          ],
          "target": [
            {
              "context": "obs",
              "element": "encounter",
              "transform": "copy",
              "parameter": [
                {
                  "valueId": "e"
                }
              ]
            }
          ]
        },
        {
          "name": "effective",
          "source": [
            {
              "context": "qr",
              "element": "authored",
              "variable": "t"
            }
          ],
          "target": [
            {
              "context": "obs",
              "element": "effective",
              "transform": "copy",
              "parameter": [
                {
                  "valueId": "t"
                }
              ]
            }
          ]
        },
        {
          "name": "performerFromSource",
          "source": [
            {
              "context": "qr",
              "element": "source",
              "variable": "src"
            }
          ],
          "target": [
            {
              "context": "obs",
              "element": "performer",
              "transform": "copy",
              "parameter": [
                {
                  "valueId": "src"
                }
              ]
            }
          ]
        },
        {
          "name": "performerFallback",
          "source": [
            {
              "context": "qr",
              "condition": "source.exists().not()"
            }
          ],
          "rule": [
            {
              "name": "performerFromAuthor",
              "source": [
                {
                  "context": "qr",
                  "element": "author",
                  "variable": "a"
                }
              ],
              "target": [
                {
                  "context": "obs",
                  "element": "performer",
                  "transform": "copy",
                  "parameter": [
                    {
                      "valueId": "a"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name": "linkQuestionnaireResponse",
          "source": [
            {
              "context": "qr",
              "element": "id",
              "variable": "qid",
              "condition": "$this.hasValue()"
            }
          ],
          "target": [
            {
              "context": "obs",
              "element": "derivedFrom",
              "variable": "ref",
              "transform": "create",
              "parameter": [
                {
                  "valueString": "Reference"
                }
              ]
            },
            {
              "context": "ref",
              "element": "reference",
              "transform": "copy",
              "parameter": [
                {
                  "valueId": "qid"
                }
              ]
            }
          ],
          "documentation": "A stored response's id already reads \"QuestionnaireResponse/<id>\", so it is\r\na relative reference as it stands. The hasValue() guard is what stops an\r\nunsaved response -- one posted straight to $extract rather than saved first\r\n-- from writing \"QuestionnaireResponse/null\" into the record."
        }
      ]
    },
    {
      "name": "SetObservationFullUrl",
      "input": [
        {
          "name": "obs",
          "type": "Observation",
          "mode": "source"
        },
        {
          "name": "entry",
          "mode": "target"
        }
      ],
      "rule": [
        {
          "name": "assignFullUrl",
          "source": [
            {
              "context": "obs",
              "element": "id",
              "variable": "id"
            }
          ],
          "target": [
            {
              "context": "entry",
              "element": "fullUrl",
              "transform": "append",
              "parameter": [
                {
                  "valueString": "https://fhir.slade360.co.ke/fhir/Observation/"
                },
                {
                  "valueId": "id"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name": "SetComponentCodedValue",
      "documentation": "The two answer shapes a component can carry. Both read the answer through the\r\nuntyped `.value` accessor: reading `valueCoding` or `valueQuantity` by its\r\ntyped property name fails at transform time on HAPI R5 with \"Attempt to read\r\ninvalid property ... on QuestionnaireResponse.item.answer\".",
      "input": [
        {
          "name": "it",
          "mode": "source"
        },
        {
          "name": "comp",
          "mode": "target"
        }
      ],
      "rule": [
        {
          "name": "componentAnswer",
          "source": [
            {
              "context": "it",
              "element": "answer",
              "listMode": "first",
              "variable": "a"
            }
          ],
          "rule": [
            {
              "name": "codedValue",
              "source": [
                {
                  "context": "a",
                  "element": "value",
                  "variable": "cv"
                }
              ],
              "target": [
                {
                  "context": "comp",
                  "element": "value",
                  "variable": "cc",
                  "transform": "create",
                  "parameter": [
                    {
                      "valueString": "CodeableConcept"
                    }
                  ]
                }
              ],
              "rule": [
                {
                  "name": "valueCoding",
                  "source": [
                    {
                      "context": "cv"
                    }
                  ],
                  "target": [
                    {
                      "context": "cc",
                      "element": "coding",
                      "transform": "copy",
                      "parameter": [
                        {
                          "valueId": "cv"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "valueText",
                  "source": [
                    {
                      "context": "cv",
                      "element": "display",
                      "variable": "d"
                    }
                  ],
                  "target": [
                    {
                      "context": "cc",
                      "element": "text",
                      "transform": "copy",
                      "parameter": [
                        {
                          "valueId": "d"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name": "SetComponentValue",
      "input": [
        {
          "name": "it",
          "mode": "source"
        },
        {
          "name": "comp",
          "mode": "target"
        }
      ],
      "rule": [
        {
          "name": "componentAnswer",
          "source": [
            {
              "context": "it",
              "element": "answer",
              "listMode": "first",
              "variable": "a"
            }
          ],
          "rule": [
            {
              "name": "plainValue",
              "source": [
                {
                  "context": "a",
                  "element": "value",
                  "variable": "v"
                }
              ],
              "target": [
                {
                  "context": "comp",
                  "element": "value",
                  "transform": "copy",
                  "parameter": [
                    {
                      "valueId": "v"
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name": "SetSurveyCategory",
      "input": [
        {
          "name": "qr",
          "type": "QR",
          "mode": "source"
        },
        {
          "name": "obs",
          "type": "Observation",
          "mode": "target"
        }
      ],
      "rule": [
        {
          "name": "category",
          "source": [
            {
              "context": "qr"
            }
          ],
          "target": [
            {
              "context": "obs",
              "element": "category",
              "variable": "cat"
            }
          ],
          "rule": [
            {
              "name": "categoryCoding",
              "source": [
                {
                  "context": "qr"
                }
              ],
              "target": [
                {
                  "context": "cat",
                  "element": "coding",
                  "variable": "coding"
                }
              ],
              "rule": [
                {
                  "name": "categorySystem",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "coding",
                      "element": "system",
                      "transform": "copy",
                      "parameter": [
                        {
                          "valueString": "http://terminology.hl7.org/CodeSystem/observation-category"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "categoryCode",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "coding",
                      "element": "code",
                      "transform": "copy",
                      "parameter": [
                        {
                          "valueString": "survey"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "categoryDisplay",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "coding",
                      "element": "display",
                      "transform": "copy",
                      "parameter": [
                        {
                          "valueString": "Survey"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name": "SetVitalSignsCategory",
      "input": [
        {
          "name": "qr",
          "type": "QR",
          "mode": "source"
        },
        {
          "name": "obs",
          "type": "Observation",
          "mode": "target"
        }
      ],
      "rule": [
        {
          "name": "category",
          "source": [
            {
              "context": "qr"
            }
          ],
          "target": [
            {
              "context": "obs",
              "element": "category",
              "variable": "cat"
            }
          ],
          "rule": [
            {
              "name": "categoryCoding",
              "source": [
                {
                  "context": "qr"
                }
              ],
              "target": [
                {
                  "context": "cat",
                  "element": "coding",
                  "variable": "coding"
                }
              ],
              "rule": [
                {
                  "name": "categorySystem",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "coding",
                      "element": "system",
                      "transform": "copy",
                      "parameter": [
                        {
                          "valueString": "http://terminology.hl7.org/CodeSystem/observation-category"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "categoryCode",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "coding",
                      "element": "code",
                      "transform": "copy",
                      "parameter": [
                        {
                          "valueString": "vital-signs"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "categoryDisplay",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "coding",
                      "element": "display",
                      "transform": "copy",
                      "parameter": [
                        {
                          "valueString": "Vital Signs"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name": "SetExamCategory",
      "input": [
        {
          "name": "qr",
          "type": "QR",
          "mode": "source"
        },
        {
          "name": "obs",
          "type": "Observation",
          "mode": "target"
        }
      ],
      "rule": [
        {
          "name": "category",
          "source": [
            {
              "context": "qr"
            }
          ],
          "target": [
            {
              "context": "obs",
              "element": "category",
              "variable": "cat"
            }
          ],
          "rule": [
            {
              "name": "categoryCoding",
              "source": [
                {
                  "context": "qr"
                }
              ],
              "target": [
                {
                  "context": "cat",
                  "element": "coding",
                  "variable": "coding"
                }
              ],
              "rule": [
                {
                  "name": "categorySystem",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "coding",
                      "element": "system",
                      "transform": "copy",
                      "parameter": [
                        {
                          "valueString": "http://terminology.hl7.org/CodeSystem/observation-category"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "categoryCode",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "coding",
                      "element": "code",
                      "transform": "copy",
                      "parameter": [
                        {
                          "valueString": "exam"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "categoryDisplay",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "coding",
                      "element": "display",
                      "transform": "copy",
                      "parameter": [
                        {
                          "valueString": "Exam"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name": "BuildServiceRequestBase",
      "input": [
        {
          "name": "qr",
          "type": "QR",
          "mode": "source"
        },
        {
          "name": "r",
          "type": "ServiceRequest",
          "mode": "target"
        },
        {
          "name": "entry",
          "mode": "target"
        }
      ],
      "rule": [
        {
          "name": "responseProvenance",
          "source": [
            {
              "context": "qr"
            }
          ],
          "target": [
            {
              "context": "r"
            }
          ],
          "dependent": [
            {
              "name": "SetResponseProvenance",
              "parameter": [
                {
                  "valueId": "qr"
                },
                {
                  "valueId": "r"
                }
              ]
            }
          ]
        },
        {
          "name": "idAndFullUrl",
          "source": [
            {
              "context": "qr"
            }
          ],
          "target": [
            {
              "context": "r",
              "element": "id",
              "transform": "uuid"
            }
          ],
          "dependent": [
            {
              "name": "SetServiceRequestFullUrl",
              "parameter": [
                {
                  "valueId": "r"
                },
                {
                  "valueId": "entry"
                }
              ]
            }
          ]
        },
        {
          "name": "entryRequest",
          "source": [
            {
              "context": "qr"
            }
          ],
          "target": [
            {
              "context": "entry",
              "element": "request",
              "variable": "request"
            }
          ],
          "rule": [
            {
              "name": "requestMethod",
              "source": [
                {
                  "context": "qr"
                }
              ],
              "target": [
                {
                  "context": "request",
                  "element": "method",
                  "transform": "copy",
                  "parameter": [
                    {
                      "valueString": "POST"
                    }
                  ]
                }
              ]
            },
            {
              "name": "requestUrl",
              "source": [
                {
                  "context": "qr"
                }
              ],
              "target": [
                {
                  "context": "request",
                  "element": "url",
                  "transform": "copy",
                  "parameter": [
                    {
                      "valueString": "ServiceRequest"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name": "subject",
          "source": [
            {
              "context": "qr",
              "element": "subject",
              "variable": "s"
            }
          ],
          "target": [
            {
              "context": "r",
              "element": "subject",
              "transform": "copy",
              "parameter": [
                {
                  "valueId": "s"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name": "SetServiceRequestFullUrl",
      "input": [
        {
          "name": "r",
          "type": "ServiceRequest",
          "mode": "source"
        },
        {
          "name": "entry",
          "mode": "target"
        }
      ],
      "rule": [
        {
          "name": "assignFullUrl",
          "source": [
            {
              "context": "r",
              "element": "id",
              "variable": "id"
            }
          ],
          "target": [
            {
              "context": "entry",
              "element": "fullUrl",
              "transform": "append",
              "parameter": [
                {
                  "valueString": "https://fhir.slade360.co.ke/fhir/ServiceRequest/"
                },
                {
                  "valueId": "id"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name": "SetResponseProvenance",
      "documentation": "── Provenance and tenancy ───────────────────────────────────────────────────\r\nTwo tags on everything this map creates. The first says which questionnaire\r\nproduced it, so a form that reopens mid-admission recalls its own earlier\r\nentries and not another form's. The second copies the tenant tags off the\r\nresponse, because nothing else on the path puts them there.\r\nThe code is the form's document type, not the questionnaire's id: every\r\nenvironment mints its own ids, and there is only one set of maps, so an id\r\nhere would tie the tag to whichever environment stamped it.\r\n── Provenance and tenancy ───────────────────────────────────────────────────",
      "input": [
        {
          "name": "qr",
          "type": "QR",
          "mode": "source"
        },
        {
          "name": "r",
          "mode": "target"
        }
      ],
      "rule": [
        {
          "name": "provenanceMeta",
          "source": [
            {
              "context": "qr"
            }
          ],
          "target": [
            {
              "context": "r",
              "element": "meta",
              "variable": "m"
            }
          ],
          "rule": [
            {
              "name": "provenanceTag",
              "source": [
                {
                  "context": "qr"
                }
              ],
              "target": [
                {
                  "context": "m",
                  "element": "tag",
                  "variable": "t"
                }
              ],
              "rule": [
                {
                  "name": "provenanceSystem",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "t",
                      "element": "system",
                      "transform": "copy",
                      "parameter": [
                        {
                          "valueString": "http://slade360edi.com/questionnaire-provenance"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "provenanceCode",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "t",
                      "element": "code",
                      "transform": "copy",
                      "parameter": [
                        {
                          "valueString": "surgical-safety-checklist"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "provenanceDisplay",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "t",
                      "element": "display",
                      "transform": "copy",
                      "parameter": [
                        {
                          "valueString": "Surgical safety checklist"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name": "tenantTags",
          "source": [
            {
              "context": "qr",
              "element": "meta",
              "variable": "qm"
            }
          ],
          "rule": [
            {
              "name": "copyTag",
              "source": [
                {
                  "context": "qm",
                  "element": "tag",
                  "variable": "qt"
                }
              ],
              "target": [
                {
                  "context": "r",
                  "element": "meta",
                  "variable": "m"
                },
                {
                  "context": "m",
                  "element": "tag",
                  "transform": "copy",
                  "parameter": [
                    {
                      "valueId": "qt"
                    }
                  ]
                }
              ]
            }
          ],
          "documentation": "Every tag the response carries, onto the resource. `meta` is 0..1, so this\r\nlands on the same meta the rule above created rather than a second one."
        }
      ]
    }
  ]
}