From e0df579939a2b8c17966cf38f27dd3db038521d1 Mon Sep 17 00:00:00 2001 From: khaledk2 Date: Fri, 15 Nov 2024 19:50:00 +0000 Subject: [PATCH] fix issue of indexing from csv in case of the key is not avaliable --- .../cache_functions/elasticsearch/transform_data.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/omero_search_engine/cache_functions/elasticsearch/transform_data.py b/omero_search_engine/cache_functions/elasticsearch/transform_data.py index 748f5e0..2428e73 100644 --- a/omero_search_engine/cache_functions/elasticsearch/transform_data.py +++ b/omero_search_engine/cache_functions/elasticsearch/transform_data.py @@ -232,7 +232,7 @@ def prepare_images_data(data, data_source, doc_type): elif rcd == "data_source": row_to_insert[rcd] = data_source else: - row_to_insert[rcd] = row[rcd] + row_to_insert[rcd] = row.get(rcd) row_to_insert["key_values"] = [] data_to_be_inserted[row["id"]] = row_to_insert @@ -289,9 +289,9 @@ def prepare_data(data, data_source, doc_type): key_value = row_to_insert["key_values"] key_value.append( { - "name": row["mapvalue_name"], - "value": row["mapvalue_value"], - "index": row["mapvalue_index"], + "name": row.get("mapvalue_name"), + "value": row.get("mapvalue_value"), + "index": row.get("mapvalue_index"), } )