From dc1aebc50160698295b53ef9d7b4e280e7a2194e Mon Sep 17 00:00:00 2001 From: Florian Spreckelsen <f.spreckelsen@indiscale.com> Date: Wed, 29 Jan 2025 15:15:31 +0100 Subject: [PATCH] ENH: Addapt upload sample script to configurable column names --- .../caosdb-server/scripting/bin/upload_sample_template.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sample-management-custom/caosdb-server/scripting/bin/upload_sample_template.py b/sample-management-custom/caosdb-server/scripting/bin/upload_sample_template.py index 7d71282..484e651 100755 --- a/sample-management-custom/caosdb-server/scripting/bin/upload_sample_template.py +++ b/sample-management-custom/caosdb-server/scripting/bin/upload_sample_template.py @@ -42,7 +42,7 @@ from caoscrawler.logging import configure_server_side_logging from bis_utils import (replace_entity_urls_by_ids, SPECIAL_TREATMENT_SAMPLE, whitespace_cleanup_in_df) -from sample_helpers.utils import CONSTANTS +from sample_helpers.utils import CONSTANTS, get_column_header_name # suppress warning of diff function apilogger = logging.getLogger("linkahead.apiutils") @@ -66,7 +66,7 @@ def get_parser(): def _is_child_sample_table(filename): tmp_data = pd.read_csv(filename, sep=',') if 'Parent BIS ID' in tmp_data.columns: - return not tmp_data["Parent BIS ID"].isnull().all() + return not tmp_data[get_column_header_name("Parent LinkAhead ID")].isnull().all() return False @@ -171,7 +171,8 @@ def main(): OBLIGATORY_COLUMNS.append(property_name) try: data = read_data_from_file(path) - data = replace_entity_urls_by_ids(data, ["BIS ID", "Storage ID", "Parent BIS ID"]) + data = replace_entity_urls_by_ids(data, [get_column_header_name(name) for name in [ + "entity_id", "Storage ID", "Parent LinkAhead ID"]]) pickle_out = NamedTemporaryFile(delete=False, suffix=".pkl") data.to_pickle(pickle_out.name) except DataInconsistencyError as err: -- GitLab