Search in sources :

Example 6 with Code

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));
}
Also used : Encounter(org.mitre.synthea.world.concepts.HealthRecord.Encounter) Person(org.mitre.synthea.world.agents.Person) Code(org.mitre.synthea.world.concepts.HealthRecord.Code) Provider(org.mitre.synthea.world.agents.Provider) Test(org.junit.Test)

Example 7 with Code

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));
}
Also used : Encounter(org.mitre.synthea.world.concepts.HealthRecord.Encounter) Person(org.mitre.synthea.world.agents.Person) Code(org.mitre.synthea.world.concepts.HealthRecord.Code) Provider(org.mitre.synthea.world.agents.Provider) Test(org.junit.Test)

Example 8 with Code

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));
}
Also used : Entry(org.mitre.synthea.world.concepts.HealthRecord.Entry) Code(org.mitre.synthea.world.concepts.HealthRecord.Code) Test(org.junit.Test)

Example 9 with Code

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);
}
Also used : Entry(org.mitre.synthea.world.concepts.HealthRecord.Entry) Code(org.mitre.synthea.world.concepts.HealthRecord.Code) Test(org.junit.Test)

Example 10 with Code

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);
}
Also used : Entry(org.mitre.synthea.world.concepts.HealthRecord.Entry) Code(org.mitre.synthea.world.concepts.HealthRecord.Code) Test(org.junit.Test)

Aggregations

Code (org.mitre.synthea.world.concepts.HealthRecord.Code)152 Test (org.junit.Test)64 Encounter (org.mitre.synthea.world.concepts.HealthRecord.Encounter)49 HealthRecord (org.mitre.synthea.world.concepts.HealthRecord)48 Date (java.util.Date)30 CardiovascularDiseaseModule (org.mitre.synthea.modules.CardiovascularDiseaseModule)30 DeathModule (org.mitre.synthea.modules.DeathModule)30 EncounterModule (org.mitre.synthea.modules.EncounterModule)30 LifecycleModule (org.mitre.synthea.modules.LifecycleModule)30 QualityOfLifeModule (org.mitre.synthea.modules.QualityOfLifeModule)30 WeightLossModule (org.mitre.synthea.modules.WeightLossModule)29 ArrayList (java.util.ArrayList)22 HashMap (java.util.HashMap)20 JsonObject (com.google.gson.JsonObject)19 Person (org.mitre.synthea.world.agents.Person)19 Medication (org.mitre.synthea.world.concepts.HealthRecord.Medication)15 DocumentReference (org.hl7.fhir.r4.model.DocumentReference)14 Reference (org.hl7.fhir.r4.model.Reference)14 Provider (org.mitre.synthea.world.agents.Provider)14 Meta (org.hl7.fhir.r4.model.Meta)13