From 78e5b686d66f452a81ca35d16f3956f61bc848f5 Mon Sep 17 00:00:00 2001
From: jws52 <jws52@cam.ac.uk>
Date: Thu, 21 Mar 2024 15:40:19 +0000
Subject: [PATCH] feat: Handle dynamic host capability

...to reflect recent changes in ews-source-calc commit e162c48.
---
 coordinator/ProcessorSurveys.py                      |  8 ++++++--
 .../configs/config_EastAfrica_fc_live.json           |  2 ++
 .../configs/config_EastAfrica_mapspam2017.json       | 12 ++++++------
 3 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/coordinator/ProcessorSurveys.py b/coordinator/ProcessorSurveys.py
index 1a30d17..a215b99 100644
--- a/coordinator/ProcessorSurveys.py
+++ b/coordinator/ProcessorSurveys.py
@@ -339,8 +339,10 @@ class ProcessorSurveys(Processor):
                 Path(output_directory).mkdir(parents=True, exist_ok=True)
 
                 sources_path = run_case(
-                        config_path = config['Survey']['pySourcesConfigFilename'],
+                        config_path = config['Survey']['SourcesConfigFilename'],
                         survey_path = group_surveys_filepath,
+                        survey_format = config['Survey']['SurveyFormat'],
+                        surveyor_name_col = config['Survey']['SurveyorNameCol'],
                         reference_date = config['StartString'],
                         # Day 0 (current day) is always included
                         # Days -2,-1 and 0 are needed to initialise spores in NAME
@@ -376,8 +378,10 @@ class ProcessorSurveys(Processor):
             Path(output_directory).mkdir(parents=True, exist_ok=True)
 
             sources_path = run_case(
-                    config_path = config['Survey']['pySourcesConfigFilename'],
+                    config_path = config['Survey']['SourcesConfigFilename'],
                     survey_path = processed_surveys_filepath,
+                    survey_format = config['Survey']['SurveyFormat'],
+                    surveyor_name_col = config['Survey']['SurveyorNameCol'],
                     reference_date = config['StartString'],
                     # Day 0 (current day) is always included
                     # Days -2,-1 and 0 are needed to initialise spores in NAME
diff --git a/tests/test_data/test_deployment/regions/EastAfrica/resources/coordinator/configs/config_EastAfrica_fc_live.json b/tests/test_data/test_deployment/regions/EastAfrica/resources/coordinator/configs/config_EastAfrica_fc_live.json
index 9f067de..1f0e3cb 100644
--- a/tests/test_data/test_deployment/regions/EastAfrica/resources/coordinator/configs/config_EastAfrica_fc_live.json
+++ b/tests/test_data/test_deployment/regions/EastAfrica/resources/coordinator/configs/config_EastAfrica_fc_live.json
@@ -41,6 +41,8 @@
         },
         "GroupBy" : ["Origin"],
         "GroupsToIgnore" : ["ODK-server", "kobo-server", "newODK", "newODK2", "CSV-CAM"],
+        "SurveyFormat" : "ODK",
+        "SurveyorNameCol" : "surveyor_infromation-surveyor_name",
         "SourcesRegionName" : "EastAfrica",
         "SourcesConfigFilename" : "../../test_data/test_deployment/regions/EastAfrica/resources/source_gen/configs/config_EastAfrica_mapspam2017.json"
     },
diff --git a/tests/test_data/test_deployment/regions/EastAfrica/resources/source_gen/configs/config_EastAfrica_mapspam2017.json b/tests/test_data/test_deployment/regions/EastAfrica/resources/source_gen/configs/config_EastAfrica_mapspam2017.json
index 1360f7f..1359623 100644
--- a/tests/test_data/test_deployment/regions/EastAfrica/resources/source_gen/configs/config_EastAfrica_mapspam2017.json
+++ b/tests/test_data/test_deployment/regions/EastAfrica/resources/source_gen/configs/config_EastAfrica_mapspam2017.json
@@ -1,13 +1,13 @@
 {
     "config_name" : "EastAfrica",
-    "region_file" : "../../test_data/test_deployment/regions/EastAfrica/resources/source_gen/assets/boundaries/EastAfrica_regions_small.shp",
     "wheat_source_name" : "MAPSPAM2017",
-    "wheat_file" : "../../test_data/test_deployment/regions/EastAfrica/resources/source_gen/assets/spam2017V1r1_SSA_gr_H_WHEA_A.tif",
-    "wheat_file_rescaled" : "../../test_data/test_deployment/regions/EastAfrica/resources/source_gen/assets/preprocessed/spam2017V1r1_SSA_gr_H_WHEA_A_rescaled_oneliner.tif",
-    "cluster_poly_file_no_wheat" : "../../test_data/test_deployment/regions/EastAfrica/resources/source_gen/assets/boundaries/EastAfrica_clusters.shp",
-    "cluster_poly_file" : "../../test_data/test_deployment/regions/EastAfrica/resources/source_gen/assets/preprocessed/EastAfrica_clusters_with_wheat_ha_MAPSPAM2017.shp",
-    "surveyor_name_col" : "surveyor_infromation-surveyor_name",
+    "wheat_file" : "NA",
+    "wheat_rasters_bydate" : {
+        "20170101" : "../../test_data/test_deployment/regions/EastAfrica/resources/source_gen/assets/spam2017V1r1_SSA_gr_H_WHEA_A_small.tif"
+    },
+    "cluster_poly_file" : "../../test_data/test_deployment/regions/EastAfrica/resources/source_gen/assets/boundaries/EastAfrica_clusters_small.shp",
     "id_col" : "id",
+    "region_file" : "../../test_data/test_deployment/regions/EastAfrica/resources/source_gen/assets/boundaries/EastAfrica_regions_small.shp",
     "region_id_col" : "REGION_ID",
     "wheat_stages_file" : "../../test_data/test_deployment/regions/EastAfrica/resources/source_gen/assets/approx_growth_timing_cleaned.csv"
 }
-- 
GitLab