Search in sources :

Example 61 with Encounter

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

the class ExporterTest method testExportFilterShouldKeepOldActiveCareplan.

@Test
public void testExportFilterShouldKeepOldActiveCareplan() {
    record.encounterStart(time - years(10), EncounterType.WELLNESS);
    record.careplanStart(time - years(10), "stop_smoking");
    record.careplanEnd(time - years(8), "stop_smoking", DUMMY_CODE);
    record.encounterStart(time - years(12), EncounterType.WELLNESS);
    record.careplanStart(time - years(12), "healthy_diet");
    Person filtered = Exporter.filterForExport(patient, yearsToKeep, endTime);
    Encounter encounter = filtered.record.currentEncounter(time);
    assertEquals(1, encounter.careplans.size());
    assertEquals("healthy_diet", encounter.careplans.get(0).type);
    assertEquals(time - years(12), encounter.careplans.get(0).start);
}
Also used : Encounter(org.mitre.synthea.world.concepts.HealthRecord.Encounter) Person(org.mitre.synthea.world.agents.Person) Test(org.junit.Test) ProviderTest(org.mitre.synthea.world.agents.ProviderTest)

Example 62 with Encounter

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

the class ExporterTest method testExportFilterShouldKeepCauseOfDeath.

@Test
public void testExportFilterShouldKeepCauseOfDeath() {
    HealthRecord.Code causeOfDeath = new HealthRecord.Code("SNOMED-CT", "Todo-lookup-code", "Rabies");
    patient.recordDeath(time - years(20), causeOfDeath);
    DeathModule.process(patient, time - years(20));
    Person filtered = Exporter.filterForExport(patient, yearsToKeep, endTime);
    assertEquals(1, filtered.record.encounters.size());
    Encounter encounter = filtered.record.encounters.get(0);
    assertEquals(DeathModule.DEATH_CERTIFICATION, encounter.codes.get(0));
    assertEquals(time - years(20), encounter.start);
    assertEquals(1, encounter.observations.size());
    assertEquals(DeathModule.CAUSE_OF_DEATH_CODE.code, encounter.observations.get(0).type);
    assertEquals(time - years(20), encounter.observations.get(0).start);
    assertEquals(1, encounter.reports.size());
    assertEquals(DeathModule.DEATH_CERTIFICATE.code, encounter.reports.get(0).type);
    assertEquals(time - years(20), encounter.reports.get(0).start);
}
Also used : HealthRecord(org.mitre.synthea.world.concepts.HealthRecord) Code(org.mitre.synthea.world.concepts.HealthRecord.Code) 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 63 with Encounter

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

the class ExporterTest method testExportFilterSimpleCutoff.

@Test
public void testExportFilterSimpleCutoff() {
    record.encounterStart(time - years(8), EncounterType.WELLNESS);
    record.observation(time - years(8), "height", 64);
    record.encounterStart(time - years(4), EncounterType.WELLNESS);
    record.observation(time - years(4), "weight", 128);
    // observations should be filtered to the cutoff date
    Person filtered = Exporter.filterForExport(patient, yearsToKeep, endTime);
    Encounter encounter = filtered.record.currentEncounter(time);
    assertEquals(1, encounter.observations.size());
    assertEquals("weight", encounter.observations.get(0).type);
    assertEquals(time - years(4), encounter.observations.get(0).start);
    assertEquals(128, encounter.observations.get(0).value);
}
Also used : Encounter(org.mitre.synthea.world.concepts.HealthRecord.Encounter) Person(org.mitre.synthea.world.agents.Person) Test(org.junit.Test) ProviderTest(org.mitre.synthea.world.agents.ProviderTest)

Example 64 with Encounter

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

the class ValueSetCodeResolverTest method resolveCodesInImagingStudy.

@Test
public void resolveCodesInImagingStudy() throws Exception {
    // We load the imaging study from a module fixture, as there doesn't seem to be
    // a way to
    // instantiate it programmatically.
    Module module = TestHelper.getFixture("imaging_study_with_valueset.json");
    person.history = new ArrayList<>();
    State encounterState = module.getState("ED_Visit");
    assertTrue(encounterState.process(person, time));
    person.history.add(encounterState);
    State mri = module.getState("Knee_MRI");
    assertTrue(mri.process(person, time));
    ValueSetCodeResolver valueSetCodeResolver = new ValueSetCodeResolver(person);
    Person resolvedPerson = valueSetCodeResolver.resolve();
    // assertEquals(2, resolvedPerson.record.encounters.size());
    Encounter resolvedEncounter = resolvedPerson.record.encounters.get(resolvedPerson.record.encounters.size() - 1);
    assertEquals(1, resolvedEncounter.imagingStudies.size());
    ImagingStudy resolvedImagingStudy = resolvedEncounter.imagingStudies.get(0);
    assertEquals(1, resolvedImagingStudy.series.size());
    Series series = resolvedImagingStudy.series.get(0);
    assertEquals(SNOMED_URI, series.bodySite.system);
    assertEquals("762879008", series.bodySite.code);
    assertEquals("Structure of right common peroneal nerve in popliteal region", series.bodySite.display);
// Modality and SOP class are not really good candidates for ValueSet-based
// selection, so we do
// not currently have a sensible test case for these.
}
Also used : Series(org.mitre.synthea.world.concepts.HealthRecord.ImagingStudy.Series) State(org.mitre.synthea.engine.State) Encounter(org.mitre.synthea.world.concepts.HealthRecord.Encounter) ImagingStudy(org.mitre.synthea.world.concepts.HealthRecord.ImagingStudy) Module(org.mitre.synthea.engine.Module) Person(org.mitre.synthea.world.agents.Person) Test(org.junit.Test) ProviderTest(org.mitre.synthea.world.agents.ProviderTest)

Example 65 with Encounter

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

the class ValueSetCodeResolverTest method resolveReportValue.

@Test
public void resolveReportValue() {
    Code observationType = new Code(LOINC_URI, "73985-4", "Exercise activity");
    Code observationValue = new Code(LOINC_URI, "LA11837-4", "Bicycling");
    observationValue.valueSet = "http://loinc.org/vs/LL734-5";
    encounter.addObservation(time, observationType.code, observationValue, observationType.display);
    Code reportType = new Code(SNOMED_URI, "371543004", "Comprehensive history and physical report");
    reportType.valueSet = SNOMED_URI + "?fhir_vs=<<371531000";
    person.record.report(time, reportType.code, 1);
    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.reports.size());
    Report resolvedReport = resolvedEncounter.reports.get(0);
    assertEquals(1, resolvedReport.observations.size());
    Observation observation = resolvedReport.observations.get(0);
    Code actualObservationValue = (Code) observation.value;
    assertEquals(LOINC_URI, actualObservationValue.system);
    assertEquals("LA11834-1", actualObservationValue.code);
    assertEquals("Walking", actualObservationValue.display);
}
Also used : Report(org.mitre.synthea.world.concepts.HealthRecord.Report) Observation(org.mitre.synthea.world.concepts.HealthRecord.Observation) 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)

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