Search in sources :

Example 66 with Encounter

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

the class ValueSetCodeResolverTest method handlesNullCodesInImagingStudy.

@Test
public void handlesNullCodesInImagingStudy() throws Exception {
    // We load the imaging study from a module fixture, as there doesn't seem to be
    // a way to
    // instantiate it programmatically.
    Module module = TestHelper.getFixture("imaging_study_with_valueset.json");
    person.history = new ArrayList<>();
    State encounterState = module.getState("ED_Visit");
    assertTrue(encounterState.process(person, time));
    person.history.add(encounterState);
    State mri = module.getState("Knee_MRI");
    assertTrue(mri.process(person, time));
    Encounter imagingEncounter = person.record.encounters.get(person.record.encounters.size() - 1);
    imagingEncounter.imagingStudies.get(0).series.get(0).instances.set(0, null);
    ValueSetCodeResolver valueSetCodeResolver = new ValueSetCodeResolver(person);
    valueSetCodeResolver.resolve();
    imagingEncounter.imagingStudies.get(0).series.set(0, null);
    valueSetCodeResolver = new ValueSetCodeResolver(person);
    valueSetCodeResolver.resolve();
}
Also used : State(org.mitre.synthea.engine.State) Encounter(org.mitre.synthea.world.concepts.HealthRecord.Encounter) Module(org.mitre.synthea.engine.Module) Test(org.junit.Test) ProviderTest(org.mitre.synthea.world.agents.ProviderTest)

Example 67 with Encounter

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

the class QualityOfLifeTest method testConditionsInYear.

@Test
public void testConditionsInYear() {
    List<Entry> allConditions = new ArrayList<Entry>();
    for (Encounter e : person.record.encounters) {
        for (Entry condition : e.conditions) {
            allConditions.add(condition);
        }
    }
    // conditions in year 5
    List<Entry> conditionsYear5 = QualityOfLifeModule.conditionsInYear(allConditions, TimeUnit.DAYS.toMillis((long) (365.25 * 5)), TimeUnit.DAYS.toMillis((long) (365.25 * 6)));
    List<Entry> empty = new ArrayList<Entry>();
    assertEquals(empty, conditionsYear5);
    // conditions in year 10
    List<Entry> conditionsYear10 = QualityOfLifeModule.conditionsInYear(allConditions, TimeUnit.DAYS.toMillis((long) (365.25 * 10)), TimeUnit.DAYS.toMillis((long) (365.25 * 11)));
    assertEquals(2, conditionsYear10.size());
    assertEquals("Child attention deficit disorder", conditionsYear10.get(0).name);
    assertEquals("Asthma", conditionsYear10.get(1).name);
    // conditions in year 30
    List<Entry> conditionsYear30 = QualityOfLifeModule.conditionsInYear(allConditions, TimeUnit.DAYS.toMillis((long) (365.25 * 30)), TimeUnit.DAYS.toMillis((long) (365.25 * 31)));
    assertEquals(1, conditionsYear30.size());
    assertEquals("Diabetes", conditionsYear30.get(0).name);
}
Also used : Entry(org.mitre.synthea.world.concepts.HealthRecord.Entry) ArrayList(java.util.ArrayList) Encounter(org.mitre.synthea.world.concepts.HealthRecord.Encounter) Test(org.junit.Test)

Example 68 with Encounter

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

the class PayerTest method copayBeforeAndAfterMandate.

@Test
public void copayBeforeAndAfterMandate() {
    Costs.loadCostData();
    final long beforeMandateTime = mandateTime - 100;
    final long afterMandateTime = mandateTime + 100;
    Code code = new Code("SNOMED-CT", "705129", "Fake SNOMED with the same code as an RxNorm code");
    person = new Person(beforeMandateTime);
    /* Before Mandate */
    person.coverage.setPayerAtTime(beforeMandateTime, testPrivatePayer1);
    Encounter wellnessBeforeMandate = person.record.encounterStart(beforeMandateTime, EncounterType.WELLNESS);
    wellnessBeforeMandate.codes.add(code);
    wellnessBeforeMandate.provider = new Provider();
    person.record.encounterEnd(beforeMandateTime, EncounterType.WELLNESS);
    // The copay before the mandate time should be greater than 0.
    assertTrue(testPrivatePayer1.determineCopay(wellnessBeforeMandate).compareTo(Claim.ZERO_CENTS) > 0);
    Encounter inpatientBeforeMandate = person.record.encounterStart(beforeMandateTime, EncounterType.INPATIENT);
    inpatientBeforeMandate.codes.add(code);
    inpatientBeforeMandate.provider = new Provider();
    person.record.encounterEnd(beforeMandateTime, EncounterType.INPATIENT);
    // The copay for a non-wellness encounter should be greater than 0.
    assertTrue(testPrivatePayer1.determineCopay(wellnessBeforeMandate).compareTo(Claim.ZERO_CENTS) > 0.0);
    /* After Mandate */
    Encounter wellnessAfterMandate = person.record.encounterStart(afterMandateTime, EncounterType.WELLNESS);
    wellnessAfterMandate.codes.add(code);
    wellnessAfterMandate.provider = new Provider();
    person.record.encounterEnd(afterMandateTime, EncounterType.WELLNESS);
    // The copay after the mandate time should be 0.
    assertTrue(testPrivatePayer1.determineCopay(wellnessAfterMandate).equals(Claim.ZERO_CENTS));
    Encounter inpatientAfterMandate = person.record.encounterStart(afterMandateTime, EncounterType.INPATIENT);
    inpatientAfterMandate.codes.add(code);
    inpatientAfterMandate.provider = new Provider();
    person.record.encounterEnd(afterMandateTime, EncounterType.INPATIENT);
    // The copay for a non-wellness encounter should be greater than 0.
    assertTrue(testPrivatePayer1.determineCopay(inpatientAfterMandate).compareTo(Claim.ZERO_CENTS) > 0);
}
Also used : Encounter(org.mitre.synthea.world.concepts.HealthRecord.Encounter) Code(org.mitre.synthea.world.concepts.HealthRecord.Code) Test(org.junit.Test)

Example 69 with Encounter

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

the class PayerTest method determineCoveredCostWithNullPayer.

@Test
public void determineCoveredCostWithNullPayer() {
    // Default to No Insurance
    person = new Person(0L);
    person.attributes.put(Person.BIRTHDATE, 0L);
    HealthRecord healthRecord = new HealthRecord(person);
    Encounter encounter = healthRecord.encounterStart(0L, EncounterType.INPATIENT);
    encounter.codes.add(new Code("SNOMED-CT", "705129", "Fake SNOMED for null entry"));
    healthRecord.encounterEnd(0L, EncounterType.INPATIENT);
}
Also used : HealthRecord(org.mitre.synthea.world.concepts.HealthRecord) Encounter(org.mitre.synthea.world.concepts.HealthRecord.Encounter) Code(org.mitre.synthea.world.concepts.HealthRecord.Code) Test(org.junit.Test)

Example 70 with Encounter

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

the class PayerTest method payerDoesNotCoverEncounter.

@Test
public void payerDoesNotCoverEncounter() {
    person = new Person(0L);
    person.attributes.put(Person.BIRTHDATE, 0L);
    person.coverage.setPayerAtTime(0L, testPrivatePayer2);
    HealthRecord healthRecord = new HealthRecord(person);
    Encounter encounter = healthRecord.encounterStart(0L, EncounterType.INPATIENT);
    encounter.provider = new Provider();
    encounter.codes.add(new Code("SNOMED-CT", "705129", "Fake SNOMED for null entry"));
    assertFalse(testPrivatePayer2.coversService(encounter.type));
    healthRecord.encounterEnd(0L, EncounterType.INPATIENT);
    // Person's coverage should equal $0.0.
    assertTrue(person.coverage.getTotalCoverage().equals(Claim.ZERO_CENTS));
    // Person's expenses should equal the total cost of the encounter.
    assertTrue(person.coverage.getTotalExpenses().equals(encounter.getCost()));
}
Also used : HealthRecord(org.mitre.synthea.world.concepts.HealthRecord) Encounter(org.mitre.synthea.world.concepts.HealthRecord.Encounter) 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