Skip to content

Commit

Permalink
Merge pull request #1001 from synthetichealth/cvd-codes-fix
Browse files Browse the repository at this point in the history
Stop CardiovascularDiseaseModule from adding multiple codes to the same Entry
  • Loading branch information
jawalonoski authored Feb 15, 2022
2 parents 3a165b8 + 43badec commit f1b56e2
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.mitre.synthea.helpers.Utilities;
import org.mitre.synthea.world.agents.Person;
import org.mitre.synthea.world.concepts.ClinicianSpecialty;
import org.mitre.synthea.world.concepts.HealthRecord;
import org.mitre.synthea.world.concepts.HealthRecord.Code;
import org.mitre.synthea.world.concepts.HealthRecord.Encounter;
import org.mitre.synthea.world.concepts.HealthRecord.EncounterType;
Expand Down Expand Up @@ -757,7 +758,11 @@ private static void atrialFibrillationTreatment(Person person, long time) {

private static void prescribeMedication(String med, Person person, long time, boolean chronic) {
Medication entry = person.record.medicationStart(time, med, chronic);
entry.codes.add(LOOKUP.get(med));
HealthRecord.Code medicationCode = LOOKUP.get(med);
if (! entry.containsCode(medicationCode.code, medicationCode.system)) {
entry.codes.add(medicationCode);
}

// increment number of prescriptions prescribed
Encounter encounter = (Encounter) person.attributes.get(CVD_ENCOUNTER);
if (encounter != null) {
Expand All @@ -780,7 +785,9 @@ public static void performEncounter(Person person, long time, Encounter encounte
&& !person.record.present.containsKey(diagnosis)) {
Code code = LOOKUP.get(diagnosis);
Entry conditionEntry = person.record.conditionStart(time, code.display);
conditionEntry.codes.add(code);
if (! conditionEntry.containsCode(code.code, code.system)) {
conditionEntry.codes.add(code);
}
}
}

Expand Down Expand Up @@ -908,4 +915,4 @@ public static void inventoryAttributes(Map<String,Inventory> attributes) {
Attributes.inventory(attributes, m, "stroke_points", false, true, "Numeric");
Attributes.inventory(attributes, m, "stroke_history", false, true, "true");
}
}
}

0 comments on commit f1b56e2

Please sign in to comment.