Search in sources :

Example 6 with Observation

use of com.ibm.streamsx.health.ingest.types.model.Observation in project streamsx.health by IBMStreams.

the class Test method main.

public static void main(String[] args) throws Exception {
    Topology t = new Topology("ConnectorTest");
    TStream<Observation> obsStream = SubscribeConnector.subscribe(t, "ingest-physionet");
    obsStream.print();
    StreamsContextFactory.getStreamsContext(Type.DISTRIBUTED).submit(t).get();
}
Also used : Observation(com.ibm.streamsx.health.ingest.types.model.Observation) Topology(com.ibm.streamsx.topology.Topology)

Example 7 with Observation

use of com.ibm.streamsx.health.ingest.types.model.Observation 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)

Example 8 with Observation

use of com.ibm.streamsx.health.ingest.types.model.Observation in project streamsx.health by IBMStreams.

the class PatientManipulatorService method build.

public void build() {
    TStream<Observation> obsStream = null;
    for (String topic : topics) {
        TStream<Observation> tstream = SubscribeConnector.subscribe(topo, topic.trim());
        if (obsStream == null)
            obsStream = tstream;
        else
            obsStream = obsStream.union(tstream);
    }
    TSink controlSink = SPLStreams.subscribe(topo, CONTROL_INPUT_TOPIC, JSONSchemas.JSON).convert(t -> t.getString(0)).asType(String.class).sink(new PatientController());
    TStream<Observation> modifiedObs = obsStream.modify(new Manipulator());
    controlSink.colocate(modifiedObs);
    PublishConnector.publishObservation(modifiedObs, getPublishedTopic());
}
Also used : TSink(com.ibm.streamsx.topology.TSink) Observation(com.ibm.streamsx.health.ingest.types.model.Observation)

Example 9 with Observation

use of com.ibm.streamsx.health.ingest.types.model.Observation in project streamsx.health by IBMStreams.

the class AbstractVitalsGenerator method get.

@Override
public Observation get() {
    Reading reading = new Reading();
    reading.setReadingType(getReadingType());
    reading.setTimestamp(++count);
    reading.setUom(getUOM());
    reading.setValue(vitalsGen.next());
    Device device = new Device();
    device.setId(getDeviceId());
    ReadingSource readingSource = new ReadingSource();
    readingSource.setDeviceId(getDeviceId());
    readingSource.setSourceType("generated");
    return new Observation(device, patientId, readingSource, reading);
}
Also used : Reading(com.ibm.streamsx.health.ingest.types.model.Reading) Device(com.ibm.streamsx.health.ingest.types.model.Device) ReadingSource(com.ibm.streamsx.health.ingest.types.model.ReadingSource) Observation(com.ibm.streamsx.health.ingest.types.model.Observation)

Aggregations

Observation (com.ibm.streamsx.health.ingest.types.model.Observation)9 Reading (com.ibm.streamsx.health.ingest.types.model.Reading)5 Device (com.ibm.streamsx.health.ingest.types.model.Device)4 ReadingSource (com.ibm.streamsx.health.ingest.types.model.ReadingSource)4 ReadingType (com.ibm.streamsx.health.ingest.types.model.ReadingType)2 Channel (com.ibm.streamsx.health.vines.model.Channel)2 ITerm (com.ibm.streamsx.health.vines.model.ITerm)2 ITermValue (com.ibm.streamsx.health.vines.model.ITermValue)2 Patient (com.ibm.streamsx.health.vines.model.Patient)2 Term (com.ibm.streamsx.health.vines.model.Term)2 TermValueString (com.ibm.streamsx.health.vines.model.TermValueString)2 Terms (com.ibm.streamsx.health.vines.model.Terms)2 ParseException (java.text.ParseException)2 DateTimeParseException (java.time.format.DateTimeParseException)2 ConverterFactory (com.ibm.streamsx.health.prepare.uomconverter.ConverterFactory)1 ABPDiastolicDataGenerator (com.ibm.streamsx.health.simulate.beacon.generators.ABPDiastolicDataGenerator)1 ABPSystolicDataGenerator (com.ibm.streamsx.health.simulate.beacon.generators.ABPSystolicDataGenerator)1 HealthcareDataGenerator (com.ibm.streamsx.health.simulate.beacon.generators.HealthcareDataGenerator)1 HeartRateDataGenerator (com.ibm.streamsx.health.simulate.beacon.generators.HeartRateDataGenerator)1 SpO2DataGenerator (com.ibm.streamsx.health.simulate.beacon.generators.SpO2DataGenerator)1