Search in sources :

Example 41 with Encounter

use of org.mitre.synthea.world.concepts.HealthRecord.Encounter in project synthea by synthetichealth.

the class ValueSetCodeResolverTest method resolveMedicationCodes.

@Test
public void resolveMedicationCodes() {
    Code medicationCode = new Code(SNOMED_URI, "372756006", "Warfarin");
    Code reasonCode = new Code(SNOMED_URI, "128053003", "Deep venuous thrombosis");
    reasonCode.valueSet = SNOMED_URI + "?fhir_vs=ecl/<" + reasonCode.code;
    Code stopReason = new Code(SNOMED_URI, "401207004", "Medicine side effects present");
    stopReason.valueSet = SNOMED_URI + "?fhir_vs=ecl/<309298003";
    Medication medication = person.record.medicationStart(time, medicationCode.display, false);
    medication.codes.add(medicationCode);
    medication.reasons.add(reasonCode);
    person.record.medicationEnd(time, medicationCode.display, stopReason);
    ValueSetCodeResolver valueSetCodeResolver = new ValueSetCodeResolver(person);
    Person resolvedPerson = valueSetCodeResolver.resolve();
    assertEquals(1, resolvedPerson.record.encounters.size());
    Encounter resolvedEncounter = resolvedPerson.record.encounters.get(0);
    assertEquals(1, resolvedEncounter.medications.size());
    Medication resolvedMedication = resolvedEncounter.medications.get(0);
    assertEquals(1, resolvedMedication.reasons.size());
    Code actualMedicationReason = resolvedMedication.reasons.get(0);
    assertEquals(SNOMED_URI, actualMedicationReason.system);
    assertEquals("709687000", actualMedicationReason.code);
    assertEquals("Chronic deep vein thrombosis of pelvic vein", actualMedicationReason.display);
    Code actualStopReason = resolvedMedication.stopReason;
    assertEquals(SNOMED_URI, actualStopReason.system);
    assertEquals("408343002", actualStopReason.code);
    assertEquals("Indication for each drug checked", actualStopReason.display);
}
Also used : Medication(org.mitre.synthea.world.concepts.HealthRecord.Medication) Encounter(org.mitre.synthea.world.concepts.HealthRecord.Encounter) Code(org.mitre.synthea.world.concepts.HealthRecord.Code) Person(org.mitre.synthea.world.agents.Person) Test(org.junit.Test) ProviderTest(org.mitre.synthea.world.agents.ProviderTest)

Example 42 with Encounter

use of org.mitre.synthea.world.concepts.HealthRecord.Encounter in project synthea by synthetichealth.

the class ValueSetCodeResolverTest method resolveProcedureReason.

@Test
public void resolveProcedureReason() {
    Code procedureType = new Code(SNOMED_URI, "236172004", "Nephroscopic lithotripsy of ureteric calculus");
    Code procedureReason = new Code(SNOMED_URI, "95570007", "Renal calculus");
    procedureReason.valueSet = SNOMED_URI + "?fhir_vs=ecl/<" + procedureReason.code;
    Procedure procedure = person.record.procedure(time, procedureType.display);
    procedure.reasons.add(procedureReason);
    ValueSetCodeResolver valueSetCodeResolver = new ValueSetCodeResolver(person);
    Person resolvedPerson = valueSetCodeResolver.resolve();
    assertEquals(1, resolvedPerson.record.encounters.size());
    Encounter resolvedEncounter = resolvedPerson.record.encounters.get(0);
    assertEquals(1, resolvedEncounter.procedures.size());
    Procedure resolvedProcedure = resolvedEncounter.procedures.get(0);
    assertEquals(1, resolvedProcedure.reasons.size());
    Code actualProcedureReason = resolvedProcedure.reasons.get(0);
    assertEquals(SNOMED_URI, actualProcedureReason.system);
    assertEquals("699322002", actualProcedureReason.code);
    assertEquals("Matrix stone of kidney", actualProcedureReason.display);
}
Also used : Procedure(org.mitre.synthea.world.concepts.HealthRecord.Procedure) Encounter(org.mitre.synthea.world.concepts.HealthRecord.Encounter) Code(org.mitre.synthea.world.concepts.HealthRecord.Code) Person(org.mitre.synthea.world.agents.Person) Test(org.junit.Test) ProviderTest(org.mitre.synthea.world.agents.ProviderTest)

Example 43 with Encounter

use of org.mitre.synthea.world.concepts.HealthRecord.Encounter in project synthea by synthetichealth.

the class ValueSetCodeResolverTest method resolveCodesInCarePlan.

@Test
public void resolveCodesInCarePlan() {
    Code carePlanCode = new Code(SNOMED_URI, "734163000", "Care plan");
    Code reasonCode = new Code(SNOMED_URI, "90935002", "Haemophilia");
    reasonCode.valueSet = SNOMED_URI + "?fhir_vs=ecl/<64779008";
    Code stopReason = new Code(SNOMED_URI, "301857004", "Finding of body region");
    stopReason.valueSet = SNOMED_URI + "?fhir_vs=ecl/<" + stopReason.code;
    CarePlan carePlan = person.record.careplanStart(time, carePlanCode.display);
    carePlan.reasons.add(reasonCode);
    person.record.careplanEnd(time, carePlanCode.display, stopReason);
    ValueSetCodeResolver valueSetCodeResolver = new ValueSetCodeResolver(person);
    Person resolvedPerson = valueSetCodeResolver.resolve();
    assertEquals(1, resolvedPerson.record.encounters.size());
    Encounter resolvedEncounter = resolvedPerson.record.encounters.get(0);
    assertEquals(1, resolvedEncounter.careplans.size());
    CarePlan resolvedCarePlan = resolvedEncounter.careplans.get(0);
    assertEquals(1, resolvedCarePlan.reasons.size());
    Code actualCarePlanReason = resolvedCarePlan.reasons.get(0);
    assertEquals(SNOMED_URI, actualCarePlanReason.system);
    assertEquals("773422002", actualCarePlanReason.code);
    assertEquals("East Texas bleeding disorder", actualCarePlanReason.display);
    Code actualStopReason = resolvedCarePlan.stopReason;
    assertEquals(SNOMED_URI, actualStopReason.system);
    assertEquals("246995007", actualStopReason.code);
    assertEquals("Pseudo-hypopyon", actualStopReason.display);
}
Also used : CarePlan(org.mitre.synthea.world.concepts.HealthRecord.CarePlan) Encounter(org.mitre.synthea.world.concepts.HealthRecord.Encounter) Code(org.mitre.synthea.world.concepts.HealthRecord.Code) Person(org.mitre.synthea.world.agents.Person) Test(org.junit.Test) ProviderTest(org.mitre.synthea.world.agents.ProviderTest)

Example 44 with Encounter

use of org.mitre.synthea.world.concepts.HealthRecord.Encounter in project synthea by synthetichealth.

the class HealthRecordTest method testReportAllObs.

@Test
public void testReportAllObs() {
    Person person = new Person(0L);
    person.coverage.setPayerAtTime(time, noInsurance);
    HealthRecord record = new HealthRecord(person);
    Encounter encounter = record.encounterStart(time, EncounterType.WELLNESS);
    record.observation(time, "A", "A");
    record.observation(time, "B", "B");
    record.observation(time, "C", "C");
    Report report = record.report(time, "R", 3);
    Assert.assertEquals(3, encounter.observations.size());
    Assert.assertEquals(3, report.observations.size());
    Assert.assertEquals("A", report.observations.get(0).value);
    Assert.assertEquals("B", report.observations.get(1).value);
    Assert.assertEquals("C", report.observations.get(2).value);
}
Also used : Report(org.mitre.synthea.world.concepts.HealthRecord.Report) Encounter(org.mitre.synthea.world.concepts.HealthRecord.Encounter) Person(org.mitre.synthea.world.agents.Person) Test(org.junit.Test)

Example 45 with Encounter

use of org.mitre.synthea.world.concepts.HealthRecord.Encounter 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, testPrivatePayer.getMonthlyPremium().multiply(BigDecimal.valueOf(8)).subtract(BigDecimal.ONE).intValue());
    // 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));
}
Also used : HealthInsuranceModule(org.mitre.synthea.modules.HealthInsuranceModule) 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)

Aggregations

Encounter (org.mitre.synthea.world.concepts.HealthRecord.Encounter)99 Test (org.junit.Test)54 Code (org.mitre.synthea.world.concepts.HealthRecord.Code)51 HealthRecord (org.mitre.synthea.world.concepts.HealthRecord)29 Person (org.mitre.synthea.world.agents.Person)28 ProviderTest (org.mitre.synthea.world.agents.ProviderTest)22 DeathModule (org.mitre.synthea.modules.DeathModule)17 QualityOfLifeModule (org.mitre.synthea.modules.QualityOfLifeModule)17 ArrayList (java.util.ArrayList)16 CardiovascularDiseaseModule (org.mitre.synthea.modules.CardiovascularDiseaseModule)16 EncounterModule (org.mitre.synthea.modules.EncounterModule)16 LifecycleModule (org.mitre.synthea.modules.LifecycleModule)16 WeightLossModule (org.mitre.synthea.modules.WeightLossModule)16 Provider (org.mitre.synthea.world.agents.Provider)16 Medication (org.mitre.synthea.world.concepts.HealthRecord.Medication)16 Observation (org.mitre.synthea.world.concepts.HealthRecord.Observation)16 Procedure (org.mitre.synthea.world.concepts.HealthRecord.Procedure)16 Report (org.mitre.synthea.world.concepts.HealthRecord.Report)14 Date (java.util.Date)13 Claim (org.mitre.synthea.world.concepts.Claim)12