From 4249ad41a58e981066656060222c1bd80196c2e6 Mon Sep 17 00:00:00 2001
From: Jake Smith <jws52@cam.ac.uk>
Date: Mon, 24 Oct 2022 14:20:26 +0100
Subject: [PATCH] fix: Do not guess epi input file listers

Because of changes to EpiPrepLister in the last few months, the file listers have changed name and are too complicated to guess. Now, it will be necessary for the user to specify them in the input config file. EpiPrepLister's docstring will have to guide the user clearly enough.
---
 coordinator/ProcessorEpidemiology.py | 34 ++++------------------------
 1 file changed, 4 insertions(+), 30 deletions(-)

diff --git a/coordinator/ProcessorEpidemiology.py b/coordinator/ProcessorEpidemiology.py
index 76daa9f..2266228 100644
--- a/coordinator/ProcessorEpidemiology.py
+++ b/coordinator/ProcessorEpidemiology.py
@@ -210,18 +210,8 @@ def process_in_job_epi(jobPath,status,config,component):
 
         config_epi['Deposition']['FileNamePrepared'] = f"{jobDataPath}/data_input_deposition.csv"
 
-        # Use config-defined file lister in config file instead of here
-        file_lister_dep_name = config_epi['Deposition'].get('FileListerFunction',None)
-
-        # when it isn't defined, guess what it should be
-        if file_lister_dep_name is None:
-
-            file_lister_dep_name = 'list_deposition_files_operational'
-
-            if date_diff > datetime.timedelta(days=7):
-
-                file_lister_dep_name = 'list_deposition_files_historical'
-                logger.info('Using historical method to prepare data on spore deposition')
+        # Use config-defined file lister
+        file_lister_dep_name = config_epi['Deposition']['FileListerFunction']
 
         file_lister_dep = getattr(EpiPrepLister,file_lister_dep_name)
 
@@ -317,24 +307,8 @@ def process_in_job_epi(jobPath,status,config,component):
 
             config_epi['Environment']['FileNamePrepared'] = f"{jobDataPath}/data_input_environment.csv"
 
-            # Use config-defined file lister in config file instead of here
-            file_lister_env_name = config_epi['Environment'].get('FileListerFunction',None)
-
-            # when it isn't defined, guess what it should be
-            if file_lister_env_name is None:
-
-                use_monthly_chunk=False # hard-coded for historical analysis
-                file_lister_env_name = 'list_env_suit_files_operational'
-
-                if (date_diff > datetime.timedelta(days=7)) & ('ENVIRONMENT_2.0' in config_epi['Environment']['PathTemplate']) & use_monthly_chunk:
-
-                    logger.info('Using monthly-chunk method to prepare data on environmental suitability')
-                    file_lister_env_name = 'list_env_suit_files_historical_monthlychunk'
-
-                elif date_diff > datetime.timedelta(days=7):
-
-                    logger.info('Using historical method to prepare data on environmental suitability')
-                    file_lister_env_name = 'list_env_suit_files_historical'
+            # Use config-defined file lister
+            file_lister_env_name = config_epi['Environment']['FileListerFunction']
 
             file_lister_env = getattr(EpiPrepLister,file_lister_env_name)
 
-- 
GitLab