From 1c8aef7183bbca12ace16ac43b4887ea2e9cb4d4 Mon Sep 17 00:00:00 2001
From: Florian Spreckelsen <f.spreckelsen@indiscale.com>
Date: Mon, 27 Jan 2025 13:15:28 +0100
Subject: [PATCH] ENH: Add sample post-processing dummy

---
 .../scripting/bin/register_new_samples.py     |  9 ++++---
 .../sample_registration_post_processing.py    | 26 +++++++++++++++++++
 2 files changed, 32 insertions(+), 3 deletions(-)
 create mode 100644 sample-management-custom/caosdb-server/scripting/bin/sample_helpers/sample_registration_post_processing.py

diff --git a/sample-management-custom/caosdb-server/scripting/bin/register_new_samples.py b/sample-management-custom/caosdb-server/scripting/bin/register_new_samples.py
index 7724b57..5ce3110 100755
--- a/sample-management-custom/caosdb-server/scripting/bin/register_new_samples.py
+++ b/sample-management-custom/caosdb-server/scripting/bin/register_new_samples.py
@@ -11,10 +11,12 @@ from caosadvancedtools.serverside.logging import configure_server_side_logging
 from bis_utils import (create_email_with_link_text,
                        get_description_row, get_email_from_username,
                        get_options_row, send_mail_with_defaults)
+from sample_helpers.sample_registration_post_processing import post_process_samples
+from sample_helpers.utils import CONSTANTS, get_column_header_name, get_entity_name
+
+ERROR_PREFIX = CONSTANTS["error_prefix"]
+ERROR_SUFFIX = CONSTANTS["error_suffix"]
 
-ERROR_PREFIX = 'Something went wrong: '
-ERROR_SUFFIX = ' Please conatct <a href="mailto:biosamples@geomar.de">biosamples@geomar.de</a> if you encounter this issue.'
-BIS_URL = 'https://localhost:10443/Entity/'
 logger = logging.getLogger("caosadvancedtools")
 
 
@@ -75,6 +77,7 @@ def create_sample_entities(data):
         if add_state:
             sample.state = db.State(name="Registered", model="Sample life-cycle")
         batch += [sample]
+    batch = post_process_samples(batch)
     batch.insert()
     return batch
 
diff --git a/sample-management-custom/caosdb-server/scripting/bin/sample_helpers/sample_registration_post_processing.py b/sample-management-custom/caosdb-server/scripting/bin/sample_helpers/sample_registration_post_processing.py
new file mode 100644
index 0000000..6d8fe9d
--- /dev/null
+++ b/sample-management-custom/caosdb-server/scripting/bin/sample_helpers/sample_registration_post_processing.py
@@ -0,0 +1,26 @@
+#
+# Copyright (C) 2025 Indiscale GmbH <info@indiscale.com>
+# Copyright (C) 2025 Florian Spreckelsen <f.spreckelsen@indiscale.com>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+#
+import linkahead as db
+
+
+def post_process_samples(samples: db.Container) -> db.Container:
+    """Post process the container of samples to be registerd before
+    they are inserted.  Dummy function to be overwritten.
+
+    """
+    return samples
-- 
GitLab