FAQ | This is a LIVE service | Changelog

Skip to content
Snippets Groups Projects
Commit 34e55b76 authored by L. Bower's avatar L. Bower
Browse files

Merge remote-tracking branch 'origin/main' into main

parents d8f6227c f45dd933
No related branches found
No related tags found
No related merge requests found
...@@ -104,6 +104,7 @@ def nested_to_flattened(df): ...@@ -104,6 +104,7 @@ def nested_to_flattened(df):
'Rust Details', 'Rust Details',
'Other Disease', 'Other Disease',
'Sample Details', 'Sample Details',
'Survey Details.Survey No',
'Survey Details.Latitude', 'Survey Details.Latitude',
'Survey Details.First Rust Observation Date', 'Survey Details.First Rust Observation Date',
'Survey Details.Longitude', 'Survey Details.Longitude',
...@@ -163,7 +164,6 @@ def nested_to_flattened(df): ...@@ -163,7 +164,6 @@ def nested_to_flattened(df):
'live_stemrust_samples_count', 'live_stemrust_samples_count',
'dead_yellowrust_samples_count', 'dead_yellowrust_samples_count',
'SET-OF-live_leafrust_samples', 'SET-OF-live_leafrust_samples',
'KEY',
'other_diseases_group-other_diseases', 'other_diseases_group-other_diseases',
'survey_infromation-location-Altitude', 'survey_infromation-location-Altitude',
'SET-OF-dead_stemrust_samples', 'SET-OF-dead_stemrust_samples',
...@@ -178,9 +178,6 @@ def nested_to_flattened(df): ...@@ -178,9 +178,6 @@ def nested_to_flattened(df):
for i in NEW_COLUMNS: for i in NEW_COLUMNS:
df[i] = "" df[i] = ""
#TODO: replace with a better KEY column
df["KEY"] = df.index
# add dedicated rust columns, with default values # add dedicated rust columns, with default values
NEW_RUST_COLUMNS = {"Stem Rust.Incident":"none","Stem Rust.Severity":"-9","Stem Rust.Reaction":"na", NEW_RUST_COLUMNS = {"Stem Rust.Incident":"none","Stem Rust.Severity":"-9","Stem Rust.Reaction":"na",
"Leaf Rust.Incident":"none","Leaf Rust.Severity":"-9","Leaf Rust.Reaction":"na", "Leaf Rust.Incident":"none","Leaf Rust.Severity":"-9","Leaf Rust.Reaction":"na",
...@@ -221,6 +218,7 @@ def get_WRSIS_form_as_csv(form_credentials: dict, jobPath: str, config: dict, st ...@@ -221,6 +218,7 @@ def get_WRSIS_form_as_csv(form_credentials: dict, jobPath: str, config: dict, st
'Rust Details' : 'None', 'Rust Details' : 'None',
'Other Disease' : 'None', 'Other Disease' : 'None',
'Sample Details' : 'None', 'Sample Details' : 'None',
'Survey Details.Survey No' : 'KEY',
'Survey Details.Latitude' : 'survey_infromation-location-Latitude', 'Survey Details.Latitude' : 'survey_infromation-location-Latitude',
'Survey Details.First Rust Observation Date' : 'None', 'Survey Details.First Rust Observation Date' : 'None',
'Survey Details.Longitude' : 'survey_infromation-location-Longitude', 'Survey Details.Longitude' : 'survey_infromation-location-Longitude',
......
...@@ -114,7 +114,6 @@ def nested_to_flattened(df): ...@@ -114,7 +114,6 @@ def nested_to_flattened(df):
'live_stemrust_samples_count', 'live_stemrust_samples_count',
'dead_yellowrust_samples_count', 'dead_yellowrust_samples_count',
'SET-OF-live_leafrust_samples', 'SET-OF-live_leafrust_samples',
'KEY',
'other_diseases_group-other_diseases', 'other_diseases_group-other_diseases',
'survey_infromation-location-Altitude', 'survey_infromation-location-Altitude',
'SET-OF-dead_stemrust_samples', 'SET-OF-dead_stemrust_samples',
...@@ -234,7 +233,11 @@ def get_WRT_form_as_csv(form_credentials: dict, jobPath: str, config: dict, stat ...@@ -234,7 +233,11 @@ def get_WRT_form_as_csv(form_credentials: dict, jobPath: str, config: dict, stat
logger.debug('Saving raw csv file') logger.debug('Saving raw csv file')
df_raw_filename = f"{output_path}/{csv_filename}" 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) dataframe_raw.to_csv(df_raw_filename,index=False,quoting=csv.QUOTE_MINIMAL)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment