コード例 #1
0
def store(data: OrderedDict, input_streams: dict, output_streams: dict, metadata, CC_obj: CerebralCortex, config: dict):
    """
    Store diagnostic results with its metadata in the data-store
    :param input_streams:
    :param data:
    :param CC_obj:
    :param config:
    :param algo_type:
    """
    if data:
        # basic output stream info
        owner = input_streams[0]["owner_id"]
        dd_stream_id = output_streams["id"]
        dd_stream_name = output_streams["name"]
        stream_type = "ds"

        data_descriptor = metadata["dd"]
        execution_context = metadata["ec"]
        annotations = metadata["anno"]

        ds = DataStream(identifier=dd_stream_id, owner=owner, name=dd_stream_name, data_descriptor=data_descriptor,
                        execution_context=execution_context, annotations=annotations,
                        stream_type=stream_type, data=data)

        CC_obj.save_datastream(ds, "datastream")
コード例 #2
0
def store(data: OrderedDict, input_streams: dict, output_streams: dict,
          CC_obj: CerebralCortex):
    """
    Store diagnostic results with its metadata in the data-store
    :param input_streams:
    :param data:
    :param CC_obj:
    :param config:
    :param algo_type:
    """
    if data:
        #basic output stream info
        owner = input_streams[0]["owner_id"]
        dd_stream_id = output_streams["id"]
        dd_stream_name = output_streams["name"]
        stream_type = "ds"

        data_descriptor = [{
            "NAME":
            "Data Quality (LED)",
            "DATA_TYPE":
            "int",
            "FREQUENCY":
            "0.33",
            "MAX_VALUE":
            "4",
            "MIN_VALUE":
            "0",
            "DESCRIPTION":
            "measures the Data Quality of LED. Values= GOOD(0), BAND_OFF(1), NOT_WORN(2), BAND_LOOSE(3), NOISE(4)"
        }]
        execution_context = {
            "platform_metadata": {
                "NAME": "MotionSense HRV",
                "DEVICE_ID": ""
            },
            "processing_module": {
                "name":
                "",
                "environment":
                "cerebralcortex",
                "algorithm": [{
                    "method": "",
                    "authors": ["Nasir Ali", " Md Azim Ullah"],
                    "version": "0.0.1",
                    "reference": {
                        "url": "http://md2k.org/"
                    },
                    "description": ""
                }],
                "description":
                "",
                "input_streams":
                input_streams,
                "output_streams":
                output_streams,
                "input_parameters": {}
            },
            "datasource_metadata": {
                "NAME":
                "Data Quality (LED)",
                "DATA_TYPE":
                "org.md2k.datakitapi.datatype.DataTypeInt",
                "FREQUENCY":
                "0.33",
                "DESCRIPTION":
                "measures the Data Quality of LED. Values= GOOD(0), BAND_OFF(1), NOT_WORN(2), BAND_LOOSE(3), NOISE(4)"
            },
            "application_metadata": {
                "NAME": "MotionSense",
                "DESCRIPTION":
                "Collects data from the motion sense. Sensors supported: [Accelerometer, Gyroscope, Battery, LED, DataQuality]",
                "VERSION_NAME": "0.0.1",
                "VERSION_NUMBER": "2000500"
            }
        }
        annotations = []

        ds = DataStream(identifier=dd_stream_id,
                        owner=owner,
                        name=dd_stream_name,
                        data_descriptor=data_descriptor,
                        execution_context=execution_context,
                        annotations=annotations,
                        stream_type=stream_type,
                        data=data)

        CC_obj.save_datastream(ds, "datastream")