Example #1
0
def GetType_ValueTime():

    global typeValueTimeName
    typeValueTime = SdsType(
        id=typeValueTimeName,
        description="A Time-Series indexed type with a value",
        sdsTypeCode=SdsTypeCode.Object)

    doubleType = SdsType()
    doubleType.Id = "doubleType"
    doubleType.SdsTypeCode = SdsTypeCode.Double

    timeType = SdsType()
    timeType.Id = "string"
    timeType.SdsTypeCode = SdsTypeCode.DateTime

    value = SdsTypeProperty()
    value.Id = "value"
    value.SdsType = doubleType

    time = SdsTypeProperty()
    time.Id = "time"
    time.SdsType = timeType
    time.IsKey = True

    typeValueTime.Properties = []
    typeValueTime.Properties.append(value)
    typeValueTime.Properties.append(time)

    return typeValueTime
Example #2
0
def get_type_value_time():
    """Creates a type for value/time events"""

    type_value_time = SdsType(
        id=TYPE_VALUE_TIME_NAME,
        description="A Time-Series indexed type with a value",
        sdsTypeCode=SdsTypeCode.Object)

    double_type = SdsType()
    double_type.Id = "doubleType"
    double_type.SdsTypeCode = SdsTypeCode.Double

    time_type = SdsType()
    time_type.Id = "string"
    time_type.SdsTypeCode = SdsTypeCode.DateTime

    value = SdsTypeProperty()
    value.Id = "value"
    value.SdsType = double_type

    time_prop = SdsTypeProperty()
    time_prop.Id = "time"
    time_prop.SdsType = time_type
    time_prop.IsKey = True

    type_value_time.Properties = []
    type_value_time.Properties.append(value)
    type_value_time.Properties.append(time_prop)

    return type_value_time
Example #3
0
def get_wave_compound_data_type(sample_type_id):
    """Creates a compound SDS type definition for WaveData"""
    if sample_type_id is None or not isinstance(sample_type_id, str):
        raise TypeError("sampleTypeId is not an instantiated string")

    int_type = SdsType()
    int_type.Id = "intType"
    int_type.SdsTypeCode = SdsTypeCode.Int32

    double_type = SdsType()
    double_type.Id = "doubleType"
    double_type.SdsTypeCode = SdsTypeCode.Double

    # note that the Order is the key (primary index)
    order_property = SdsTypeProperty()
    order_property.Id = "Order"
    order_property.SdsType = int_type
    order_property.IsKey = True
    order_property.Order = 1

    multiplier_property = SdsTypeProperty()
    multiplier_property.Id = "Multiplier"
    multiplier_property.SdsType = int_type
    multiplier_property.IsKey = True
    multiplier_property.Order = 2

    tau_property = SdsTypeProperty()
    tau_property.Id = "Tau"
    tau_property.SdsType = double_type

    radians_property = SdsTypeProperty()
    radians_property.Id = "Radians"
    radians_property.SdsType = double_type

    sin_property = SdsTypeProperty()
    sin_property.Id = "Sin"
    sin_property.SdsType = double_type

    cos_property = SdsTypeProperty()
    cos_property.Id = "Cos"
    cos_property.SdsType = double_type

    tan_property = SdsTypeProperty()
    tan_property.Id = "Tan"
    tan_property.SdsType = double_type

    sinh_property = SdsTypeProperty()
    sinh_property.Id = "Sinh"
    sinh_property.SdsType = double_type

    cosh_property = SdsTypeProperty()
    cosh_property.Id = "Cosh"
    cosh_property.SdsType = double_type

    tanh_property = SdsTypeProperty()
    tanh_property.Id = "Tanh"
    tanh_property.SdsType = double_type

    # create an SdsType for WaveData Class
    wave = SdsType()
    wave.Id = sample_type_id
    wave.Name = "WaveDataTypeCompound"
    wave.Description = "This is a sample Sds type for storing WaveData type "\
                       "events"
    wave.SdsTypeCode = SdsTypeCode.Object
    wave.Properties = [
        order_property, multiplier_property, tau_property, radians_property,
        sin_property, cos_property, tan_property, sinh_property, cosh_property,
        tanh_property
    ]

    return wave
Example #4
0
def get_wave_data_integer_type(sample_type_id):
    """Creates an SDS type definition for WaveDataInteger"""
    if sample_type_id is None or not isinstance(sample_type_id, str):
        raise TypeError("sampleTypeId is not an instantiated string")

    int_type = SdsType()
    int_type.Id = "intType"
    int_type.SdsTypeCode = SdsTypeCode.Int32

    # note that the Order is the key (primary index)
    order_target_property = SdsTypeProperty()
    order_target_property.Id = "OrderTarget"
    order_target_property.SdsType = int_type
    order_target_property.IsKey = True

    sin_int_property = SdsTypeProperty()
    sin_int_property.Id = "SinInt"
    sin_int_property.SdsType = int_type

    cos_int_property = SdsTypeProperty()
    cos_int_property.Id = "CosInt"
    cos_int_property.SdsType = int_type

    tan_int_property = SdsTypeProperty()
    tan_int_property.Id = "TanInt"
    tan_int_property.SdsType = int_type

    # create an SdsType for the WaveDataInteger Class
    wave = SdsType()
    wave.Id = SAMPLE_INTEGER_TYPE_ID
    wave.Name = "WaveDataIntegerSample"
    wave.Description = "This is a sample Sds type for storing WaveDataInteger"\
                       "type events"
    wave.SdsTypeCode = SdsTypeCode.Object
    wave.Properties = [
        order_target_property, sin_int_property, cos_int_property,
        tan_int_property
    ]

    return wave
Example #5
0
def get_wave_data_target_type(sample_type_id):
    """Creates an SDS type definition for WaveDataTarget"""
    if sample_type_id is None or not isinstance(sample_type_id, str):
        raise TypeError("sampleTypeId is not an instantiated string")

    int_type = SdsType()
    int_type.Id = "intType"
    int_type.SdsTypeCode = SdsTypeCode.Int32

    double_type = SdsType()
    double_type.Id = "doubleType"
    double_type.SdsTypeCode = SdsTypeCode.Double

    # note that the Order is the key (primary index)
    order_target_property = SdsTypeProperty()
    order_target_property.Id = "OrderTarget"
    order_target_property.SdsType = int_type
    order_target_property.IsKey = True

    tau_target_property = SdsTypeProperty()
    tau_target_property.Id = "TauTarget"
    tau_target_property.SdsType = double_type

    radians_target_property = SdsTypeProperty()
    radians_target_property.Id = "RadiansTarget"
    radians_target_property.SdsType = double_type

    sin_target_property = SdsTypeProperty()
    sin_target_property.Id = "SinTarget"
    sin_target_property.SdsType = double_type

    cos_target_property = SdsTypeProperty()
    cos_target_property.Id = "CosTarget"
    cos_target_property.SdsType = double_type

    tan_target_property = SdsTypeProperty()
    tan_target_property.Id = "TanTarget"
    tan_target_property.SdsType = double_type

    sinh_target_property = SdsTypeProperty()
    sinh_target_property.Id = "SinhTarget"
    sinh_target_property.SdsType = double_type

    cosh_target_property = SdsTypeProperty()
    cosh_target_property.Id = "CoshTarget"
    cosh_target_property.SdsType = double_type

    tanh_target_property = SdsTypeProperty()
    tanh_target_property.Id = "TanhTarget"
    tanh_target_property.SdsType = double_type

    # create an SdsType for WaveData Class
    wave = SdsType()
    wave.Id = SAMPLE_TARGET_TYPE_ID
    wave.Name = "WaveDataTargetSample"
    wave.Description = "This is a sample Sds type for storing WaveDataTarget"\
                       " type events"
    wave.SdsTypeCode = SdsTypeCode.Object
    wave.Properties = [
        order_target_property, tau_target_property, radians_target_property,
        sin_target_property, cos_target_property, tan_target_property,
        sinh_target_property, cosh_target_property, tanh_target_property
    ]

    return wave
Example #6
0
def get_type_press_temp_time():
    """Creates a type for press/temp/time events"""

    type_press_temp_time = SdsType(
        id=TYPE_PRESSURE_TEMPERATURE_TIME_NAME,
        description="A Time-Series indexed type with 2 values",
        sdsTypeCode=SdsTypeCode.Object)

    double_type = SdsType()
    double_type.Id = "doubleType"
    double_type.SdsTypeCode = SdsTypeCode.Double

    time_type = SdsType()
    time_type.Id = "string"
    time_type.SdsTypeCode = SdsTypeCode.DateTime

    temperature = SdsTypeProperty()
    temperature.Id = "temperature"
    temperature.SdsType = double_type

    pressure = SdsTypeProperty()
    pressure.Id = "pressure"
    pressure.SdsType = double_type

    time_prop = SdsTypeProperty()
    time_prop.Id = "time"
    time_prop.SdsType = time_type
    time_prop.IsKey = True

    type_press_temp_time.Properties = [temperature, pressure, time_prop]

    return type_press_temp_time
Example #7
0
def create_data(namespace_id, ocs_client):
    """Creates sample data for the script to use"""

    double_type = SdsType(id='doubleType', sdsTypeCode=SdsTypeCode.Double)
    datetime_type = SdsType(id='dateTimeType',
                            sdsTypeCode=SdsTypeCode.DateTime)

    pressure_property = SdsTypeProperty(id='pressure', sdsType=double_type)
    temperature_property = SdsTypeProperty(id=SAMPLE_FIELD_TO_CONSOLIDATE_TO,
                                           sdsType=double_type)
    ambient_temperature_property = SdsTypeProperty(
        id=SAMPLE_FIELD_TO_CONSOLIDATE, sdsType=double_type)
    time_property = SdsTypeProperty(id='time',
                                    sdsType=datetime_type,
                                    isKey=True)

    sds_type_1 = SdsType(
        id=SAMPLE_TYPE_ID_1,
        description='This is a sample Sds type for storing Pressure type '
        'events for Data Views',
        sdsTypeCode=SdsTypeCode.Object,
        properties=[pressure_property, temperature_property, time_property])

    sds_type_2 = SdsType(
        id=SAMPLE_TYPE_ID_2,
        description='This is a new sample Sds type for storing Pressure type '
        'events for Data Views',
        sdsTypeCode=SdsTypeCode.Object,
        properties=[
            pressure_property, ambient_temperature_property, time_property
        ])

    print('Creating SDS Types...')
    ocs_client.Types.getOrCreateType(namespace_id, sds_type_1)
    ocs_client.Types.getOrCreateType(namespace_id, sds_type_2)

    stream1 = SdsStream(
        id=SAMPLE_STREAM_ID_1,
        name=SAMPLE_STREAM_NAME_1,
        description='A Stream to store the sample Pressure events',
        typeId=SAMPLE_TYPE_ID_1)

    stream2 = SdsStream(
        id=SAMPLE_STREAM_ID_2,
        name=SAMPLE_STREAM_NAME_2,
        description='A Stream to store the sample Pressure events',
        typeId=SAMPLE_TYPE_ID_2)

    print('Creating SDS Streams...')
    ocs_client.Streams.createOrUpdateStream(namespace_id, stream1)
    ocs_client.Streams.createOrUpdateStream(namespace_id, stream2)

    sample_start_time = datetime.datetime.now() - datetime.timedelta(hours=1)
    sample_end_time = datetime.datetime.now()

    values1 = []
    values2 = []

    def value_with_time(timestamp, value, field_name, value2):
        """Formats a JSON data object"""
        return f'{{"time": "{timestamp}", "pressure": {str(value)}, "{field_name}": {str(value2)}}}'

    print('Generating values...')
    for i in range(1, 30, 1):
        timestamp = (sample_start_time +
                     datetime.timedelta(minutes=i * 2)).isoformat(
                         timespec='seconds')
        val1 = value_with_time(timestamp, random.uniform(0, 100),
                               SAMPLE_FIELD_TO_CONSOLIDATE_TO,
                               random.uniform(50, 70))
        val2 = value_with_time(timestamp, random.uniform(0, 100),
                               SAMPLE_FIELD_TO_CONSOLIDATE,
                               random.uniform(50, 70))

        values1.append(val1)
        values2.append(val2)

    print('Sending values...')
    ocs_client.Streams.insertValues(namespace_id, SAMPLE_STREAM_ID_1,
                                    str(values1).replace("'", ""))
    ocs_client.Streams.insertValues(namespace_id, SAMPLE_STREAM_ID_2,
                                    str(values2).replace("'", ""))

    return (sample_start_time, sample_end_time)
Example #8
0
def GetType_PressTempTime():
    global typePressureTemperatureTimeName
    typePressTempTime = SdsType(
        id=typePressureTemperatureTimeName,
        description="A Time-Series indexed type with 2 values",
        sdsTypeCode=SdsTypeCode.Object)

    doubleType = SdsType()
    doubleType.Id = "doubleType"
    doubleType.SdsTypeCode = SdsTypeCode.Double

    timeType = SdsType()
    timeType.Id = "string"
    timeType.SdsTypeCode = SdsTypeCode.DateTime

    temperature = SdsTypeProperty()
    temperature.Id = "temperature"
    temperature.SdsType = doubleType

    pressure = SdsTypeProperty()
    pressure.Id = "pressure"
    pressure.SdsType = doubleType

    time = SdsTypeProperty()
    time.Id = "time"
    time.SdsType = timeType
    time.IsKey = True

    typePressTempTime.Properties = [temperature, pressure, time]

    return typePressTempTime
Example #9
0
def createData(ocsClient):
    import random
    global namespaceId, startTime

    doubleType = SdsType(id="doubleType", sdsTypeCode=SdsTypeCode.Double)
    dateTimeType = SdsType(id="dateTimeType", sdsTypeCode=SdsTypeCode.DateTime)

    pressureDoubleProperty = SdsTypeProperty(id="pressure", sdsType=doubleType)
    temperatureDoubleProperty = SdsTypeProperty(id="temperature",
                                                sdsType=doubleType)
    timeDateTimeProperty = SdsTypeProperty(id="time",
                                           sdsType=dateTimeType,
                                           isKey=True)

    pressure_SDSType = SdsType(
        id=samplePressureTypeId,
        description="This is a sample Sds type for storing Pressure type "
        "events for Dataviews",
        sdsTypeCode=SdsTypeCode.Object,
        properties=[pressureDoubleProperty, timeDateTimeProperty])
    temperature_SDSType = SdsType(
        id=sampleTemperatureTypeId,
        description="This is a sample Sds type for storing Temperature type "
        "events for Dataviews",
        sdsTypeCode=SdsTypeCode.Object,
        properties=[temperatureDoubleProperty, timeDateTimeProperty])

    print('Creating SDS Type')
    ocsClient.Types.getOrCreateType(namespaceId, pressure_SDSType)
    ocsClient.Types.getOrCreateType(namespaceId, temperature_SDSType)

    pressureStream = SdsStream(
        id=samplePressureStreamId,
        name=samplePressureStreamName,
        description="A Stream to store the sample Pressure events",
        typeId=samplePressureTypeId)

    temperatureStream = SdsStream(
        id=sampleTemperatureStreamId,
        name=sampleTemperatureStreamName,
        description="A Stream to store the sample Temperature events",
        typeId=sampleTemperatureTypeId)

    print('Creating SDS Streams')
    ocsClient.Streams.createOrUpdateStream(namespaceId, pressureStream)
    ocsClient.Streams.createOrUpdateStream(namespaceId, temperatureStream)

    start = datetime.datetime.now() - datetime.timedelta(hours=1)

    pressureValues = []
    temperatureValues = []

    def valueWithTime(timestamp, sensor, value):
        return f'{{"time": "{timestamp}", "{sensor}": {str(value)} }}'

    print('Generating Values')
    for i in range(1, 30, 1):
        pv = str(random.uniform(0, 100))
        tv = str(random.uniform(50, 70))
        timestamp = (start + datetime.timedelta(minutes=i * 2)).isoformat(
            timespec='seconds')
        pVal = valueWithTime(timestamp, "pressure", random.uniform(0, 100))
        tVAl = valueWithTime(timestamp, "temperature", random.uniform(50, 70))

        pressureValues.append(pVal)
        temperatureValues.append(tVAl)

    print('Sending Pressure Values')
    ocsClient.Streams.insertValues(namespaceId, samplePressureStreamId,
                                   str(pressureValues).replace("'", ""))
    print('Sending Temperature Values')
    ocsClient.Streams.insertValues(namespaceId, sampleTemperatureStreamId,
                                   str(temperatureValues).replace("'", ""))
    startTime = start
Example #10
0
def createData(ocsClient):
    import random
    global namespaceId, firstData

    doubleType = SdsType(id="doubleType", sdsTypeCode=SdsTypeCode.Double)
    dateTimeType = SdsType(id="dateTimeType", sdsTypeCode=SdsTypeCode.DateTime)

    pressureDoubleProperty = SdsTypeProperty(id="pressure", sdsType=doubleType)
    temperatureDoubleProperty = SdsTypeProperty(id="temperature",
                                                sdsType=doubleType)
    timeDateTimeProperty = SdsTypeProperty(id="time", sdsType=dateTimeType,
                                           isKey=True)

    pressure_SDSType = SdsType(
        id=samplePressureTypeId,
        description="This is a sample Sds type for storing Pressure type "
                    "events for Dataviews",
        sdsTypeCode=SdsTypeCode.Object,
        properties=[pressureDoubleProperty, timeDateTimeProperty])
    temperature_SDSType = SdsType(
        id=sampleTemperatureTypeId,
        description="This is a sample Sds type for storing Temperature type "
                    "events for Dataviews",
        sdsTypeCode=SdsTypeCode.Object,
        properties=[temperatureDoubleProperty, timeDateTimeProperty])

    print('Creating SDS Type')
    ocsClient.Types.getOrCreateType(namespaceId, pressure_SDSType)
    ocsClient.Types.getOrCreateType(namespaceId, temperature_SDSType)

    pressureStream = SdsStream(
        id=samplePressureStreamId,
        name=samplePressureStreamName,
        description="A Stream to store the sample Pressure events",
        typeId=samplePressureTypeId)

    temperatureStream = SdsStream(
        id=sampleTemperatureStreamId,
        name=sampleTemperatureStreamName,
        description="A Stream to store the sample Temperature events",
        typeId=sampleTemperatureTypeId)

    print('Creating SDS Streams')
    ocsClient.Streams.createOrUpdateStream(namespaceId, pressureStream)
    ocsClient.Streams.createOrUpdateStream(namespaceId, temperatureStream)

    start = datetime.datetime.now() - datetime.timedelta(hours=1)

    pressureValues = []
    temperatureValues = []
    print('Sending Values')
    for i in range(1, 60, 1):
        pv = str(random.uniform(0, 100))
        tv = str(random.uniform(50, 70))
        pVal = ('{"time" : "' + (start + datetime.timedelta(minutes=i * 1))
                .strftime("%Y-%m-%dT%H:%M:%SZ")+'", "pressure":' +
                str(random.uniform(0, 100)) + '}')
        tVAl = ('{"time" : "' + (start + datetime.timedelta(minutes=i * 1))
                .strftime("%Y-%m-%dT%H:%M:%SZ")+'", "temperature":' +
                str(random.uniform(50, 70)) + '}')
        if i == 1:
            timeHolder = (start + datetime.timedelta(minutes=i * 1)
                          ).strftime("%Y-%m-%dT%H:%M:%SZ")
            firstData = ('{"time" : "' + timeHolder + '", "pressure":' + pv +
                         ', "temperature":' + tv + '}')

        pressureValues.append(pVal)
        temperatureValues.append(tVAl)

    print('Sending Pressure Values')
    ocsClient.Streams.insertValues(
        namespaceId,
        samplePressureStreamId,
        str(pressureValues).replace("'", ""))
    print('Sending Temperature Values')
    ocsClient.Streams.insertValues(
        namespaceId,
        sampleTemperatureStreamId,
        str(temperatureValues).replace("'", ""))
Example #11
0
def getWaveDataIntegerType(sampleTypeId):
    if sampleTypeId is None or not isinstance(sampleTypeId, str):
        raise TypeError("sampleTypeId is not an instantiated string")

    intType = SdsType()
    intType.Id = "intType"
    intType.SdsTypeCode = SdsTypeCode.Int32

    # note that the Order is the key (primary index)
    orderTargetProperty = SdsTypeProperty()
    orderTargetProperty.Id = "OrderTarget"
    orderTargetProperty.SdsType = intType
    orderTargetProperty.IsKey = True

    sinIntProperty = SdsTypeProperty()
    sinIntProperty.Id = "SinInt"
    sinIntProperty.SdsType = intType

    cosIntProperty = SdsTypeProperty()
    cosIntProperty.Id = "CosInt"
    cosIntProperty.SdsType = intType

    tanIntProperty = SdsTypeProperty()
    tanIntProperty.Id = "TanInt"
    tanIntProperty.SdsType = intType

    # create an SdsType for the WaveDataInteger Class
    wave = SdsType()
    wave.Id = sampleIntegerTypeId
    wave.Name = "WaveDataIntegerSample"
    wave.Description = "This is a sample Sds type for storing WaveDataInteger"\
                       "type events"
    wave.SdsTypeCode = SdsTypeCode.Object
    wave.Properties = [
        orderTargetProperty, sinIntProperty, cosIntProperty, tanIntProperty
    ]

    return wave
Example #12
0
def getWaveDataTargetType(sampleTypeId):
    if sampleTypeId is None or not isinstance(sampleTypeId, str):
        raise TypeError("sampleTypeId is not an instantiated string")

    intType = SdsType()
    intType.Id = "intType"
    intType.SdsTypeCode = SdsTypeCode.Int32

    doubleType = SdsType()
    doubleType.Id = "doubleType"
    doubleType.SdsTypeCode = SdsTypeCode.Double

    # note that the Order is the key (primary index)
    orderTargetProperty = SdsTypeProperty()
    orderTargetProperty.Id = "OrderTarget"
    orderTargetProperty.SdsType = intType
    orderTargetProperty.IsKey = True

    tauTargetProperty = SdsTypeProperty()
    tauTargetProperty.Id = "TauTarget"
    tauTargetProperty.SdsType = doubleType

    radiansTargetProperty = SdsTypeProperty()
    radiansTargetProperty.Id = "RadiansTarget"
    radiansTargetProperty.SdsType = doubleType

    sinTargetProperty = SdsTypeProperty()
    sinTargetProperty.Id = "SinTarget"
    sinTargetProperty.SdsType = doubleType

    cosTargetProperty = SdsTypeProperty()
    cosTargetProperty.Id = "CosTarget"
    cosTargetProperty.SdsType = doubleType

    tanTargetProperty = SdsTypeProperty()
    tanTargetProperty.Id = "TanTarget"
    tanTargetProperty.SdsType = doubleType

    sinhTargetProperty = SdsTypeProperty()
    sinhTargetProperty.Id = "SinhTarget"
    sinhTargetProperty.SdsType = doubleType

    coshTargetProperty = SdsTypeProperty()
    coshTargetProperty.Id = "CoshTarget"
    coshTargetProperty.SdsType = doubleType

    tanhTargetProperty = SdsTypeProperty()
    tanhTargetProperty.Id = "TanhTarget"
    tanhTargetProperty.SdsType = doubleType

    # create an SdsType for WaveData Class
    wave = SdsType()
    wave.Id = sampleTargetTypeId
    wave.Name = "WaveDataTargetSample"
    wave.Description = "This is a sample Sds type for storing WaveDataTarget"\
                       " type events"
    wave.SdsTypeCode = SdsTypeCode.Object
    wave.Properties = [
        orderTargetProperty, tauTargetProperty, radiansTargetProperty,
        sinTargetProperty, cosTargetProperty, tanTargetProperty,
        sinhTargetProperty, coshTargetProperty, tanhTargetProperty
    ]

    return wave
def createData(ocsClient):
    import random
    global namespaceId, startTime, endTime

    doubleType = SdsType(id="doubleType", sdsTypeCode=SdsTypeCode.Double)
    dateTimeType = SdsType(id="dateTimeType", sdsTypeCode=SdsTypeCode.DateTime)

    pressureDoubleProperty = SdsTypeProperty(id="pressure", sdsType=doubleType)
    temperatureDoubleProperty = SdsTypeProperty(id=fieldToConsolidateTo,
                                                sdsType=doubleType)
    ambientTemperatureDoubleProperty = SdsTypeProperty(id=fieldToConsolidate,
                                                       sdsType=doubleType)
    timeDateTimeProperty = SdsTypeProperty(id="time", sdsType=dateTimeType,
                                           isKey=True)

    sDSType1 = SdsType(
        id=sampleTypeId,
        description="This is a sample Sds type for storing Pressure type "
                    "events for Data Views",
        sdsTypeCode=SdsTypeCode.Object,
        properties=[pressureDoubleProperty, temperatureDoubleProperty, timeDateTimeProperty])

    sDSType2 = SdsType(
        id=samplePressureId2,
        description="This is a new sample Sds type for storing Pressure type "
                    "events for Data Views",
        sdsTypeCode=SdsTypeCode.Object,
        properties=[pressureDoubleProperty, ambientTemperatureDoubleProperty, timeDateTimeProperty])

    print('Creating SDS Type')
    ocsClient.Types.getOrCreateType(namespaceId, sDSType1)
    ocsClient.Types.getOrCreateType(namespaceId, sDSType2)

    stream1 = SdsStream(
        id=sampleStreamId,
        name=sampleStreamName,
        description="A Stream to store the sample Pressure events",
        typeId=sampleTypeId)

    stream2 = SdsStream(
        id=sampleStreamId2,
        name=sampleStreamName2,
        description="A Stream to store the sample Pressure events",
        typeId=samplePressureId2)

    print('Creating SDS Streams')
    ocsClient.Streams.createOrUpdateStream(namespaceId, stream1)
    ocsClient.Streams.createOrUpdateStream(namespaceId, stream2)

    start = datetime.datetime.now() - datetime.timedelta(hours=1)
    endTime = datetime.datetime.now()

    values = []
    values2 = []

    def valueWithTime(timestamp, value, fieldName, value2):
        return f'{{"time": "{timestamp}", "pressure": {str(value)}, "{fieldName}": {str(value2)}}}'

    print('Generating Values')
    for i in range(1, 30, 1):
        timestamp = (start + datetime.timedelta(minutes=i * 2)
                     ).isoformat(timespec='seconds')
        pVal = valueWithTime(timestamp, random.uniform(
            0, 100), fieldToConsolidateTo, random.uniform(50, 70))
        pVal2 = valueWithTime(timestamp, random.uniform(
            0, 100), fieldToConsolidate, random.uniform(50, 70))

        values.append(pVal)
        values2.append(pVal2)

    print('Sending Values')
    ocsClient.Streams.insertValues(
        namespaceId,
        sampleStreamId,
        str(values).replace("'", ""))
    ocsClient.Streams.insertValues(
        namespaceId,
        sampleStreamId2,
        str(values2).replace("'", ""))
    startTime = start