From b8403ed3c34c77692a6151d2ca75feb63800d255 Mon Sep 17 00:00:00 2001 From: Florian Spreckelsen <f.spreckelsen@indiscale.com> Date: Fri, 21 Mar 2025 10:53:40 +0100 Subject: [PATCH] FEAT(export_sample_csv): Export sample names --- .../caosdb-server/scripting/bin/export_sample_csv.py | 6 ++++++ .../scripting/bin/sample_helpers/default_constants.yml | 2 ++ .../bin/sample_helpers/sample_upload_column_definitions.py | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/sample-management-custom/caosdb-server/scripting/bin/export_sample_csv.py b/sample-management-custom/caosdb-server/scripting/bin/export_sample_csv.py index 085c839..885fb55 100755 --- a/sample-management-custom/caosdb-server/scripting/bin/export_sample_csv.py +++ b/sample-management-custom/caosdb-server/scripting/bin/export_sample_csv.py @@ -335,6 +335,11 @@ def extract_event_url(record, key): return None +def extract_sample_name(record, key): + + return record.name + + # must include all keys from SPECIAL_TREATMENT EXTRACTORS = use_custom_names({ "entity_id": lambda record, key: record.id, @@ -356,6 +361,7 @@ EXTRACTORS = use_custom_names({ "Longitude stop": extract_lng_stop, "PDFReport": extract_pdf_id, "PI": extract_person, + "sample_name": extract_sample_name, "Sampling method": default_find, "Sphere": extract_sphere, "Start date": extract_start_date, 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 c575cb6..136d9ee 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 @@ -25,6 +25,7 @@ csv_column_names: locality_name_prop: "Locality name" responsible_person_event: "Event responsible" parent_sample_prop: "Parent LinkAhead ID" + sample_name: "Sample name" csv_column_descriptions: LinkAhead ID: "An ID generated by LinkAhead (either integer or URL to this entity). Do not change this column!" @@ -52,6 +53,7 @@ csv_column_descriptions: Timezone: "Timezone: Either UTC, CET, .... or in the form +hh[:mm], -hh:[mm]." Water depth start: "The bottom depth in meters where the sampling started as a positive value" Water depth stop: "The bottom depth in meters where the sampling ended as a positive value" + Sample name: "Name which will be given to the sample entity" entity_names: abbreviation_prop: abbreviation diff --git a/sample-management-custom/caosdb-server/scripting/bin/sample_helpers/sample_upload_column_definitions.py b/sample-management-custom/caosdb-server/scripting/bin/sample_helpers/sample_upload_column_definitions.py index 0584522..1ad1ade 100644 --- a/sample-management-custom/caosdb-server/scripting/bin/sample_helpers/sample_upload_column_definitions.py +++ b/sample-management-custom/caosdb-server/scripting/bin/sample_helpers/sample_upload_column_definitions.py @@ -79,7 +79,6 @@ DATATYPE_DEFINITIONS = use_custom_names({ # Must exist OBLIGATORY_COLUMNS = use_custom_names([ "entity_id", - "Start date", ]) OBLIGATORY_COLUMNS_CHILD = use_custom_names([ @@ -118,6 +117,7 @@ SPECIAL_TREATMENT_SAMPLE = use_custom_names([ "PI", "PDFReport", "parent_sample_prop", + "sample_name", "Sphere", "Start date", "Storage ID", -- GitLab