use of org.mitre.synthea.world.concepts.HealthRecord.Code 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.Code 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");
double coinsurance = 1 - testPrivatePayer.getCoinsurance();
double deductible = testPrivatePayer.getDeductible();
double income = deductible + (2 * (encCost - testPrivatePayerCopay) * coinsurance) + (2 * testPrivatePayerCopay) - 1;
// Set person's income to be $1 lower than the cost of 2 visits.
person.attributes.put(Person.INCOME, (int) income);
// 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.Code in project synthea by synthetichealth.
the class CostsTest method testUpdatedCostsbyKnownCode.
@Test
public void testUpdatedCostsbyKnownCode() {
// These tests test some costs added in the August 2020 Costs Update.
// Test an updated medication cost.
// 993452,816.12,1014.45,1237.68,1 ML denosumab 60 MG/ML Prefilled Syringe (Prolia)
Code code = new Code("RxNorm", "993452", "1 ML denosumab 60 MG/ML Prefilled Syringe (Prolia)");
double minCost = 816.12;
double maxCost = 1237.68;
Entry fakeEntry = person.record.medicationStart(time, code.display, true);
fakeEntry.codes.add(code);
double cost = Costs.determineCostOfEntry(fakeEntry, person);
// At this point there is no state set, so there is no geogeaphic factor applied.
assertTrue(cost <= maxCost);
assertTrue(cost >= minCost);
// Now test cost with adjustment factor.
person.attributes.put(Person.STATE, "California");
double adjFactor = 1.0227;
cost = Costs.determineCostOfEntry(fakeEntry, person);
assertTrue(cost <= (maxCost * adjFactor));
assertTrue(cost >= (minCost * adjFactor));
// Test an updated procedure cost.
// 48387007,235,962.5,1690,"Incision of trachea (procedure)
code = new Code("SNOMED", "48387007", "Incision of trachea (procedure)");
minCost = 235;
maxCost = 1690;
fakeEntry = person.record.procedure(time, code.display);
fakeEntry.codes.add(code);
cost = Costs.determineCostOfEntry(fakeEntry, person);
adjFactor = 1.2010;
assertTrue(cost <= (maxCost * adjFactor));
assertTrue(cost >= (minCost * adjFactor));
}
use of org.mitre.synthea.world.concepts.HealthRecord.Code in project synthea by synthetichealth.
the class CostsTest method testCostByUnknownCode.
@Test
public void testCostByUnknownCode() {
Code code = new Code("RxNorm", "111111111111111111", "Exaplitol");
Entry fakeMedication = person.record.medicationStart(time, code.display, false);
fakeMedication.codes.add(code);
double cost = Costs.determineCostOfEntry(fakeMedication, person);
double expectedCost = Config.getAsDouble("generate.costs.default_medication_cost");
// assert the cost is within $0.01
assertEquals(expectedCost, cost, 0.01);
}
use of org.mitre.synthea.world.concepts.HealthRecord.Code in project synthea by synthetichealth.
the class CostsTest method testCostByCodeWithDifferentSystem.
@Test
public void testCostByCodeWithDifferentSystem() {
Code code = new Code("SNOMED-CT", "705129", "Fake SNOMED with the same code as an RxNorm code");
Entry fakeProcedure = person.record.procedure(time, code.display);
fakeProcedure.codes.add(code);
// it's the same number as above, but a procedure not a medication,
// so we don't expect the same result
double cost = Costs.determineCostOfEntry(fakeProcedure, person);
double expectedCost = Config.getAsDouble("generate.costs.default_procedure_cost");
// assert the cost is within $0.01
assertEquals(expectedCost, cost, 0.01);
}
Aggregations