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);
}
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);
}
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);
}
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.
}
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);
}
Aggregations