Search in sources :

Example 51 with Encounter

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);
}
Also used : Encounter(org.mitre.synthea.world.concepts.HealthRecord.Encounter) Test(org.junit.Test) ProviderTest(org.mitre.synthea.world.agents.ProviderTest)

Example 52 with Encounter

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);
}
Also used : Encounter(org.mitre.synthea.world.concepts.HealthRecord.Encounter) Test(org.junit.Test) ProviderTest(org.mitre.synthea.world.agents.ProviderTest)

Example 53 with Encounter

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());
}
Also used : Encounter(org.mitre.synthea.world.concepts.HealthRecord.Encounter) QualityOfLifeModule(org.mitre.synthea.modules.QualityOfLifeModule) CardiovascularDiseaseModule(org.mitre.synthea.modules.CardiovascularDiseaseModule) EncounterModule(org.mitre.synthea.modules.EncounterModule) WeightLossModule(org.mitre.synthea.modules.WeightLossModule) LifecycleModule(org.mitre.synthea.modules.LifecycleModule) DeathModule(org.mitre.synthea.modules.DeathModule) Code(org.mitre.synthea.world.concepts.HealthRecord.Code) Test(org.junit.Test)

Example 54 with Encounter

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);
}
Also used : Encounter(org.mitre.synthea.world.concepts.HealthRecord.Encounter) HealthRecord(org.mitre.synthea.world.concepts.HealthRecord) QualityOfLifeModule(org.mitre.synthea.modules.QualityOfLifeModule) CardiovascularDiseaseModule(org.mitre.synthea.modules.CardiovascularDiseaseModule) EncounterModule(org.mitre.synthea.modules.EncounterModule) WeightLossModule(org.mitre.synthea.modules.WeightLossModule) LifecycleModule(org.mitre.synthea.modules.LifecycleModule) DeathModule(org.mitre.synthea.modules.DeathModule) Code(org.mitre.synthea.world.concepts.HealthRecord.Code) Test(org.junit.Test)

Example 55 with Encounter

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);
    }
}
Also used : HealthRecord(org.mitre.synthea.world.concepts.HealthRecord) Encounter(org.mitre.synthea.world.concepts.HealthRecord.Encounter) QualityOfLifeModule(org.mitre.synthea.modules.QualityOfLifeModule) CardiovascularDiseaseModule(org.mitre.synthea.modules.CardiovascularDiseaseModule) EncounterModule(org.mitre.synthea.modules.EncounterModule) WeightLossModule(org.mitre.synthea.modules.WeightLossModule) LifecycleModule(org.mitre.synthea.modules.LifecycleModule) DeathModule(org.mitre.synthea.modules.DeathModule) Test(org.junit.Test)

Aggregations

Encounter (org.mitre.synthea.world.concepts.HealthRecord.Encounter)99 Test (org.junit.Test)54 Code (org.mitre.synthea.world.concepts.HealthRecord.Code)51 HealthRecord (org.mitre.synthea.world.concepts.HealthRecord)29 Person (org.mitre.synthea.world.agents.Person)28 ProviderTest (org.mitre.synthea.world.agents.ProviderTest)22 DeathModule (org.mitre.synthea.modules.DeathModule)17 QualityOfLifeModule (org.mitre.synthea.modules.QualityOfLifeModule)17 ArrayList (java.util.ArrayList)16 CardiovascularDiseaseModule (org.mitre.synthea.modules.CardiovascularDiseaseModule)16 EncounterModule (org.mitre.synthea.modules.EncounterModule)16 LifecycleModule (org.mitre.synthea.modules.LifecycleModule)16 WeightLossModule (org.mitre.synthea.modules.WeightLossModule)16 Provider (org.mitre.synthea.world.agents.Provider)16 Medication (org.mitre.synthea.world.concepts.HealthRecord.Medication)16 Observation (org.mitre.synthea.world.concepts.HealthRecord.Observation)16 Procedure (org.mitre.synthea.world.concepts.HealthRecord.Procedure)16 Report (org.mitre.synthea.world.concepts.HealthRecord.Report)14 Date (java.util.Date)13 Claim (org.mitre.synthea.world.concepts.Claim)12