FHIR_To_CII_Mapping:
  PolarisAllergyIntolerance:
    text: "-"
    id: "-"
    identifier: "-"
    code.text: E18_Observation_Allergy_Agent 
    patient: "-"
    encounter: "-"
    recordedDate: "Used to decide which Encounter to associate this allergy with"
  PolarisAppointment:
    text: "-"
    identifier: "-"
    status: "-"
    start: "-"
    participant: "-"
    requestedPeriod.start: D1_Encounter_Request_Date
  PolarisCondition:
    text: "-"
    identifier: "-"
    code.text: E11_Observation_Health_Concern, E34_Observation_Encounter_Clinical_Assessment
    subject: "-"
    encounter: "-"
    onset[x]: E12_Observation_Health_Concern_Date_Of_Onset, E12_Observation_Health_Concern_Date_Of_Onset_Date_Precision
    recordedDate: "-"
  PolarisDiagnosticReport:
    text: "-"
    identifier: "-"
    status: "-"
    code.text: "-"
    subject: "-"
    encounter: "-"
    effective[x]: "-"
    presentedForm: "-"
    presentedForm.contentType: "-"
    presentedForm.data: "-"
    presentedForm.url: "-"
  PolarisDocumentReference:
    text: "-"
    identifier: "-"
    type: "**from AppState**" # For PDF_Document_Type_Coding, Document_Type_Code, Document_Type_Coding_System
    type.coding: "**from AppState**"
    type.text: "**from AppState**" # For Document_Type_Description_Text
    subject: "-"
    date: "-"
    custodian: "-"
    content: "-" # Container
    content.attachment: "-" # Container
    content.attachment.contentType: "-" # Expected to be application/pdf for CII
    content.attachment.data: PDF_Document
    content.attachment.size: "-"
    content.attachment.title: "-"
    context.encounter: "-"
  PolarisEmrDevice:
    text: "-"
    id: "-"
    identifier: "-"
    manufacturer: "-"
    deviceName: "-"
    deviceName.name: "-"
    deviceName.type: "-"
    type: "-"
    type.text: "-"
    version: "-"
    version.value: "-"
    owner: "-"
  PolarisEncounter:
    text: "-"
    identifier: D01_Encounter_Identifier # from .value
    class.code: D4_Encounter_Mode # from .code
    period.start: D3_Encounter_Date # from .start
    subject: "-"
    location: "-"
    serviceProvider: "-"
    reasonCode.text: D2_Client_Encounter_Reason # from .text
    reasonReference: "-"
  PolarisImmunization:
    text: "-"
    identifier: "-"
    vaccineCode.text: O1_Vaccine_Administered_Name
    patient: "-"
    encounter: "-"
    occurrence[x]: O2_Vaccine_Administered_Date, O2_Vaccine_Administered_Date_Date_Precision
    occurrence[x].extension: "-" # dataAbsentReason constraint
    lotNumber: O3_Vaccine_Administered_Lot_Number
  PolarisLocation:
    text: "-"
    identifier: "-"
    status: "-"
    name: C2_Service_Delivery_Location_Name
    alias: "-"
    description: "-"
    mode: "-"
    type: "-"
    telecom: "-"
    telecom.system: "-"
    telecom.value: "-"
    address: C4_Service_Delivery_Postal_Code # from address.postalCode
    physicalType: "-"
    position: "-"
    managingOrganization: "-"
    partOf: "-"
    hoursOfOperation: "-"
    availabilityExceptions: "-"
    endpoint: "-"
  PolarisMedicationDispense:
    text: "-"
    identifier: "-"
    status: "-"
    medicationCodeableConcept.text: N1_Medication_Dispensed
    subject: "-"
    performer: "-"
    performer.actor: "-"
    authorizingPrescription: "-"
    type: "-"
    quantity: "-"
    daysSupply: "-"
    whenPrepared: "-"
    whenHandedOver: N2_Medication_Dispensed_Date
    dosageInstruction: "-"
    note: "-"
  PolarisMedicationRequest:
    text: "-"
    identifier: "-"
    status: "-"
    intent: "-"
    subject: "-"
    encounter: "-"
    authoredOn: M2_Medication_Prescription_Date, M2a_Medication_Prescription_Date_Date_Precision
    requester: "-"
    dosageInstruction: M9_Medication_Form, M10_Medication_Frequency # General derivation, sub-elements map more specifically
    dosageInstruction.text: "-"
    dosageInstruction.route: M11_Medication_Route # from .text
    dosageInstruction.route.coding: "-"
    dosageInstruction.route.coding.system: "-"
    dosageInstruction.route.coding.code: "-"
    dosageInstruction.timing: M10_Medication_Frequency # Also container for boundsPeriod
    dosageInstruction.timing.repeat: "-" # Container
    dosageInstruction.timing.repeat.boundsPeriod: M3_Prescription_Expected_Completion_Date, M3a_Prescription_Expected_Completion_Date_Date_Precision, M13_Medication_Start_Date, M13a_Medication_Start_Date_Date_Precision, M14_Medication_End_Date, M14a_Medication_End_Date_Date_Precision
    dosageInstruction.timing.repeat.boundsPeriod.start: M13_Medication_Start_Date, M13a_Medication_Start_Date_Date_Precision
    dosageInstruction.timing.repeat.boundsPeriod.end: M14_Medication_End_Date, M14a_Medication_End_Date_Date_Precision, M3_Prescription_Expected_Completion_Date, M3a_Prescription_Expected_Completion_Date_Date_Precision
    dosageInstruction.doseAndRate:  M7_Medication_Dosage, M8_Medication_Dosage_Unit_Of_Measure # Container
    dosageInstruction.doseAndRate.doseQuantity: M7_Medication_Dosage, M8_Medication_Dosage_Unit_Of_Measure
    dosageInstruction.doseAndRate.doseQuantity.value: M7_Medication_Dosage
    dosageInstruction.doseAndRate.doseQuantity.unit: M8_Medication_Dosage_Unit_Of_Measure
    dosageInstruction.doseAndRate.doseQuantity.system: "-"
    dosageInstruction.doseAndRate.doseQuantity.code: "-"
    dispenseRequest: "-" # Container
    dispenseRequest.validityPeriod: "-"
    dispenseRequest.validityPeriod.start: "-"
    dispenseRequest.validityPeriod.end: "-"
    dispenseRequest.numberOfRepeatsAllowed: M12_Medication_Number_Of_Repeat_Refills
    dispenseRequest.quantity: "-"
    dispenseRequest.expectedSupplyDuration: M91_Supply_Duration, M92_Supply_Duration_Unit_Code
    dispenseRequest.expectedSupplyDuration.value: M91_Supply_Duration
    dispenseRequest.expectedSupplyDuration.unit: M92_Supply_Duration_Unit_Code
    dispenseRequest.expectedSupplyDuration.system: "-"
    dispenseRequest.expectedSupplyDuration.code: "-"
    contained[Medication].code.text: M1_Medication_Prescribed_Name # from .text
    contained[Medication].form.text: M9_Medication_Form
    contained[Medication].ingredient.strength.numerator.value: M5_Medication_Strength
    contained[Medication].ingredient.strength.numerator.unit: M6_Medication_Strength_Unit_Of_Measure
  PolarisObservation:
    text: "-"
    identifier: "-"
    status: "-"
    category: "Differentiate lab result from vitals observations"
    code.text: "Conditional: H2_Lab_Test_Result_Name (from .text), or LOINC code for E23-E40"
    subject: "-"
    encounter: "-"
    effective[x]: "Conditional: H1_Lab_Test_Performed_Date, J1_Di_Test_Performed_Date"
    value[x]: "Conditional: E23, E24, E28, E30, E32, E35, E37, E39 (from .valueQuantity.value & corresponding unit), H3_Lab_Test_Result_Value (from .value[x] & corresponding unit H4)"
  PolarisOrganization: as per CPAR
  PolarisPatient:
    id: "-"
    identifier: A1_Client_Identifier, A2_Client_Identifier_Type, A3_Client_Identifier_Assigning_Authority (from value and Jurisdictional Health Number with system URI from https://build.fhir.org/ig/HL7-Canada/ca-baseline/StructureDefinition-profile-patient.html#jurisdictional-health-number-jhn)
    text: "-"
    active: A9_Client_Status_Code
    name: A01_Client_Last_Name, A02_Client_Given_Name # From .family, .given
    name.use: "-"
    name.family: A01_Client_Last_Name
    name.given: A02_Client_Given_Name
    telecom: "-"
    gender: A5_Client_Administrative_Gender
    birthDate: A4_Client_Date_Of_Birth
    deceased[x]: "-"
    address: A14_Client_Residence_Postal_Code # from .postalCode
    maritalStatus: "-"
    multipleBirth[x]: "-"
    communication: "-"
    generalPractitioner: "-"
    managingOrganization: "-"
  PolarisPractitioner:
    text: "-"
    identifier: "**from AppState**" # For B4_Provider_Identifier
    active: "-"
    name: B1_Provider_Last_Name, B2_Provider_First_Name, B3_Provider_Middle_Name # From .family, .given
    name.family: B1_Provider_Last_Name
    name.given: B2_Provider_First_Name, B3_Provider_Middle_Name
  PolarisPractitionerRole:
    text: "-"
    identifier: "-"
    practitioner: "-"
    organization: "-"
  PolarisProcedure:
    text: "-"
    identifier: "-"
    code.text: F1_Intervention_Treatment # from .text
    subject: "-"
    encounter: "-"
    performed[x]: F2_Intervention_Treatment_Date, F2_Intervention_Treatment_Date_Date_Precision
  PolarisServiceRequest:
    text: "-"
    identifier: "-"
    status: "-"
    intent: "-"
    category: "distinguish lab vs DI vs referral orders"
    code.text: G1_Lab_Test_Name_Ordered, I1_Diagnostic_Imaging_Test_Ordered, K1_Referral_Service # from .text
    subject: "-"
    encounter: "-"
    occurrenceDateTime: L1_Referral_Occurred_Date
    authoredOn: G2_Lab_Test_Order_Date, I2_Diagnostic_Imaging_Test_Ordered_Date, K2_Referral_Requested_Date, K2_Referral_Requested_Date_Date_Precision
