use of org.mitre.synthea.world.concepts.HealthRecord.Encounter 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;
}
use of org.mitre.synthea.world.concepts.HealthRecord.Encounter 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));
}
use of org.mitre.synthea.world.concepts.HealthRecord.Encounter 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));
}
use of org.mitre.synthea.world.concepts.HealthRecord.Encounter in project synthea by synthetichealth.
the class DeathModuleTest method testDeathCertificate.
@Test
public void testDeathCertificate() {
/*
* death_certificate: { description: 'U.S. standard certificate of death - 2003 revision', code:
* '69409-1' }, cause_of_death: { description: 'Cause of Death [US Standard Certificate of
* Death]', code: '69453-9', value_type: 'condition' },
*
* death_certification: {description: 'Death Certification', codes: {'SNOMED-CT' =>
* ['308646001']}, class: 'ambulatory'}
*/
Code causeOfDeath = new Code("SNOMED-CT", "12345", "Some disease");
person.recordDeath(time, causeOfDeath);
DeathModule.process(person, time);
Encounter enc = person.record.encounters.get(0);
assertEquals(EncounterType.WELLNESS.toString(), enc.type);
assertEquals(time, enc.start);
Code code = enc.codes.get(0);
assertEquals("308646001", code.code);
assertEquals("Death Certification", code.display);
Report report = enc.reports.get(0);
assertEquals("69409-1", report.type);
assertEquals(time, report.start);
code = report.codes.get(0);
assertEquals("69409-1", code.code);
assertEquals("U.S. standard certificate of death - 2003 revision", code.display);
Observation obs = report.observations.get(0);
assertEquals("69453-9", obs.type);
assertEquals(time, obs.start);
code = (Code) obs.value;
assertEquals(causeOfDeath.code, code.code);
assertEquals(causeOfDeath.display, code.display);
code = obs.codes.get(0);
assertEquals("69453-9", code.code);
assertEquals("Cause of Death [US Standard Certificate of Death]", code.display);
}
use of org.mitre.synthea.world.concepts.HealthRecord.Encounter in project synthea by synthetichealth.
the class EncounterModuleTest method testEmergencySymptomEncounterHasClinician.
@Test
public void testEmergencySymptomEncounterHasClinician() {
person.setSymptom("Test", "Test", "Test", System.currentTimeMillis(), EncounterModule.EMERGENCY_SYMPTOM_THRESHOLD + 1, false);
module.process(person, System.currentTimeMillis());
assertNotNull(person.record);
assertFalse(person.record.encounters.isEmpty());
int last = person.record.encounters.size() - 1;
Encounter encounter = person.record.encounters.get(last);
assertNotNull("Encounter must have clinician", encounter.clinician);
assertNotNull("Encounter must have provider organization", encounter.provider);
}
Aggregations