Search in sources :

Example 26 with Encounter

use of org.mitre.synthea.world.concepts.HealthRecord.Encounter in project synthea by synthetichealth.

the class StateTest method testDevice.

@Test
public void testDevice() throws Exception {
    Module module = TestHelper.getFixture("artificial_heart_device.json");
    State encounterState = module.getState("Encounter");
    assertTrue(encounterState.process(person, time));
    State deviceState = module.getState("Artificial_Heart");
    assertTrue(deviceState.process(person, time));
    Encounter encounter = person.getCurrentEncounter(module);
    List<HealthRecord.Device> devices = encounter.devices;
    assertNotNull(devices);
    assertEquals(1, devices.size());
    HealthRecord.Device device = devices.get(0);
    assertEquals("13459008", device.type);
    assertEquals("SynCardia", device.manufacturer);
    assertEquals("Total Artificial Heart", device.model);
    assertEquals(0L, device.stop);
    HealthRecord.Device attribute = (HealthRecord.Device) person.attributes.get("artificial_heart");
    assertNotNull(attribute);
    // we want reference equality, it should be the same object
    assertTrue(attribute == device);
}
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)

Example 27 with Encounter

use of org.mitre.synthea.world.concepts.HealthRecord.Encounter in project synthea by synthetichealth.

the class StateTest method condition_onset_diagnosed_by_target_encounter.

@Test
public void condition_onset_diagnosed_by_target_encounter() throws Exception {
    Module module = TestHelper.getFixture("condition_onset.json");
    State condition = module.getState("Diabetes");
    // Should pass through this state immediately without calling the record
    person.history.add(0, condition);
    assertTrue(condition.process(person, time));
    // The encounter comes next (and add it to history);
    State encounter = module.getState("ED_Visit");
    // states are added to history before being processed
    person.history.add(0, encounter);
    assertTrue(encounter.process(person, time));
    assertEquals(1, person.record.encounters.size());
    Encounter enc = person.record.encounters.get(0);
    Code code = enc.codes.get(0);
    assertEquals("50849002", code.code);
    assertEquals("Emergency Room Admission", code.display);
    assertEquals(1, enc.conditions.size());
    code = enc.conditions.get(0).codes.get(0);
    assertEquals("73211009", code.code);
    assertEquals("Diabetes mellitus", 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 28 with Encounter

use of org.mitre.synthea.world.concepts.HealthRecord.Encounter in project synthea by synthetichealth.

the class StateTest method condition_onset_during_encounter.

@Test
public void condition_onset_during_encounter() 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));
    assertEquals(1, person.record.encounters.size());
    Encounter enc = person.record.encounters.get(0);
    Code code = enc.codes.get(0);
    assertEquals("50849002", code.code);
    assertEquals("Emergency Room Admission", code.display);
    assertEquals(1, enc.conditions.size());
    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);
    assertNotNull(person.attributes.get("Most Recent ED Visit"));
    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 29 with Encounter

use of org.mitre.synthea.world.concepts.HealthRecord.Encounter in project synthea by synthetichealth.

the class StateTest method testDeviceEndByState.

@Test
public void testDeviceEndByState() throws Exception {
    Module module = TestHelper.getFixture("artificial_heart_device.json");
    State encounterState = module.getState("Encounter");
    assertTrue(encounterState.process(person, time));
    State deviceState = module.getState("Artificial_Heart");
    assertTrue(deviceState.process(person, time));
    State deviceEndState = module.getState("Remove_Device_By_State");
    assertTrue(deviceEndState.process(person, time));
    Encounter encounter = person.getCurrentEncounter(module);
    List<HealthRecord.Device> devices = encounter.devices;
    HealthRecord.Device device = devices.get(0);
    assertEquals(time, device.stop);
}
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)

Example 30 with Encounter

use of org.mitre.synthea.world.concepts.HealthRecord.Encounter in project synthea by synthetichealth.

the class StateTest method testSupplyList.

@Test
public void testSupplyList() throws Exception {
    Module module = TestHelper.getFixture("artificial_heart_device.json");
    State encounterState = module.getState("Encounter");
    assertTrue(encounterState.process(person, time));
    State supplyListState = module.getState("Necessary_Supplies");
    assertTrue(supplyListState.process(person, time));
    Encounter encounter = person.getCurrentEncounter(module);
    List<HealthRecord.Supply> supplies = encounter.supplies;
    assertNotNull(supplies);
    assertEquals(4, supplies.size());
    String[] expectedCodes = { "52291003", "468159004", "39802000", "788177008" };
    String[] expectedDisplays = { "Glove, device (physical object)", "Cotton ball (physical object)", "Tongue blade, device (physical object)", "Examination gown, single-use (physical object)" };
    int[] expectedQuantities = { 10_000, 3_000, 98765, 1 };
    for (int i = 0; i < 4; i++) {
        HealthRecord.Supply supply = supplies.get(i);
        Code code = supply.codes.get(0);
        assertEquals(expectedCodes[i], code.code);
        assertEquals(expectedDisplays[i], code.display);
        assertEquals(expectedQuantities[i], supply.quantity);
    }
}
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) Code(org.mitre.synthea.world.concepts.HealthRecord.Code) 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