Skip to content

Fix "method_complexity" issue in project/main/data/processed_measurement.py #104

Description

@SabCampos

The processed_measurement.py file contains the endpoints to which our IoT devices (qHAWAX) make their requests. The frequency varies depending on the type of the device. Static devices send between every 25 to 30 seconds, mobile devices send between every 4 to 6 seconds.

CodeClimate has found the following issue:
Function handleProcessedDataByMobileQhawax has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.

The function is defined in a POST endpoint that receives the following parameters in data_json:

          data_json = {"CO": 10000,"CO_ug_m3": 8000, "H2S_ug_m3": 43.404,"H2S": 43.404, "NO2": 100.78,"NO2_ug_m3": 19.78,
                   "O3": 40.126,"O3_ug_m3": 3.126,"VOC":0, "CO2":1,"SO2": 4.388,"SO2_ug_m3": 4.388, "PM10": 35.349,"PM25": 11.678,"UVA":1,
                   "UVB":1,"alt": 0.0,"lat": -12.0402780000002,"lon": -77.0436090000003,"PM1":1,"timestamp": "2021-05-19 07:56:08-05:00",
                   "ID":"qH022","pressure":10,"humidity":25,"I_temperature":25,"temperature":21,"spl":1,"UV":1}

Source: https://codeclimate.com/github/qAIRa/qAIRaMapAPI-OpenSource/project/main/data/processed_measurement.py/source#issue-191e2b2e7e1e47a0390be28d1f09407f

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions