From 9f0ecc0e440d0f18b02d027aab590ff1f75ae641 Mon Sep 17 00:00:00 2001
From: Florian Spreckelsen <f.spreckelsen@indiscale.com>
Date: Thu, 30 Jan 2025 16:30:24 +0100
Subject: [PATCH] MAINT: Remove geomar specific time properties

---
 models_and_helper_scripts/sample-management-datamodel.yml | 8 ++------
 .../scripting/bin/crawl_sample_data_async.py              | 6 ------
 .../scripting/bin/sample_helpers/default_constants.yml    | 2 ++
 3 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/models_and_helper_scripts/sample-management-datamodel.yml b/models_and_helper_scripts/sample-management-datamodel.yml
index 8067eac..d769e01 100644
--- a/models_and_helper_scripts/sample-management-datamodel.yml
+++ b/models_and_helper_scripts/sample-management-datamodel.yml
@@ -97,10 +97,6 @@ Sample:
       datatype: TEXT
     Notes:
       datatype: TEXT
-    Time sampled start:
-      datatype: DATETIME
-    Time sampled stop:
-      datatype: DATETIME
     AphiaID:
       description: An ID for this taxon that allows to uniquely identify it on http://www.marinespecies.org.
       datatype: INTEGER
@@ -171,11 +167,11 @@ Event:
   obligatory_properties:
     Gear:
   recommended_properties:
-    Time start:
+    start_date:
       description: The date and time the event started.
       datatype: DATETIME
   suggested_properties:
-    Time stop:
+    end_date:
       description: The date and time the event ended.
       datatype: DATETIME
 
diff --git a/sample-management-custom/caosdb-server/scripting/bin/crawl_sample_data_async.py b/sample-management-custom/caosdb-server/scripting/bin/crawl_sample_data_async.py
index 1e17a33..7d99c3a 100755
--- a/sample-management-custom/caosdb-server/scripting/bin/crawl_sample_data_async.py
+++ b/sample-management-custom/caosdb-server/scripting/bin/crawl_sample_data_async.py
@@ -557,15 +557,9 @@ def update_sample_records(data, htmluserlog_public):
                                              .add_parent(name="Sphere")
                                              for el in row["Sphere"]])
 
-        if "Date collected start" in row and return_value_if_not_none(row["Date collected start"]) is not None:
-            sample = _update_property(entity=sample, property_id=event_property_id, property_name='SourceEvent', value=get_event(
-                row, get_gear(row)))
         if "PDFReport" in data.columns:
             sample = _update_property(
                 entity=sample, property_id=pdfreport_property_id, property_name="PDFReport", value=row["PDFReport"])
-        if "Date sampled start" in data.columns:
-            sample = _append_times_to_entity(ent=sample, data=row, propname_prefix="Time sampled",
-                                             colname_time_prefix="Time sampled", colname_date_prefix="Date sampled")
 
         # Add additional properties
         for property_name in additional_property_ids.keys():
diff --git a/sample-management-custom/caosdb-server/scripting/bin/sample_helpers/default_constants.yml b/sample-management-custom/caosdb-server/scripting/bin/sample_helpers/default_constants.yml
index 687b32c..de676e0 100644
--- a/sample-management-custom/caosdb-server/scripting/bin/sample_helpers/default_constants.yml
+++ b/sample-management-custom/caosdb-server/scripting/bin/sample_helpers/default_constants.yml
@@ -58,6 +58,8 @@ entity_names:
   responsible_rt: Responsible
   first_name_prop: first_name
   last_name_prop: last_name
+  start_date_prop: start_date
+  end_date_prop: end_date
 
 error_prefix: "Something went wrong:"
 error_suffix: "Please contact your administrator(s)."
-- 
GitLab