Search in sources :

Example 16 with Provider

use of org.mitre.synthea.world.agents.Provider in project synthea by synthetichealth.

the class ProviderFinderTest method testNonEligibleIHSNearest.

@Test
public void testNonEligibleIHSNearest() {
    ProviderFinderNearest finder = new ProviderFinderNearest();
    // Making the first facility an IHS facility
    providers.get(0).type = ProviderType.IHS;
    // Setting the race to white for a test person so that they will not go to an IHS facility in a
    // non-emergency situation
    person.attributes.put(Person.RACE, "white");
    Provider provider = finder.find(providers, person, EncounterType.WELLNESS, 0L);
    Assert.assertNotNull(provider);
    Assert.assertEquals("2", provider.id);
}
Also used : Provider(org.mitre.synthea.world.agents.Provider) Test(org.junit.Test)

Example 17 with Provider

use of org.mitre.synthea.world.agents.Provider in project synthea by synthetichealth.

the class ProviderFinderTest method testQuality.

@Test
public void testQuality() {
    ProviderFinderQuality finder = new ProviderFinderQuality();
    Provider provider = finder.find(providers, person, EncounterType.WELLNESS, 0L);
    Assert.assertNotNull(provider);
    Assert.assertEquals("3", provider.id);
}
Also used : Provider(org.mitre.synthea.world.agents.Provider) Test(org.junit.Test)

Example 18 with Provider

use of org.mitre.synthea.world.agents.Provider in project synthea by synthetichealth.

the class LossOfCareHealthRecordTest method personRunsOutOfIncomeDueToMonthlyPremium.

@Test
public void personRunsOutOfIncomeDueToMonthlyPremium() {
    Person person = new Person(0L);
    person.attributes.put(Person.BIRTHDATE, time);
    person.attributes.put(Person.GENDER, "F");
    person.coverage.setPayerAtTime(time, testPrivatePayer);
    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 8 monthly premiums.
    person.attributes.put(Person.INCOME, testPrivatePayer.getMonthlyPremium().multiply(BigDecimal.valueOf(8)).subtract(BigDecimal.ONE).intValue());
    // Pay monthly premium 8 times.
    long oneMonth = Utilities.convertTime("years", 1) / 12;
    long currTime = time;
    HealthInsuranceModule healthInsuranceModule = new HealthInsuranceModule();
    for (int i = 0; i < 8; i++) {
        currTime += oneMonth;
        healthInsuranceModule.process(person, currTime);
    }
    // Person should now have no insurance.
    assertTrue(person.coverage.getPayerAtTime(currTime).equals(Payer.noInsurance));
    // Encounter is uncovered and unaffordable.
    Encounter uncoveredEncounter3 = person.encounterStart(time + oneMonth * 7, EncounterType.WELLNESS);
    uncoveredEncounter3.codes.add(code);
    uncoveredEncounter3.provider = new Provider();
    person.record.encounterEnd(time + oneMonth * 7, EncounterType.WELLNESS);
    // Person should have this encounter in the uncoveredHealthRecord.
    assertFalse(person.defaultRecord.encounters.contains(uncoveredEncounter3));
    assertTrue(person.lossOfCareRecord.encounters.contains(uncoveredEncounter3));
}
Also used : HealthInsuranceModule(org.mitre.synthea.modules.HealthInsuranceModule) 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 19 with Provider

use of org.mitre.synthea.world.agents.Provider 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 20 with Provider

use of org.mitre.synthea.world.agents.Provider 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)

Aggregations

Provider (org.mitre.synthea.world.agents.Provider)46 Test (org.junit.Test)23 ArrayList (java.util.ArrayList)17 Person (org.mitre.synthea.world.agents.Person)17 Path (java.nio.file.Path)12 Table (com.google.common.collect.Table)11 File (java.io.File)11 IOException (java.io.IOException)11 Collections (java.util.Collections)11 List (java.util.List)11 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)11 Config (org.mitre.synthea.helpers.Config)11 Encounter (org.mitre.synthea.world.concepts.HealthRecord.Encounter)11 FhirContext (ca.uhn.fhir.context.FhirContext)10 Code (org.mitre.synthea.world.concepts.HealthRecord.Code)10 Files (java.nio.file.Files)9 Paths (java.nio.file.Paths)9 StandardOpenOption (java.nio.file.StandardOpenOption)9 BundleEntryComponent (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent)7 Entry (ca.uhn.fhir.model.dstu2.resource.Bundle.Entry)6