コード例 #1
0
def get_metadata(dd_stream_name: str, input_streams: dict,
                 config: dict) -> dict:
    """

    :param dd_stream_name:
    :param input_streams:
    :param config:
    :return:
    """
    input_param = {
        "window_size": config["general"]["window_size"],
        "app_availability_marker_battery_threshold": "1"
    }
    data_descriptor = {
        "NAME":
        dd_stream_name,
        "DATA_TYPE":
        "int",
        "DESCRIPTION":
        "mobile phone availability: " +
        str(config["labels"]["app_unavailable"]) + ", " +
        str(config["labels"]["app_available"])
    }

    algo_description = config["description"]["app_availability_marker"]
    method = 'cerebralcortex.data_processor.data_diagnostic.app_availability.py'
    ec = get_execution_context(dd_stream_name, input_param, input_streams,
                               method, algo_description, config)
    anno = get_annotations()
    return {"ec": ec, "dd": data_descriptor, "anno": anno}
コード例 #2
0
def get_metadata(dd_stream_name: str, input_streams: dict, config: dict) -> dict:
    """

    :param dd_stream_name:
    :param input_streams:
    :param config:
    :return:
    """
    if dd_stream_name == config["stream_names"]["autosense_wireless_marker"]:
        input_param = {"window_size": config["general"]["window_size"],
                       "sensor_unavailable_ecg_threshold": config["sensor_unavailable_marker"]["ecg"],
                       "sensor_unavailable_rip_threshold": config["sensor_unavailable_marker"]["rip"]}
        data_descriptor = {"NAME": dd_stream_name, "DATA_TYPE": "int",
                           "DESCRIPTION": "AutoSense unavailable label: " + str(
                               config["labels"]["autosense_unavailable"])}
    elif dd_stream_name == config["stream_names"]["motionsense_hrv_right_wireless_marker"] or dd_stream_name == \
            config["stream_names"]["motionsense_hrv_left_wireless_marker"]:
        input_param = {"window_size": config["general"]["window_size"],
                       "sensor_unavailable_motionsense_threshold": config["sensor_unavailable_marker"]["motionsense"],
                       "sensor_unavailable_phone_threshold": config["sensor_unavailable_marker"]["phone"]
                       }
        data_descriptor = {"NAME": dd_stream_name, "DATA_TYPE": "int",
                           "DESCRIPTION": "Motionsense unavailable label: " + str(
                               config["labels"]["motionsense_unavailable"])}
    else:
        raise ValueError("Incorrect sensor type")

    algo_description = config["description"]["sensor_unavailable_marker"]
    method = 'cerebralcortex.data_processor.data_diagnostic.sensor_unavailable_marker'
    ec = get_execution_context(dd_stream_name, input_param, input_streams, method,
                               algo_description, config)
    anno = get_annotations()
    return {"ec": ec, "dd": data_descriptor, "anno": anno}
コード例 #3
0
def get_metadata(dd_stream_name: str, input_streams: dict,
                 config: dict) -> dict:
    """

    :param dd_stream_name:
    :param input_streams:
    :param config:
    :return:
    """
    input_param = {"window_size": "21600"}
    if dd_stream_name == config["stream_names"]["motionsense_hrv_right_sensor_failure_marker"] or dd_stream_name == \
            config["stream_names"]["motionsense_hrv_left_sensor_failure_marker"]:
        label = config["labels"]["motionsense_failure"]
    elif dd_stream_name == dd_stream_name == config["stream_names"][
            "phone_sensor_failure_marker"]:
        label = config["labels"]["phone_sensor_failure"]
    elif dd_stream_name == dd_stream_name == config["stream_names"][
            "autosense_sensor_failure_marker"]:
        label = config["labels"]["autosense_sensor_failure"]
    else:
        raise ValueError("Incorrect sensor type")

    data_descriptor = {
        "NAME": dd_stream_name,
        "DATA_TYPE": "int",
        "DESCRIPTION": "sensor failure detection: " + str(label)
    }
    algo_description = config["description"]["sensor_failure"]
    method = 'cerebralcortex.data_processor.data_diagnostic.sensor_failure'
    ec = get_execution_context(dd_stream_name, input_param, input_streams,
                               method, algo_description, config)
    anno = get_annotations()
    return {"ec": ec, "dd": data_descriptor, "anno": anno}
コード例 #4
0
def get_metadata(dd_stream_name: str, input_streams: dict,
                 config: dict) -> dict:
    """

    :param dd_stream_name:
    :param input_streams:
    :param config:
    :return:
    """
    if dd_stream_name == config["stream_names"]["phone_battery_marker"]:
        input_param = {
            "window_size":
            config["general"]["window_size"],
            "phone_powered_off_threshold":
            config["battery_marker"]["phone_powered_off"],
            "phone_battery_down_threshold":
            config["battery_marker"]["phone_battery_down"]
        }
    elif dd_stream_name == config["stream_names"]["autosense_battery_marker"]:
        input_param = {
            "window_size":
            config["general"]["window_size"],
            "autosense_powered_off_threshold":
            config["battery_marker"]["autosense_powered_off"],
            "autosense_battery_down_threshold":
            config["battery_marker"]["autosense_battery_down"]
        }
    elif dd_stream_name == config["stream_names"]["motionsense_hrv_battery_right_marker"] or dd_stream_name == \
            config["stream_names"]["motionsense_hrv_battery_left_marker"]:
        input_param = {
            "window_size":
            config["general"]["window_size"],
            "motionsense_powered_off_threshold":
            config["battery_marker"]["motionsense_powered_off"],
            "motionsense_battery_down_threshold":
            config["battery_marker"]["motionsense_battery_down"]
        }
    else:
        raise ValueError("Incorrect sensor type")

    data_descriptor = {
        "NAME":
        dd_stream_name,
        "DATA_TYPE":
        "int",
        "DESCRIPTION":
        "Labels - Powered off" + str(config["labels"]["powered_off"]) +
        ", Battery down" + str(config["labels"]["battery_down"])
    }
    algo_description = config["description"]["battery_data_marker"]
    method = 'cerebralcortex.data_processor.data_diagnostic.battery_data_marker.py'
    ec = get_execution_context(dd_stream_name, input_param, input_streams,
                               method, algo_description, config)
    anno = get_annotations()
    return {"ec": ec, "dd": data_descriptor, "anno": anno}
コード例 #5
0
def get_metadata(dd_stream_name: str, input_streams: dict,
                 config: dict) -> dict:
    """
    :param generated_stream_id:
    :param dd_stream_name:
    :param input_streams:
    :param config:
    :return:
    """
    if dd_stream_name == config["stream_names"][
            "autosense_rip_attachment_marker"]:
        input_param = {
            "window_size":
            config["general"]["window_size"],
            "onbody_threshold":
            config["attachment_marker"]["rip_on_body"],
            "improper_attachment":
            config["attachment_marker"]["improper_attachment"]
        }
        data_descriptor = {
            "NAME":
            dd_stream_name,
            "DATA_TYPE":
            "int",
            "DESCRIPTION":
            "Attachment labels: Improper attachment: " +
            str(config["labels"]["rip_improper_attachment"]) + ", Offbody: " +
            str(config["labels"]["rip_off_body"]) + ", Onbody: " +
            str(config["labels"]["rip_on_body"])
        }
    elif dd_stream_name == config["stream_names"][
            "autosense_ecg_attachment_marker"]:
        input_param = {
            "window_size":
            config["general"]["window_size"],
            "ecg_vairance_threshold":
            config["attachment_marker"]["ecg_on_body"],
            "improper_attachment":
            config["attachment_marker"]["improper_attachment"]
        }
        data_descriptor = {
            "NAME":
            dd_stream_name,
            "DATA_TYPE":
            "int",
            "DESCRIPTION":
            "Attachment labels: Improper attachment: " +
            str(config["labels"]["ecg_improper_attachment"]) + ", Offbody: " +
            str(config["labels"]["ecg_off_body"]) + ", Onbody: " +
            str(config["labels"]["ecg_on_body"])
        }
    elif dd_stream_name == config["stream_names"]["motionsense_hrv_right_attachment_marker"] or dd_stream_name == \
            config["stream_names"]["motionsense_hrv_left_attachment_marker"]:
        input_param = {
            "window_size":
            config["general"]["window_size"],
            "motionsense_improper_attachment_threshold":
            config["attachment_marker"]["motionsense_improper_attachment"],
            "motionsense_onbody_threshold":
            config["attachment_marker"]["motionsense_onbody"],
            "motionsense_offbody_threshold":
            config["attachment_marker"]["motionsense_offbody"]
        }
        data_descriptor = {
            "NAME":
            dd_stream_name,
            "DATA_TYPE":
            "int",
            "DESCRIPTION":
            "Attachment labels: Improper attachment: " +
            str(config["labels"]["motionsense_improper_attachment"]) +
            ", Offbody: " + str(config["labels"]["motionsense_offbody"]) +
            ", Onbody: " + str(config["labels"]["motionsense_onbody"])
        }
    else:
        raise ValueError("Incorrect sensor type")

    method = 'cerebralcortex.data_processor.data_diagnostic.attachment_marker'
    algo_description = config["description"]["attachment_marker"]
    ec = get_execution_context(dd_stream_name, input_param, input_streams,
                               method, algo_description, config)
    anno = get_annotations()
    return {"ec": ec, "dd": data_descriptor, "anno": anno}