Search in sources :

Example 1 with Person

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

the class BirthStatisticsTest method testNoStatisticsForWomenWhoAreNotPregnant.

@Test
public void testNoStatisticsForWomenWhoAreNotPregnant() {
    Person woman = new Person(0L);
    woman.attributes.put(Person.GENDER, "F");
    woman.attributes.put("pregnant", false);
    BirthStatistics.setBirthStatistics(woman, 0L);
    assertNull(woman.attributes.get(BirthStatistics.BIRTH_DATE));
    assertNull(woman.attributes.get(BirthStatistics.BIRTH_WEEK));
    assertNull(woman.attributes.get(BirthStatistics.BIRTH_SEX));
    assertNull(woman.attributes.get(BirthStatistics.BIRTH_HEIGHT));
    assertNull(woman.attributes.get(BirthStatistics.BIRTH_WEIGHT));
}
Also used : Person(org.mitre.synthea.world.agents.Person) Test(org.junit.Test)

Example 2 with Person

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

the class HealthRecordTest method testReportAllObs.

@Test
public void testReportAllObs() {
    Person person = new Person(0L);
    person.coverage.setPayerAtTime(time, noInsurance);
    HealthRecord record = new HealthRecord(person);
    Encounter encounter = record.encounterStart(time, EncounterType.WELLNESS);
    record.observation(time, "A", "A");
    record.observation(time, "B", "B");
    record.observation(time, "C", "C");
    Report report = record.report(time, "R", 3);
    Assert.assertEquals(3, encounter.observations.size());
    Assert.assertEquals(3, report.observations.size());
    Assert.assertEquals("A", report.observations.get(0).value);
    Assert.assertEquals("B", report.observations.get(1).value);
    Assert.assertEquals("C", report.observations.get(2).value);
}
Also used : Report(org.mitre.synthea.world.concepts.HealthRecord.Report) Encounter(org.mitre.synthea.world.concepts.HealthRecord.Encounter) Person(org.mitre.synthea.world.agents.Person) Test(org.junit.Test)

Example 3 with Person

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

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

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

Aggregations

Person (org.mitre.synthea.world.agents.Person)139 Test (org.junit.Test)106 Encounter (org.mitre.synthea.world.concepts.HealthRecord.Encounter)25 Provider (org.mitre.synthea.world.agents.Provider)20 Code (org.mitre.synthea.world.concepts.HealthRecord.Code)18 Before (org.junit.Before)17 HealthRecord (org.mitre.synthea.world.concepts.HealthRecord)12 ArrayList (java.util.ArrayList)11 List (java.util.List)9 Module (org.mitre.synthea.engine.Module)9 Location (org.mitre.synthea.world.geography.Location)9 FhirContext (ca.uhn.fhir.context.FhirContext)8 File (java.io.File)8 State (org.mitre.synthea.engine.State)8 Map (java.util.Map)7 IParser (ca.uhn.fhir.parser.IParser)6 Random (java.util.Random)6 Table (com.google.common.collect.Table)5 HashMap (java.util.HashMap)5 CarePlan (org.mitre.synthea.world.concepts.HealthRecord.CarePlan)5