Search in sources :

Example 1 with HealthInsuranceModule

use of org.mitre.synthea.modules.HealthInsuranceModule 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, (int) (testPrivatePayer.getMonthlyPremium() * 8) - 1);
    // 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 2 with HealthInsuranceModule

use of org.mitre.synthea.modules.HealthInsuranceModule in project synthea by synthetichealth.

the class Generator method updatePerson.

/**
 * Update a previously created person from the time they were last updated until Generator.stop or
 * they die, whichever comes sooner.
 * @param person the previously created person to update
 */
public void updatePerson(Person person) {
    HealthInsuranceModule healthInsuranceModule = new HealthInsuranceModule();
    EncounterModule encounterModule = new EncounterModule();
    long time = person.lastUpdated;
    while (person.alive(time) && time < stop) {
        healthInsuranceModule.process(person, time + timestep);
        encounterModule.process(person, time);
        Iterator<Module> iter = person.currentModules.iterator();
        while (iter.hasNext()) {
            Module module = iter.next();
            if (module.process(person, time)) {
                // this module has completed/terminated.
                iter.remove();
            }
        }
        encounterModule.endEncounterModuleEncounters(person, time);
        person.lastUpdated = time;
        HealthRecordEditors.getInstance().executeAll(person, person.record, time, timestep);
        time += timestep;
    }
    DeathModule.process(person, time);
}
Also used : HealthInsuranceModule(org.mitre.synthea.modules.HealthInsuranceModule) EncounterModule(org.mitre.synthea.modules.EncounterModule) HealthInsuranceModule(org.mitre.synthea.modules.HealthInsuranceModule) LifecycleModule(org.mitre.synthea.modules.LifecycleModule) EncounterModule(org.mitre.synthea.modules.EncounterModule) DeathModule(org.mitre.synthea.modules.DeathModule)

Example 3 with HealthInsuranceModule

use of org.mitre.synthea.modules.HealthInsuranceModule in project synthea by synthetichealth.

the class PayerTest method setup.

/**
 * Setup for Payer Tests.
 * @throws Exception on configuration loading error
 */
@BeforeClass
public static void setup() throws Exception {
    TestHelper.loadTestProperties();
    testState = Config.get("test_state.default", "Massachusetts");
    // Set up Medicaid numbers.
    healthInsuranceModule = new HealthInsuranceModule();
    double povertyLevel = Config.getAsDouble("generate.demographics.socioeconomic.income.poverty", 11000);
    medicaidLevel = 1.33 * povertyLevel;
    // Set up Mandate year.
    int mandateYear = Integer.parseInt(Config.get("generate.insurance.mandate.year", "2006"));
    mandateTime = Utilities.convertCalendarYearsToTime(mandateYear);
    medicareName = Config.get("generate.payers.insurance_companies.medicare", "Medicare");
    medicaidName = Config.get("generate.payers.insurance_companies.medicaid", "Medicaid");
    dualName = Config.get("generate.payers.insurance_companies.dual_eligible", "Dual Eligible");
}
Also used : HealthInsuranceModule(org.mitre.synthea.modules.HealthInsuranceModule) BeforeClass(org.junit.BeforeClass)

Aggregations

HealthInsuranceModule (org.mitre.synthea.modules.HealthInsuranceModule)3 BeforeClass (org.junit.BeforeClass)1 Test (org.junit.Test)1 DeathModule (org.mitre.synthea.modules.DeathModule)1 EncounterModule (org.mitre.synthea.modules.EncounterModule)1 LifecycleModule (org.mitre.synthea.modules.LifecycleModule)1 Person (org.mitre.synthea.world.agents.Person)1 Provider (org.mitre.synthea.world.agents.Provider)1 Code (org.mitre.synthea.world.concepts.HealthRecord.Code)1 Encounter (org.mitre.synthea.world.concepts.HealthRecord.Encounter)1