Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
ritikarawlani committed Sep 13, 2024
1 parent e0a5052 commit 15f67ef
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 27 deletions.
2 changes: 1 addition & 1 deletion input/maps/DVCClaimtoDVCLM.map
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
map "http://smart.who.int/icvp/StructureMap/DVCClaimtoDVCLM" = "DVCClaimtoDVCLM"
uses "http://smart.who.int/icvp/StructureDefinition/DVC" alias DVCPayload as source
uses "http://smart.who.int/icvp/StructureDefinition/DVCPayload" alias DVCPayload as source
uses "http://smart.who.int/icvp/StructureDefinition/ModelDVC" alias DVCModel as target
uses "http://smart.who.int/icvp/StructureDefinition/ModelVaccineDetails" alias ModelVaccineDetails as target

Expand Down
14 changes: 14 additions & 0 deletions input/maps/DVCClaimtoIPS.map
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
map "http://smart.who.int/icvp/StructureMap/DVCClaimtoIPS" = "DVCClaimtoIPS"
uses "http://smart.who.int/icvp/StructureDefinition/DVCPayload" alias DVCPayload as source
uses "http://hl7.org/fhir/StructureDefinition/Bundle" alias IPS as target
uses "http://smart.who.int/icvp/StructureDefinition/ModelDVC" alias DVCModel as target
uses "http://smart.who.int/icvp/StructureDefinition/ModelVaccineDetails" alias ModelVaccineDetails as target
imports "http://smart.who.int/icvp/StructureMap/DVCLMToIPS"
imports "http://smart.who.int/icvp/StructureMap/DVCClaimtoDVCLM"

group DVCClaimtoIPS (source DVCClaim : DVCPayload, target IPS : Bundle) {
DVCClaim -> create ("http://smart.who.int/icvp/StructureDefinition/ModelDVC") as model then {
DVCClaim -> model then DVCClaimtoDVCLM(DVCClaim,model) "rule1";
DVCClaim -> IPS then DVCLMToIPS (model, IPS) "rule2";
} "rule3";
}
61 changes: 35 additions & 26 deletions input/maps/IcvpLMToIPS.map
Original file line number Diff line number Diff line change
@@ -1,50 +1,53 @@
map "http://smart.who.int/icvp/StructureMap/IcvpLMToIPS" = "IcvpLMToIPS"
uses "http://worldhealthorganization.github.io/smart/StructureDefinition/ModelICVP" alias ICVPLogicalModel as source
map "http://smart.who.int/icvp/StructureMap/DVCLMLMToIPS" = "DVCLMToIPS"
uses "http://smart.who.int/icvp/StructureDefinition/ModelDVC" alias DVCLogicalModel as source
uses "http://hl7.org/fhir/StructureDefinition/Bundle" alias IPS as target


// create Bundle
group IcvpLMToIPS(source lm : ICVPLogicalModel, target ips : IPS) {
group DVCLMToIPS(source lm : DVCLogicalModel, target ips : IPS) {
lm -> ips.type = 'document' "setIPSType";
lm -> uuid() as bid, ips.id = bid "setId";
lm -> (now()) as timestamp,uuid() as cid, uuid() as pid, uuid() as prid, uuid() as oid, uuid() as mid, uuid() as aid, uuid() as proid, uuid() as immid then {
lm -> uuid() as bid, ips.identifier as id, id.value = bid, id.system = "urn:oid:2.16.724.4.8.10.200.10" "setId";
lm -> (now()) as timestamp,uuid() as cid, uuid() as pid, uuid() as mid, uuid() as aid, uuid() as proid, uuid() as immid then {
lm -> ips.timestamp = timestamp "setBundleTimestamp";
lm -> ips.entry as entry, entry.resource = create('Composition') as composition, entry.fullUrl = append('urn:uuid:', cid) then {
lm -> lm then LmToComposition(lm, ips, composition, timestamp,cid, pid, prid, oid, mid, aid, proid, immid ) "set";
lm -> lm then LmToComposition(lm, ips, composition, timestamp,cid, pid, mid, aid, proid, immid ) "set";
lm -> ips.entry as entry, entry.fullUrl = append('urn:uuid:', pid), create('Patient') as patient then {
lm -> lm then DemographicsToPatient(lm, patient, pid) "createPatient";
lm -> entry.resource = patient "setPatientEntry";
} "mapPatientResource";
/* lm -> ips.entry as entry, entry.fullUrl = append('urn:uuid:', prid), create('Practitioner') as practitioner then {
lm.ReportingSource as reportingSource -> reportingSource then ReportingSourceToPractitioner(reportingSource, practitioner, prid) "createPractitioner";
lm -> entry.resource = practitioner "setPractitionerEntry";
} "mapPractitionerResource" ;
lm -> ips.entry as entry, entry.fullUrl = append('urn:uuid:', oid), create('Organization') as organization then {
lm.ReportingSource as reportingSource -> reportingSource then ReportingSourceToOrganization(reportingSource, organization, oid) "createOrganization";
lm.issuer as issuer then {
issuer.reference as id -> ips.entry as entry, entry.fullUrl = append('urn:uuid:', id), create('Organization') as organization then {
lm -> organization then createAuthor(issuer, organization) "createOrganization";
lm -> entry.resource = organization "setOrganizationEntry";
} "map organization resource"; */
} "mapOrganizationResource";
} "ss";
} "mapCompositionResource";
} "setEntries" ;
}

// create Composition
group LmToComposition(source lm : ICVPLogicalModel, target ips : Bundle, target composition : Composition,source timestamp, source cid, source pid, source prid, source oid, source mid, source aid, source proid, source immid) {
group LmToComposition(source lm : DVCLogicalModel, target ips : Bundle, target composition : Composition,source timestamp, source cid, source pid, source mid, source aid, source proid, source immid) {
cid -> composition.id = cid "setCid";
lm -> composition.status = "final" "setStatus";
timestamp -> composition.date = timestamp "setCompositionDate";
lm -> composition.title = "International Patient Summary" "setTitle";
lm -> create('Coding') as coding, coding.code = "60591-5", coding.system = "http://loinc.org", create('CodeableConcept') as code, code.coding = coding, composition.type = code "setType";
lm -> composition.subject as subject then {
lm -> subject.reference= append('Patient/',pid) "setSubject";
lm -> subject.reference= append('urn:uuid:',pid) "setSubject";
} "setSubject";
lm.issuer as issuer then {
issuer.reference as id -> composition.author as author then {
id -> author.reference = append('urn:uuid:', id) "setAuthor";
} "setauthr";
} "setid";
lm -> composition.section as medication then createSectionMedications(lm, medication, mid) "createMedication";
lm -> composition.section as allergies then createSectionAllergies(lm, allergies, aid) "createAllergies";
lm -> composition.section as problems then createSectionProblems(lm, problems, proid) "createProblems";
lm then createSectionImmunizations(lm, ips, composition, immid, pid) "createImmunizations";
}

// create Patient
group DemographicsToPatient(source lm:ICVPLogicalModel , target patient: Patient, source pid) {
group DemographicsToPatient(source lm:DVCLogicalModel , target patient: Patient, source pid) {
pid -> patient.id = pid "setPatientId";
lm.name as sourceName -> patient.name as targetName then {
sourceName -> sourceName then humanNameToHumanName(sourceName, targetName) "CopyName";
Expand All @@ -58,62 +61,68 @@ group DemographicsToPatient(source lm:ICVPLogicalModel , target patient: Patient
}

// create author

group createAuthor(source issuer, target org: Organization) {
issuer.reference as id -> org.id = id "setID";
}

// create sectionMedications
group createSectionMedications(source lm:ICVPLogicalModel, target med : BackboneElement, source mid ) {
group createSectionMedications(source lm:DVCLogicalModel, target med : BackboneElement, source mid ) {
mid -> med.id = mid "setmedicationid";
lm -> med.title = "Medication Summary Section" "setMedicationTitle";
lm -> med.text as text then generateNarrativeText(med,text) "setText";
lm -> create('Coding') as coding, coding.code = "10160-0", coding.system = "http://loinc.org", create('CodeableConcept') as code, code.coding = coding, med.code = code "setCode";
lm -> create('Coding') as coding, coding.code = "unavailable", coding.system = "http://hl7.org/fhir/ValueSet/list-empty-reason", create('CodeableConcept') as code, code.coding = coding, med.emptyReason = code "setCode";
}

// create sectionAllergies
group createSectionAllergies(source lm:ICVPLogicalModel, target all : BackboneElement, source aid ) {
group createSectionAllergies(source lm:DVCLogicalModel, target all : BackboneElement, source aid ) {
aid -> all.id = aid "setAllergyId";
lm -> all.title = "Allergies Section" "setAllergyTitle";
lm -> all.text as text then generateNarrativeText(all,text) "setText";
lm -> create('Coding') as coding, coding.code = "48765-2", coding.system = "http://loinc.org", create('CodeableConcept') as code, code.coding = coding, all.code = code "setCode";
lm -> create('Coding') as coding, coding.code = "unavailable", coding.system = "http://hl7.org/fhir/ValueSet/list-empty-reason", create('CodeableConcept') as code, code.coding = coding, all.emptyReason = code "setCode";
}

// create sectionProblems
group createSectionProblems(source lm:ICVPLogicalModel, target prb : BackboneElement, source proid ) {
group createSectionProblems(source lm:DVCLogicalModel, target prb : BackboneElement, source proid ) {
proid -> prb.id = proid "setProblemsId";
lm -> prb.title = "Problems Section" "setProblemTitle";
lm -> prb.text as text then generateNarrativeText(prb,text) "setText";
lm -> create('Coding') as coding, coding.code = "11450-4", coding.system = "http://loinc.org", create('CodeableConcept') as code, code.coding = coding, prb.code = code "setCode";
lm -> create('Coding') as coding, coding.code = "unavailable", coding.system = "http://hl7.org/fhir/ValueSet/list-empty-reason", create('CodeableConcept') as code, code.coding = coding, prb.emptyReason = code "setCode";
}

// create sectionImmunizations
group createSectionImmunizations(source lm:ICVPLogicalModel, target bundle: Bundle, target composition: Composition, source immid, source pid ) {
group createSectionImmunizations(source lm:DVCLogicalModel, target bundle: Bundle, target composition: Composition, source immid, source pid ) {
lm -> composition.section as imm then {
immid -> imm.id = immid "setImmunizationsId";
lm -> imm.title = "Immunizations Section" "setImmunizationTitle";
lm -> imm.text as text then generateNarrativeText(imm,text) "setText";
lm -> create('Coding') as coding, coding.code = "11369-6", coding.system = "http://loinc.org", create('CodeableConcept') as code, code.coding = coding, imm.code = code "setCode";
lm.vaccineDetails as vax -> uuid() as id, bundle.entry as entry, entry.fullUrl = append('urn:uuid:', id), imm.entry as sectionEntry, sectionEntry.reference = append('Immunization/', id), entry.resource = create('Immunization') as immunization , immunization.id = id then createImmunizationResource(vax, immunization, pid ) "setImmz";
lm.vaccineDetails as vax -> uuid() as id, bundle.entry as entry, entry.fullUrl = append('urn:uuid:', id), imm.entry as sectionEntry, sectionEntry.reference = append('urn:uuid:', id), entry.resource = create('Immunization') as immunization , immunization.id = id then createImmunizationResource(vax, immunization, pid ) "setImmz";
} "set";

}

group createImmunizationResource (source vax : vaccineDetails, target immunization : Immunization, source pid) {
vax -> immunization.status = "completed" "setStatus";
vax.vaccineClassification as vaccine -> immunization.vaccineCode = vaccine "setvaccinecode";
//vax.date as date -> immunization.occurrenceDateTime = date "setDate";
vax.date as date -> immunization.occurrence = append(date , 'T00:00:00.000Z') "setDate";
vax.batchNo as batchNo -> immunization.lotNumber = batchNo "setBatchNo";
vax -> immunization.protocolApplied as protocol then {
vax.doseNumber as doseNo then {
doseNo.text as text -> protocol.doseNumberString = text "setDoseNo";
doseNo.text as text -> protocol.doseNumber = text "setDoseNo";
} "setDoseNo";
/* vax.disease as disease -> create('Coding') as coding, coding = disease, create('CodeableConcept') as code, code.coding = coding, protocol.targetDisease = code "setTargetDisease"; */
} "setProtocolApplied";
vax -> immunization.patient as subject, subject.reference = append('Patient/',pid) "setSubject";
vax -> immunization.patient as subject, subject.reference = append('urn:uuid:',pid) "setSubject";

}

//helper function
group generateNarrativeText(source src: Section, target text: string) {
src -> text.status = "empty" "setstatus";
src -> text.div = "narrative not available" "setdiv";
src -> text.div = "<div>narrative not available</div>" "setdiv";

}
group humanNameToHumanName (source sourceName, target targetName: HumanName) {
Expand Down

0 comments on commit 15f67ef

Please sign in to comment.