HL7 FHIR Implementation Guide: Sri Lanka
0.1.0 - STU1 International flag

HL7 FHIR Implementation Guide: Sri Lanka, published by Jembi Health Systems. This is not an authorized publication; it is the continuous build for version 0.1.0. This version is based on the current content of https://github.com/jembi/Sri-Lanka and changes regularly. See the Directory of published versions

StructureMap:

Official URL: http://openhie.org/fhir/sri-lanka/StructureMap/HIMSPatientQRToLM Version: 0.1.0
Draft as of 2023-11-10 Computable Name: HIMSPatientQRToLM

Maps the Patient Registration Questionnaire Response to the HIMS Logical Model data elements

map "http://openhie.org/fhir/sri-lanka/StructureMap/HIMSPatientQRToLM" = "HIMSPatientQRToLM"

// Maps the Patient Registration Questionnaire Response to the HIMS Logical Model data elements

uses "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse" alias QResp as source
uses "http://openhie.org/fhir/sri-lanka/StructureDefinition/HIMSPatientRegistrationDataDictionary" alias IMMZC as target

group QRespToIMMZC(source qr : QResp, target immzc : IMMZC) {
  qr.item as item then {
    item.answer first as answer where item.linkId = 'personalHealthNumber' then {
      answer.value as content -> immzc.personalHealthNumber = content "SetPersonalHealthNumber";
    } "FirstAnswerForPHN";
    item.answer first as answer where item.linkId = 'nationalIdentityCard' then {
      answer.value as content -> immzc.nationalIdentityCard = content "SetNationalIdentityCardNumber";
    } "FirstAnswerForNIC";
    item.answer first as answer where item.linkId = 'passport' then {
      answer.value as content -> immzc.passport = content "SetPassportNumber";
    } "FirstAnswerForPassport";
    item.answer first as answer where item.linkId = 'drivingLicense' then {
      answer.value as content -> immzc.drivingLicense = content "SetDrivingLicenseNumber";
    } "FirstAnswerForDL";
    item.answer first as answer where item.linkId = 'seniorCitizenNumber' then {
      answer.value as content -> immzc.seniorCitizenNumber = content "SetSeniorCitizenNumber";
    } "FirstAnswerForSCN";
    item.answer as patientName where item.linkId = 'patientName' -> immzc.patientName as pat then FullNameToIMMZC(patientName, pat) "SetPatientNames";
    item.answer first as answer where item.linkId = 'sex' then {
      answer.value as coding then {
        coding.code as content -> immzc.sex = content "SetSex";
      } "ProcessCoding";
    } "FirstAnswerForSex";
    item.answer as address where item.linkId = 'address' -> immzc.address as addy then AddressToIMMZC(address, addy) "SetAddresses";
    item.answer first as answer where item.linkId = 'birthDate' then {
      answer.value as content -> immzc.birthDate = content "SetBirthDate";
    } "FirstAnswerForBirthDate";
    item.answer as contactDetails where item.linkId = 'contactDetails' -> immzc.contactDetails as contact then ContactDetailsIMMZC(contactDetails, contact) "SetContactDetails";
  } "processItems";
}

group FullNameToIMMZC(source name, target immzc) {
  name.item as item then {
    item.answer first as answer where item.linkId = 'firstName' then {
      answer.value as content -> immzc.firstName = content "SetFirstName";
    } "FirstAnswerForFirstName";
    item.answer first as answer where item.linkId = 'surname' then {
      answer.value as content -> immzc.surname = content "SetSurname";
    } "FirstAnswerForSurname";
    item.answer first as answer where item.linkId = 'firstName' then {
      answer.value as firstName -> firstName then {
        item.answer first as answer2 where item.linkId = 'surname' then {
          answer2.value as surname -> immzc.fullName = append(firstName, ' ', surname) "SetName";
        } "set";
      } "set";
    } "FirstAnswerForFullName";
  } "processNameItems";
}

group AddressToIMMZC(source name, target immzc) {
  name.item as item then {
    item.answer first as answer where item.linkId = 'streetNameAndNr' then {
      answer.value as content -> immzc.streetNameAndNr = content "SetStreetNameAndNr";
    } "FirstAnswerForStreetNameAndNr";
    item.answer first as answer where item.linkId = 'city' then {
      answer.value as content -> immzc.city = content "SetCity";
    } "FirstAnswerForCity";
    item.answer first as answer where item.linkId = 'state' then {
      answer.value as content -> immzc.state = content "SetState";
    } "FirstAnswerForState";
    item.answer first as answer where item.linkId = 'country' then {
      answer.value as content -> immzc.country = content "SetCountry";
    } "FirstAnswerForCountry";
    item.answer first as answer where item.linkId = 'postalCode' then {
      answer.value as content -> immzc.postalCode = content "SetPostalCode";
    } "FirstAnswerForPostalCode";
  } "processAddressItems";
}

group ContactDetailsIMMZC(source name, target immzc) {
  name.item as item then {
    item.answer first as answer where item.linkId = 'mobileNumber' then {
      answer.value as content -> immzc.mobileNumber = content "SetMobileNumber";
    } "FirstAnswerForMobileNumber";
    item.answer first as answer where item.linkId = 'landline' then {
      answer.value as content -> immzc.landline = content "SetLandline";
    } "FirstAnswerForLandline";
  } "processContactDetailsItems";
}