use of org.mitre.synthea.world.concepts.HealthRecord.Encounter in project synthea by synthetichealth.
the class EncounterModuleTest method testUrgentcareSymptomEncounterHasClinician.
@Test
public void testUrgentcareSymptomEncounterHasClinician() {
person.setSymptom("Test", "Test", "Test", System.currentTimeMillis(), EncounterModule.URGENT_CARE_SYMPTOM_THRESHOLD + 1, false);
module.process(person, System.currentTimeMillis());
assertNotNull(person.record);
assertFalse(person.record.encounters.isEmpty());
int last = person.record.encounters.size() - 1;
Encounter encounter = person.record.encounters.get(last);
assertNotNull("Encounter must have clinician", encounter.clinician);
assertNotNull("Encounter must have provider organization", encounter.provider);
}
use of org.mitre.synthea.world.concepts.HealthRecord.Encounter in project synthea by synthetichealth.
the class EncounterModuleTest method testPrimarySymptomEncounterHasClinician.
@Test
public void testPrimarySymptomEncounterHasClinician() {
person.setSymptom("Test", "Test", "Test", System.currentTimeMillis(), EncounterModule.PCP_SYMPTOM_THRESHOLD + 1, false);
module.process(person, System.currentTimeMillis());
assertNotNull(person.record);
assertFalse(person.record.encounters.isEmpty());
int last = person.record.encounters.size() - 1;
Encounter encounter = person.record.encounters.get(last);
assertNotNull("Encounter must have clinician", encounter.clinician);
assertNotNull("Encounter must have provider organization", encounter.provider);
}
use of org.mitre.synthea.world.concepts.HealthRecord.Encounter in project synthea by synthetichealth.
the class StateTest method condition_onset_during_encounter_prevent_multiple_coding.
/**
* Previously, if there were multiple calls to ConditionOnset, the condition Entry would contain
* multiple Codes, one for each time the ConditionOnset was invoked. This test checks to make
* sure that the same code is only added once.
* @throws Exception when bad things happen
*/
@Test
public void condition_onset_during_encounter_prevent_multiple_coding() throws Exception {
Module module = TestHelper.getFixture("condition_onset.json");
// The encounter comes first (and add it to history);
State encounter = module.getState("ED_Visit");
assertTrue(encounter.process(person, time));
person.history.add(0, encounter);
// Then appendicitis is diagnosed
State appendicitis = module.getState("Appendicitis");
assertTrue(appendicitis.process(person, time));
// Call the same ConditionOnset
assertTrue(appendicitis.process(person, time));
Encounter enc = person.record.encounters.get(0);
assertEquals(1, enc.conditions.get(0).codes.size());
Code code = enc.conditions.get(0).codes.get(0);
assertEquals("47693006", code.code);
assertEquals("Rupture of appendix", code.display);
Long onsetTime = person.getOnsetConditionRecord().getConditionLastOnsetTimeFromModule(module.name, code.display);
assertTrue(onsetTime != null);
assertEquals(time, onsetTime.longValue());
}
use of org.mitre.synthea.world.concepts.HealthRecord.Encounter in project synthea by synthetichealth.
the class StateTest method encounter_with_attribute_reason.
@Test
public void encounter_with_attribute_reason() throws Exception {
Module module = TestHelper.getFixture("encounter.json");
// First, onset the Diabetes!
State diabetes = module.getState("Diabetes");
assertTrue(diabetes.process(person, time));
person.history.add(diabetes);
// Non-wellness encounters happen immediately
State encounter = module.getState("ED_Visit_AttributeReason");
assertTrue(encounter.process(person, time));
// Verify that the Encounter was added to the record
HealthRecord.Encounter enc = person.record.encounters.get(0);
assertEquals(time, enc.start);
assertEquals(time + TimeUnit.MINUTES.toMillis(60), enc.stop);
assertEquals("73211009", enc.reason.code);
assertEquals("Diabetes Mellitus", enc.reason.display);
Code code = enc.codes.get(0);
assertEquals("50849002", code.code);
assertEquals("Emergency Room Admission", code.display);
}
use of org.mitre.synthea.world.concepts.HealthRecord.Encounter in project synthea by synthetichealth.
the class StateTest method testDiagnosticReport.
@Test
public void testDiagnosticReport() throws Exception {
// Birth makes the vital signs come alive :-)
LifecycleModule.birth(person, (long) person.attributes.get(Person.BIRTHDATE));
Module module = TestHelper.getFixture("observation_groups.json");
State condition = module.getState("Record_MetabolicPanel");
assertTrue(condition.process(person, time));
// for a DiagnosticReport, we expect the report as well as the individual observations
// to be added to the record
Encounter e = person.record.encounters.get(0);
assertEquals(1, e.reports.size());
HealthRecord.Report report = e.reports.get(0);
assertEquals(8, report.observations.size());
assertEquals(8, e.observations.size());
String[] codes = { "2339-0", "6299-2", "38483-4", "49765-1", "2947-0", "6298-4", "2069-3", "20565-8" };
for (int i = 0; i < 8; i++) {
HealthRecord.Observation o = e.observations.get(i);
assertEquals(codes[i], o.codes.get(0).code);
assertEquals(report, o.report);
}
}
Aggregations