use of com.ibm.streamsx.health.ingest.types.model.ReadingType in project streamsx.health by IBMStreams.
the class VinesToObservationParser method getReadingType.
private ReadingType getReadingType(String vinesName) {
ReadingType readingType;
String code = isMappingEnabled ? lookupTable.lookupPlatformCode(vinesName) : null;
if (code != null) {
readingType = new ReadingType(ReadingTypeSystem.STREAMS_CODE_SYSTEM, code);
} else {
readingType = new ReadingType(VINES_SYSTEM_NAME, vinesName);
}
return readingType;
}
use of com.ibm.streamsx.health.ingest.types.model.ReadingType in project streamsx.health by IBMStreams.
the class ResolverTests method setup.
@Before
public void setup() {
readingType = new ReadingType();
reading = new Reading();
reading.setReadingType(readingType);
obs = new Observation();
obs.setReading(reading);
}
use of com.ibm.streamsx.health.ingest.types.model.ReadingType in project streamsx.health by IBMStreams.
the class HealthcareDataGenerator method loadData.
public void loadData(InputStream is, String filename) throws Exception {
Device device = new Device();
device.setId("HealthcareDataGenerator");
ReadingSource readingSource = new ReadingSource();
readingSource.setDeviceId(device.getId());
readingSource.setSourceType("file");
readingSource.setId(filename);
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
// skip first 2 lines
reader.readLine();
String[] uom = reader.readLine().replace("'", "").split(",");
String line = null;
while ((line = reader.readLine()) != null) {
String[] values = line.split(",");
for (int i = 1; i < values.length; i++) {
Reading reading = new Reading();
// convert to milliseconds
Double tsMilli = Double.valueOf(values[0]) * 1000;
reading.setTimestamp(tsMilli.longValue());
reading.setReadingType(new ReadingType(ReadingTypeSystem.STREAMS_CODE_SYSTEM, readingTypeCode));
reading.setUom(uom[i]);
reading.setValue(Double.valueOf(values[i]));
observations.add(new Observation(device, patientId, readingSource, reading));
}
}
}
Aggregations