From b467d24ec828d54ae15fd31ca928ad4dbc8fa3a5 Mon Sep 17 00:00:00 2001 From: tm689 <tm689@cam.ac.uk> Date: Wed, 10 May 2023 12:11:09 +0100 Subject: [PATCH] Fix: folder creation and messaging fix. - Always create ExportCSV folder if it is not exist to allow merging. - Correcting messages to not have ODK as the default download. - Add ProcessorSurveysWRT import. --- coordinator/ProcessorSurveys.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/coordinator/ProcessorSurveys.py b/coordinator/ProcessorSurveys.py index d67b2ba..28661c9 100644 --- a/coordinator/ProcessorSurveys.py +++ b/coordinator/ProcessorSurveys.py @@ -18,6 +18,7 @@ from source_gen.clustering import run_case from ProcessorSurveysODK import get_ODK_form_as_csv from ProcessorSurveyskobotoolbox import get_kobotoolbox_form_as_csv from ProcessorSurveysWRSIS import get_WRSIS_form_as_csv +from ProcessorSurveysWRT import get_WRT_form_as_csv from ProcessorUtils import ( subprocess_and_log, endJob, @@ -30,7 +31,8 @@ add_filters_to_sublogger(logger) GET_FORM_AS_CSV_DICT = { 'ODK' : get_ODK_form_as_csv, 'kobotoolbox' : get_kobotoolbox_form_as_csv, - 'WRSIS' : get_WRSIS_form_as_csv + 'WRSIS' : get_WRSIS_form_as_csv, + 'WRT' : get_WRT_form_as_csv } def process_pre_job_survey(input_args): @@ -154,13 +156,14 @@ def process_in_job_survey(jobPath,status,config,component): dfm = concat([dfm,dfi],axis='rows') # save the result - ODK_csv_path = f"{jobPath}/ExportCSV/" - forms_fn = f"{ODK_csv_path}/Merged_SurveyData.csv" + Export_csv_path = f"{jobPath}/ExportCSV/" + Path(Export_csv_path).mkdir(parents = True, exist_ok = True) + forms_fn = f"{Export_csv_path}/Merged_SurveyData.csv" dfm.to_csv(forms_fn,index=False,quoting=csv.QUOTE_MINIMAL) - logger.debug(f"Preparing to apply removals and additions to ODK survey data") + logger.debug(f"Preparing to apply removals and additions to survey data") - processed_surveys_filepath = f"{ODK_csv_path}/Processed_SurveyData.csv" + processed_surveys_filepath = f"{Export_csv_path}/Processed_SurveyData.csv" survey_errors_to_remove_filepath = f"{config['ResourcesPath']}/coordinator/assets/SURVEYDATA_MANUAL/SurveyDataErrorsToRemove.csv" survey_additions_filepath = f"{config['ResourcesPath']}/coordinator/assets/SURVEYDATA_MANUAL/LIVE_SURVEYDATA_TOUSE.csv" -- GitLab