Skip to content

Commit

Permalink
Update US Core v4 export and enforce physiology usage more consistently.
Browse files Browse the repository at this point in the history
  • Loading branch information
jawalonoski committed Jun 24, 2022
1 parent c266ab6 commit f36067c
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 39 deletions.
4 changes: 2 additions & 2 deletions config/simulations/ecg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ charts:
axisParamX: time
axisLabelX: time (s)
axisLabelY: Current (A)
lowerBoundY: -0.05
upperBoundY: 0.15
#lowerBoundY: -0.05
#upperBoundY: 0.15
series:
- param: zf
2 changes: 1 addition & 1 deletion src/main/java/org/mitre/synthea/engine/Components.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public static class SampledData implements Serializable {
public Double lowerLimit; // Lower limit of detection
public Double upperLimit; // Upper limit of detection
public List<String> attributes; // Person attributes containing TimeSeriesData objects
public transient List<TimeSeriesData> series; // List of actual series data collections
public List<TimeSeriesData> series; // List of actual series data collections

// Format for the output decimal numbers
// See https://docs.oracle.com/javase/8/docs/api/java/text/DecimalFormat.html
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/mitre/synthea/export/FhirR4.java
Original file line number Diff line number Diff line change
Expand Up @@ -1654,7 +1654,7 @@ private static BundleEntryComponent observation(RandomNumberGenerator rand,
if (codeMappingUri != null) {
meta.addProfile(codeMappingUri);
if (!codeMappingUri.contains("/us/core/") && observation.category.equals("vital-signs")) {
meta.addProfile("http://hl7.org/fhir/StructureDefinition/vitalsigns");
meta.addProfile("http://hl7.org/fhir/us/core/StructureDefinition/us-core-vital-signs");
}
} else if (observation.report != null && observation.category.equals("laboratory")) {
meta.addProfile("http://hl7.org/fhir/us/core/StructureDefinition/us-core-observation-lab");
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/mitre/synthea/helpers/TimeSeriesData.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package org.mitre.synthea.helpers;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

public class TimeSeriesData {
public class TimeSeriesData implements Serializable {
/** Provides a collection of time series values as well as sampling metadata
* concerning those values.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -849,7 +849,7 @@ private static double reverseCalculateCreatinine(Person person, double crcl, lon
Config.getAsBoolean("lifecycle.death_by_natural_causes");
protected static boolean ENABLE_DEATH_BY_LOSS_OF_CARE =
Config.getAsBoolean("lifecycle.death_by_loss_of_care");
protected static boolean ENABLE_PHYSIOLOGY_GENERATORS =
public static boolean ENABLE_PHYSIOLOGY_GENERATORS =
Config.getAsBoolean("physiology.generators.enabled", false);

// Death From Natural Causes SNOMED Code
Expand Down
19 changes: 9 additions & 10 deletions src/main/resources/us_core_mapping.csv
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ SYSTEM,CODE,URL
"http://loinc.org","72166-2","http://hl7.org/fhir/us/core/StructureDefinition/us-core-smokingstatus"
"http://loinc.org","2708-6","http://hl7.org/fhir/us/core/StructureDefinition/us-core-pulse-oximetry"
"http://loinc.org","59408-5","http://hl7.org/fhir/us/core/StructureDefinition/us-core-pulse-oximetry"
"http://loinc.org","85353-1","http://hl7.org/fhir/StructureDefinition/vitalspanel"
"http://loinc.org","9279-1","http://hl7.org/fhir/StructureDefinition/resprate"
"http://loinc.org","8867-4","http://hl7.org/fhir/StructureDefinition/heartrate"
"http://loinc.org","8310-5","http://hl7.org/fhir/StructureDefinition/bodytemp"
"http://loinc.org","8331-1","http://hl7.org/fhir/StructureDefinition/bodytemp"
"http://loinc.org","8302-2","http://hl7.org/fhir/StructureDefinition/bodyheight"
"http://loinc.org","9843-4","http://hl7.org/fhir/StructureDefinition/headcircum"
"http://loinc.org","29463-7","http://hl7.org/fhir/StructureDefinition/bodyweight"
"http://loinc.org","39156-5","http://hl7.org/fhir/StructureDefinition/bmi"
"http://loinc.org","85354-9","http://hl7.org/fhir/StructureDefinition/bp"
"http://loinc.org","9279-1","http://hl7.org/fhir/us/core/StructureDefinition/us-core-respiratory-rate"
"http://loinc.org","8867-4","http://hl7.org/fhir/us/core/StructureDefinition/us-core-heart-rate"
"http://loinc.org","8310-5","http://hl7.org/fhir/us/core/StructureDefinition/us-core-body-temperature"
"http://loinc.org","8302-2","http://hl7.org/fhir/us/core/StructureDefinition/us-core-body-height"
"http://loinc.org","9843-4","http://hl7.org/fhir/us/core/StructureDefinition/us-core-head-circumference"
"http://loinc.org","8289-1","http://hl7.org/fhir/us/core/StructureDefinition/head-occipital-frontal-circumference-percentile"
"http://loinc.org","29463-7","http://hl7.org/fhir/us/core/StructureDefinition/us-core-body-weight"
"http://loinc.org","39156-5","http://hl7.org/fhir/us/core/StructureDefinition/us-core-bmi"
"http://loinc.org","85354-9","http://hl7.org/fhir/us/core/StructureDefinition/us-core-blood-pressure"
9 changes: 8 additions & 1 deletion src/test/java/org/mitre/synthea/TestHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import org.mitre.synthea.engine.Generator;
import org.mitre.synthea.engine.Module;
import org.mitre.synthea.engine.State;
import org.mitre.synthea.helpers.Config;
import org.mitre.synthea.helpers.Utilities;
import org.mitre.synthea.world.agents.Person;
Expand Down Expand Up @@ -149,6 +150,10 @@ public static long years(long numYears) {
public static synchronized Person[] getGeneratedPeople() throws IOException,
ClassNotFoundException {
if (serializedPatients == null) {
// Ensure Physiology state is enabled
boolean physStateEnabled = State.ENABLE_PHYSIOLOGY_STATE;
State.ENABLE_PHYSIOLOGY_STATE = true;

int numberOfPeople = 10;
Generator generator = new Generator(numberOfPeople);
generator.options.overflow = false;
Expand All @@ -162,12 +167,14 @@ public static synchronized Person[] getGeneratedPeople() throws IOException,
oos.writeObject(people);
oos.close();
serializedPatients = baos.toByteArray();

// Reset state after exporter test.
State.ENABLE_PHYSIOLOGY_STATE = physStateEnabled;
}
ByteArrayInputStream bais = new ByteArrayInputStream(serializedPatients);
ObjectInputStream ois = new ObjectInputStream(bais);
Person[] rehydrated = (Person[]) ois.readObject();
ois.close();
return rehydrated;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@

import org.apache.commons.codec.binary.Base64;
import org.hl7.fhir.dstu3.model.DiagnosticReport;
import org.junit.After;
import org.junit.Before;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
Expand All @@ -46,7 +46,7 @@
* Uses HAPI FHIR project to validate FHIR export. http://hapifhir.io/doc_validation.html
*/
public class FHIRDSTU2ExporterTest {
private boolean physStateEnabled;
private static boolean physStateEnabled;

/**
* Temporary folder for any exported files, guaranteed to be deleted at the end of the test.
Expand All @@ -57,8 +57,8 @@ public class FHIRDSTU2ExporterTest {
/**
* Setup state for exporter test.
*/
@Before
public void setup() {
@BeforeClass
public static void setup() {
// Ensure Physiology state is enabled
physStateEnabled = State.ENABLE_PHYSIOLOGY_STATE;
State.ENABLE_PHYSIOLOGY_STATE = true;
Expand All @@ -67,8 +67,8 @@ public void setup() {
/**
* Reset state after exporter test.
*/
@After
public void tearDown() {
@AfterClass
public static void tearDown() {
State.ENABLE_PHYSIOLOGY_STATE = physStateEnabled;
}

Expand Down
15 changes: 7 additions & 8 deletions src/test/java/org/mitre/synthea/export/FHIRR4ExporterTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@
import org.apache.commons.codec.binary.Base64;
import org.hl7.fhir.r4.model.Bundle;
import org.hl7.fhir.r4.model.Bundle.BundleEntryComponent;
import org.hl7.fhir.r4.model.DocumentReference;
import org.hl7.fhir.r4.model.Media;
import org.hl7.fhir.r4.model.Observation;
import org.hl7.fhir.r4.model.Quantity;
import org.hl7.fhir.r4.model.SampledData;
import org.junit.After;
import org.junit.Before;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
Expand All @@ -47,7 +46,7 @@
* Uses HAPI FHIR project to validate FHIR export. http://hapifhir.io/doc_validation.html
*/
public class FHIRR4ExporterTest {
private boolean physStateEnabled;
private static boolean physStateEnabled;

/**
* Temporary folder for any exported files, guaranteed to be deleted at the end of the test.
Expand All @@ -58,8 +57,8 @@ public class FHIRR4ExporterTest {
/**
* Setup state for exporter test.
*/
@Before
public void setup() {
@BeforeClass
public static void setup() {
// Ensure Physiology state is enabled
physStateEnabled = State.ENABLE_PHYSIOLOGY_STATE;
State.ENABLE_PHYSIOLOGY_STATE = true;
Expand All @@ -68,8 +67,8 @@ public void setup() {
/**
* Reset state after exporter test.
*/
@After
public void tearDown() {
@AfterClass
public static void tearDown() {
State.ENABLE_PHYSIOLOGY_STATE = physStateEnabled;
}

Expand Down
14 changes: 7 additions & 7 deletions src/test/java/org/mitre/synthea/export/FHIRSTU3ExporterTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
import org.hl7.fhir.dstu3.model.Observation;
import org.hl7.fhir.dstu3.model.Quantity;
import org.hl7.fhir.dstu3.model.SampledData;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
Expand All @@ -48,7 +48,7 @@
* Uses HAPI FHIR project to validate FHIR export. http://hapifhir.io/doc_validation.html
*/
public class FHIRSTU3ExporterTest {
private boolean physStateEnabled;
private static boolean physStateEnabled;

/**
* Temporary folder for any exported files, guaranteed to be deleted at the end of the test.
Expand All @@ -59,8 +59,8 @@ public class FHIRSTU3ExporterTest {
/**
* Setup state for exporter test.
*/
@Before
public void setup() {
@BeforeClass
public static void setup() {
// Ensure Physiology state is enabled
physStateEnabled = State.ENABLE_PHYSIOLOGY_STATE;
State.ENABLE_PHYSIOLOGY_STATE = true;
Expand All @@ -69,8 +69,8 @@ public void setup() {
/**
* Reset state after exporter test.
*/
@After
public void tearDown() {
@AfterClass
public static void tearDown() {
State.ENABLE_PHYSIOLOGY_STATE = physStateEnabled;
}

Expand Down

0 comments on commit f36067c

Please sign in to comment.