def check_payload_for_outliers()

in greengrass-v2/poll-api/artifacts/com.greengrass.ProcessApiStream/1.0.0/process.py [0:0]


def check_payload_for_outliers(payload_dict, check_field_number, check_field_min_value, check_field_max_value):
    found_high = False
    found_low = False

    for key, value in payload_dict['device_data']['points'].items():
        if not type(value) is list:
            # Ignore this value since it isn't a list
            continue

        for item in value:
            value_to_check = item[check_field_number]

            if value_to_check < check_field_min_value:
                found_low = True

            if value_to_check > check_field_max_value:
                found_high = True

            if found_high and found_low:
                # If we found both a high and low value then we can stop looking
                break

    return found_high, found_low