use of org.mitre.synthea.world.concepts.HealthRecord.Code in project synthea by synthetichealth.
the class PayerTest method costsUncoveredByNoInsurance.
@Test
public void costsUncoveredByNoInsurance() {
Costs.loadCostData();
Payer.loadNoInsurance();
person = new Person(0L);
person.coverage.setPayerAtTime(0L, Payer.noInsurance);
Code code = new Code("SNOMED-CT", "705129", "Fake SNOMED with the same code as an RxNorm code");
Encounter fakeEncounter = person.record.encounterStart(0L, EncounterType.WELLNESS);
fakeEncounter.codes.add(code);
fakeEncounter.provider = new Provider();
double totalCost = fakeEncounter.getCost().doubleValue();
person.record.encounterEnd(0L, EncounterType.WELLNESS);
// The No Insurance payer should have $0.0 coverage.
assertEquals(0, Payer.noInsurance.getAmountCovered(), 0.001);
// The No Insurance's uncovered costs should equal the total cost.
assertEquals(totalCost, Payer.noInsurance.getAmountUncovered(), 0.001);
// The person's expenses shoudl equal the total cost.
assertEquals(totalCost, person.coverage.getTotalExpenses(), 0.001);
}
use of org.mitre.synthea.world.concepts.HealthRecord.Code in project synthea by synthetichealth.
the class PayerTest method payerCoversEncounter.
@Test
public void payerCoversEncounter() {
person = new Person(0L);
person.attributes.put(Person.BIRTHDATE, 0L);
person.coverage.setPayerAtTime(0L, testPrivatePayer1);
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"));
assertTrue(testPrivatePayer1.coversService(encounter.type));
healthRecord.encounterEnd(0L, EncounterType.INPATIENT);
// Person's coverage should equal the cost of the encounter
double coverage = encounter.claim.totals.coinsurance + encounter.claim.totals.payer;
assertEquals(person.coverage.getTotalCoverage(), coverage, 0.001);
double result = encounter.claim.totals.coinsurance + encounter.claim.totals.copay + encounter.claim.totals.deductible + encounter.claim.totals.payer + encounter.claim.totals.pocket;
assertEquals(encounter.getCost().doubleValue(), result, 0.001);
// Person's expenses should equal the copay.
double expenses = encounter.claim.totals.copay + encounter.claim.totals.deductible + encounter.claim.totals.pocket;
assertEquals(person.coverage.getTotalExpenses(), expenses, 0.001);
}
use of org.mitre.synthea.world.concepts.HealthRecord.Code in project synthea by synthetichealth.
the class PayerTest method costsCoveredByPayer.
@Test
public void costsCoveredByPayer() {
long time = 0L;
Costs.loadCostData();
person = new Person(time);
person.coverage.setPayerAtTime(time, testPrivatePayer1);
Code code = new Code("SNOMED-CT", "705129", "Fake SNOMED with the same code as an RxNorm code");
Encounter fakeEncounter = person.record.encounterStart(time, EncounterType.WELLNESS);
fakeEncounter.codes.add(code);
fakeEncounter.provider = new Provider();
double totalCost = fakeEncounter.getCost().doubleValue();
person.record.encounterEnd(0L, EncounterType.WELLNESS);
// check the copays match
assertEquals(testPrivatePayer1.getDeductible(), fakeEncounter.claim.totals.deductible, 0.001);
// check that totals match
assertEquals(totalCost, fakeEncounter.claim.totals.cost, 0.001);
double result = fakeEncounter.claim.totals.coinsurance + fakeEncounter.claim.totals.copay + fakeEncounter.claim.totals.deductible + fakeEncounter.claim.totals.payer + fakeEncounter.claim.totals.pocket;
assertEquals(totalCost, result, 0.001);
// The total cost should equal the Cost to the Payer summed with the Payer's copay amount.
assertEquals(totalCost, testPrivatePayer1.getAmountCovered() + fakeEncounter.claim.getPatientCost(), 0.001);
// The total cost should equal the Payer's uncovered costs plus the Payer's covered costs.
assertEquals(totalCost, testPrivatePayer1.getAmountCovered() + testPrivatePayer1.getAmountUncovered(), 0.001);
// The total coverage by the payer should equal the person's covered costs.
assertEquals(person.coverage.getTotalCoverage(), testPrivatePayer1.getAmountCovered(), 0.001);
}
use of org.mitre.synthea.world.concepts.HealthRecord.Code in project synthea by synthetichealth.
the class PayerTest method incrementEncounters.
@Test
public void incrementEncounters() {
person = new Person(0L);
person.coverage.setPayerAtTime(0L, testPrivatePayer1);
HealthRecord healthRecord = new HealthRecord(person);
Code code = new Code("SNOMED-CT", "705129", "Fake Code");
Encounter fakeEncounter = healthRecord.encounterStart(0L, EncounterType.INPATIENT);
fakeEncounter.codes.add(code);
fakeEncounter.provider = new Provider();
healthRecord.encounterEnd(0L, EncounterType.INPATIENT);
fakeEncounter = healthRecord.encounterStart(0L, EncounterType.AMBULATORY);
fakeEncounter.provider = new Provider();
fakeEncounter.codes.add(code);
healthRecord.encounterEnd(0L, EncounterType.AMBULATORY);
fakeEncounter = healthRecord.encounterStart(0L, EncounterType.EMERGENCY);
fakeEncounter.codes.add(code);
fakeEncounter.provider = new Provider();
healthRecord.encounterEnd(0L, EncounterType.EMERGENCY);
assertEquals(3, testPrivatePayer1.getEncountersCoveredCount());
}
use of org.mitre.synthea.world.concepts.HealthRecord.Code 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));
}
Aggregations