Search in sources :

Example 1 with ReadingType

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;
}
Also used : ReadingType(com.ibm.streamsx.health.ingest.types.model.ReadingType) TermValueString(com.ibm.streamsx.health.vines.model.TermValueString)

Example 2 with 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);
}
Also used : Reading(com.ibm.streamsx.health.ingest.types.model.Reading) ReadingType(com.ibm.streamsx.health.ingest.types.model.ReadingType) Observation(com.ibm.streamsx.health.ingest.types.model.Observation) Before(org.junit.Before)

Example 3 with ReadingType

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));
        }
    }
}
Also used : Reading(com.ibm.streamsx.health.ingest.types.model.Reading) ReadingType(com.ibm.streamsx.health.ingest.types.model.ReadingType) InputStreamReader(java.io.InputStreamReader) Device(com.ibm.streamsx.health.ingest.types.model.Device) ReadingSource(com.ibm.streamsx.health.ingest.types.model.ReadingSource) BufferedReader(java.io.BufferedReader) Observation(com.ibm.streamsx.health.ingest.types.model.Observation)

Aggregations

ReadingType (com.ibm.streamsx.health.ingest.types.model.ReadingType)3 Observation (com.ibm.streamsx.health.ingest.types.model.Observation)2 Reading (com.ibm.streamsx.health.ingest.types.model.Reading)2 Device (com.ibm.streamsx.health.ingest.types.model.Device)1 ReadingSource (com.ibm.streamsx.health.ingest.types.model.ReadingSource)1 TermValueString (com.ibm.streamsx.health.vines.model.TermValueString)1 BufferedReader (java.io.BufferedReader)1 InputStreamReader (java.io.InputStreamReader)1 Before (org.junit.Before)1