diff --git a/coordinator/ProcessorSurveysWRT.py b/coordinator/ProcessorSurveysWRT.py index 62b86da18ec3172b5fdad475f3d12fbe39be7340..f3a6d6acef728e5b142353b1c7c05e0cd80c5227 100644 --- a/coordinator/ProcessorSurveysWRT.py +++ b/coordinator/ProcessorSurveysWRT.py @@ -114,7 +114,6 @@ def nested_to_flattened(df): 'live_stemrust_samples_count', 'dead_yellowrust_samples_count', 'SET-OF-live_leafrust_samples', - 'KEY', 'other_diseases_group-other_diseases', 'survey_infromation-location-Altitude', 'SET-OF-dead_stemrust_samples', @@ -234,7 +233,11 @@ def get_WRT_form_as_csv(form_credentials: dict, jobPath: str, config: dict, stat logger.debug('Saving raw csv file') df_raw_filename = f"{output_path}/{csv_filename}" - dataframe_raw = json_normalize(request.json()["listObservation"]) + # if request is not empty, than convert it to a normalized dataframe, otherwise create an empty dataframe + if request.status_code == 200: + dataframe_raw = json_normalize(request.json()["listObservation"]) + if request.status_code == 204: + dataframe_raw = json_normalize([]) dataframe_raw.to_csv(df_raw_filename,index=False,quoting=csv.QUOTE_MINIMAL)