Search in sources :

Example 46 with Encounter

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

the class LossOfCareHealthRecordTest method setup.

/**
 * Setup for HealthRecord Tests.
 */
@Before
public void setup() throws Exception {
    // Clear any Payers that may have already been statically loaded.
    Payer.clear();
    TestHelper.loadTestProperties();
    String testState = Config.get("test_state.default", "Massachusetts");
    Config.set("generate.payers.insurance_companies.default_file", "generic/payers/test_payers.csv");
    Config.set("generate.payers.loss_of_care", "true");
    Config.set("lifecycle.death_by_loss_of_care", "true");
    // Load in the .csv list of Payers for MA.
    Payer.loadPayers(new Location(testState, null));
    // Load test payers.
    testPrivatePayer = Payer.getPrivatePayers().get(0);
    // Parse out testPrivatePayer's Copay.
    Person person = new Person(0L);
    person.setProvider(EncounterType.WELLNESS, new Provider());
    person.attributes.put(Person.INCOME, 1);
    Encounter encounter = person.encounterStart(time, EncounterType.WELLNESS);
    testPrivatePayerCopay = testPrivatePayer.determineCopay(encounter);
    // Utilities.convertCalendarYearsToTime(1900);
    time = 0L;
}
Also used : Encounter(org.mitre.synthea.world.concepts.HealthRecord.Encounter) Person(org.mitre.synthea.world.agents.Person) Location(org.mitre.synthea.world.geography.Location) Provider(org.mitre.synthea.world.agents.Provider) Before(org.junit.Before)

Example 47 with Encounter

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

the class LossOfCareHealthRecordTest method personRunsOutOfIncomeDueToCopay.

@Test
public void personRunsOutOfIncomeDueToCopay() {
    Person person = new Person(0L);
    person.coverage.setPayerAtTime(time, testPrivatePayer);
    person.setProvider(EncounterType.WELLNESS, new Provider());
    Code code = new Code("SNOMED-CT", "705129", "Fake Code");
    // Determine income
    double encCost = Config.getAsDouble("generate.costs.default_encounter_cost");
    BigDecimal coinsurance = BigDecimal.ONE.subtract(testPrivatePayer.getCoinsurance());
    BigDecimal deductible = testPrivatePayer.getDeductible();
    BigDecimal income = deductible.add(BigDecimal.valueOf(2).multiply(BigDecimal.valueOf(encCost).subtract(testPrivatePayerCopay)).multiply(coinsurance)).add(BigDecimal.valueOf(2).multiply(testPrivatePayerCopay)).subtract(BigDecimal.ONE);
    // Set person's income to be $1 lower than the cost of 2 visits.
    person.attributes.put(Person.INCOME, income.intValue());
    // First encounter is covered and copay is affordable.
    Encounter coveredEncounter1 = person.encounterStart(time, EncounterType.WELLNESS);
    coveredEncounter1.codes.add(code);
    coveredEncounter1.provider = new Provider();
    person.record.encounterEnd(time, EncounterType.WELLNESS);
    // Person has enough income for one more copay.
    assertTrue(person.defaultRecord.encounters.contains(coveredEncounter1));
    assertFalse(person.lossOfCareRecord.encounters.contains(coveredEncounter1));
    // Second encounter is covered and copay is affordable.
    Encounter coveredEncounter2 = person.encounterStart(time, EncounterType.WELLNESS);
    coveredEncounter2.codes.add(code);
    coveredEncounter2.provider = new Provider();
    person.record.encounterEnd(time, EncounterType.WELLNESS);
    // Person is in debt $1. They should switch to no insurance not recieve any further care.
    assertTrue(person.defaultRecord.encounters.contains(coveredEncounter2));
    assertFalse(person.lossOfCareRecord.encounters.contains(coveredEncounter2));
    // Third encounter is uncovered and unaffordable.
    Encounter uncoveredEncounter3 = person.encounterStart(time, EncounterType.WELLNESS);
    uncoveredEncounter3.codes.add(code);
    uncoveredEncounter3.provider = new Provider();
    person.record.encounterEnd(time, EncounterType.WELLNESS);
    // Person should have this record in the uncoveredHealthRecord.
    assertFalse(person.defaultRecord.encounters.contains(uncoveredEncounter3));
    assertTrue(person.lossOfCareRecord.encounters.contains(uncoveredEncounter3));
    // Person should now have no insurance.
    assertTrue(person.coverage.getPayerAtTime(time).equals(Payer.noInsurance));
}
Also used : Encounter(org.mitre.synthea.world.concepts.HealthRecord.Encounter) Person(org.mitre.synthea.world.agents.Person) Code(org.mitre.synthea.world.concepts.HealthRecord.Code) BigDecimal(java.math.BigDecimal) Provider(org.mitre.synthea.world.agents.Provider) Test(org.junit.Test)

Example 48 with Encounter

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

the class LossOfCareHealthRecordTest method personRunsOutOfIncomeWithNoInsurance.

@Test
public void personRunsOutOfIncomeWithNoInsurance() {
    Person person = new Person(0L);
    person.coverage.setPayerAtTime(time, Payer.noInsurance);
    person.setProvider(EncounterType.WELLNESS, new Provider());
    Code code = new Code("SNOMED-CT", "705129", "Fake Code");
    // Set person's income to be $1 lower than the cost of encounter
    person.attributes.put(Person.INCOME, (int) defaultEncounterCost - 1);
    // First encounter is uncovered but affordable.
    Encounter coveredEncounter = person.encounterStart(time, EncounterType.WELLNESS);
    coveredEncounter.codes.add(code);
    coveredEncounter.provider = new Provider();
    person.record.encounterEnd(time, EncounterType.WELLNESS);
    // Person is in debt $1. They should not recieve any more care.
    assertTrue(person.defaultRecord.encounters.contains(coveredEncounter));
    assertFalse(person.lossOfCareRecord.encounters.contains(coveredEncounter));
    // Second encounter is uncovered and not affordable.
    Encounter uncoveredEncounter = person.encounterStart(time, EncounterType.WELLNESS);
    uncoveredEncounter.codes.add(code);
    uncoveredEncounter.provider = new Provider();
    person.record.encounterEnd(time, EncounterType.WELLNESS);
    // Person should have this encounter in the uncoveredHealthRecord.
    assertFalse(person.defaultRecord.encounters.contains(uncoveredEncounter));
    assertTrue(person.lossOfCareRecord.encounters.contains(uncoveredEncounter));
}
Also used : Encounter(org.mitre.synthea.world.concepts.HealthRecord.Encounter) Person(org.mitre.synthea.world.agents.Person) Code(org.mitre.synthea.world.concepts.HealthRecord.Code) Provider(org.mitre.synthea.world.agents.Provider) Test(org.junit.Test)

Example 49 with Encounter

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

the class DeathModuleTest method testDeathCertificate.

@Test
public void testDeathCertificate() {
    /*
     * death_certificate: { description: 'U.S. standard certificate of death - 2003 revision', code:
     * '69409-1' }, cause_of_death: { description: 'Cause of Death [US Standard Certificate of
     * Death]', code: '69453-9', value_type: 'condition' },
     *
     * death_certification: {description: 'Death Certification', codes: {'SNOMED-CT' =>
     * ['308646001']}, class: 'ambulatory'}
     */
    Code causeOfDeath = new Code("SNOMED-CT", "12345", "Some disease");
    person.recordDeath(time, causeOfDeath);
    DeathModule.process(person, time);
    Encounter enc = person.record.encounters.get(0);
    assertEquals(EncounterType.WELLNESS.toString(), enc.type);
    assertEquals(time, enc.start);
    Code code = enc.codes.get(0);
    assertEquals("308646001", code.code);
    assertEquals("Death Certification", code.display);
    Report report = enc.reports.get(0);
    assertEquals("69409-1", report.type);
    assertEquals(time, report.start);
    code = report.codes.get(0);
    assertEquals("69409-1", code.code);
    assertEquals("U.S. standard certificate of death - 2003 revision", code.display);
    Observation obs = report.observations.get(0);
    assertEquals("69453-9", obs.type);
    assertEquals(time, obs.start);
    code = (Code) obs.value;
    assertEquals(causeOfDeath.code, code.code);
    assertEquals(causeOfDeath.display, code.display);
    code = obs.codes.get(0);
    assertEquals("69453-9", code.code);
    assertEquals("Cause of Death [US Standard Certificate of Death]", code.display);
}
Also used : Report(org.mitre.synthea.world.concepts.HealthRecord.Report) Observation(org.mitre.synthea.world.concepts.HealthRecord.Observation) Encounter(org.mitre.synthea.world.concepts.HealthRecord.Encounter) Code(org.mitre.synthea.world.concepts.HealthRecord.Code) Test(org.junit.Test)

Example 50 with Encounter

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

the class EncounterModuleTest method testEmergencySymptomEncounterHasClinician.

@Test
public void testEmergencySymptomEncounterHasClinician() {
    person.setSymptom("Test", "Test", "Test", System.currentTimeMillis(), EncounterModule.EMERGENCY_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)

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