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();
}
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);
}
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);
}
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);
}
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()));
}
Aggregations