Skip to content

Commit

Permalink
Update HIVObservation-HIVCondition.map
Browse files Browse the repository at this point in the history
expanded example map.  needs to be validated, some pseudocode.  needs correct system urls.
  • Loading branch information
lukeaduncan authored May 3, 2024
1 parent 188bb80 commit 92d0ed6
Showing 1 changed file with 36 additions and 6 deletions.
42 changes: 36 additions & 6 deletions input/maps/HIVObservation-HIVCondition.map
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
map "https://path-global-health.github.io/MERindicators/StructureMap/HIVObservation-HIVCondition" = "HIVObservation-HIVCondition"
map "https://path-global-health.github.io/MERindicators/StructureMap/HIVObservationHIVCondition" = "HIVObservationHIVCondition"

uses "http://hl7.org/fhir/R4/StructureDefinition/Observation" alias Observation as source
uses "http://hl7.org/fhir/R4/StructureDefinition/Condition" alias Condition as target
uses "http://hl7.org/fhir/R4/StructureDefinition/Provenance" alias Provenance as target
uses "http://hl7.org/fhir/R4/StructureDefinition/Bundle" alias bund as source
uses "http://hl7.org/fhir/R4/StructureDefinition/Bundle" alias output as target
uses "http://hl7.org/fhir/R4/StructureDefinition/Condition" alias cond as produced
uses "http://hl7.org/fhir/R4/StructureDefinition/Provenance" alias prov as produced


// code "Method of enrollment": '160540' from "CIEL" display 'Method of enrollment'
Expand All @@ -11,10 +12,38 @@ uses "http://hl7.org/fhir/R4/StructureDefinition/Provenance" alias Provenance as
// code "CURRENT DRUGS USED": '1193' from "CIEL" display 'CURRENT DRUGS USED'
// code "RETURN VISIT DATE": '5096' from "CIEL" display 'RETURN VISIT DATE'

group HIVObservationHIVCondition(
source src: bund,
target tgt: output
) {

src -> tgt.type = 'collection' "setBundleType";

src.entry as entry, entry.resource : Patient as patient -> tgt.entry as tentry, tentry.resource = patient then {
// patient, src.entry : Observation as obs where obs.code = cc("CIEL", "160540") and obs.subject = append("Patient/", patient.id) -> tgt.entry as newentry, uuid() as cid, create("Condition") as cond
patient, src.entry as obsentry, obsentry.resource : Observation as obs, obs.code as code, code.coding as coding where obs.subject = append("Patient/", patient.id) and coding.code = '160540' and coding.system = 'CIEL'
-> tgt.entry as newentry, uuid() as cid, create("Condition") as cond, create("Provenance") as prov
then {
obs -> newentry.resource = cond "setResource";
obs -> cond.id = cid "setConditionId";
obs -> cond.code = cc( "SNODMED", "10232345" ) "setCode";
// patient -> cond.subject = apppend("Patient/", patient.id) "setSubject";
patient -> cond.subject = reference(patient) "setSubject";
obs -> tgt.entry as proventry, proventry.resource = prov then {
obs -> prov.target = append("Condition/", cid ) "setTarget";
obs -> prov.entity as entity then {
obs -> entity.role = "source" "setRole";
obs -> entity.what = append("Observation/", obs.id ) "setWhat";
} "setEntity";
} "setProvenance";
} "setCondition";
} "copyPatient";
}

// createConditionResource(date,pid, type, eid, encounter)
// rash -> rash then createObservationResource(rash, coding, observation, pid) "set obs";

/*
// Map of HIV program enrollment in an Observation resource to HIV+ Condition resource
group Condition(source src : Observation, target tgt : Condition) extends DomainResource <<type+>> {

Expand All @@ -23,10 +52,10 @@ group Condition(source src : Observation, target tgt : Condition) extends Domain
src.subject -> tgt.subject;
src.encounter -> tgt.encounter;
}

*/

// createProvenanceResource

/*
// Create a Provenance resource so we know the origin of the Condition resource
group Provenance(source src : Observation, target tgt : Provenance) extends DomainResource <<type+>> {

Expand All @@ -40,3 +69,4 @@ group Provenance(source src : Observation, target tgt : Provenance) extends Doma
// entity: where it came from, if fhir resource
}

*/

0 comments on commit 92d0ed6

Please sign in to comment.