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 e538e64870536898b21782d6e7c8b206efe30ca9..063b15338500e87bead67e27e4c8849431495fcb 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 @@ -47,6 +47,7 @@ from bis_utils import (get_do_not_insert_type_names, return_value_if_not_none, send_mail_with_defaults, SPECIAL_TREATMENT_SAMPLE) +from sample_helpers.sample_upload_get_event import add_event_to_sample from sample_helpers.sample_upload_get_person import get_person from sample_helpers.sample_upload_post_processing import post_process_samples from sample_helpers.utils import get_column_header_name, get_entity_name @@ -383,30 +384,10 @@ def update_sample_records(data, htmluserlog_public): sample = _update_property(entity=sample, property_id=db.get_entity_by_name("PI").id, property_name="PI", value=get_person(row["PI"])) - if "Nagoya case number" in row and return_value_if_not_none(row["Nagoya case number"]) is not None: - sample = _update_property(entity=sample, property_id=nagoya_case_property_id, - property_name="NagoyaCase", - value=get_nagoya_case(row)) if "Storage ID" in row and return_value_if_not_none(row["Storage ID"]) is not None: sample = _update_property(entity=sample, property_id=container_property_id, property_name="Container", value=get_container(row)) - if "Collection" in row and return_value_if_not_none(row["Collection"]) is not None: - sample = _update_property(entity=sample, - property_id=db.get_entity_by_name("Collection").id, - property_name="Collection", - datatype=db.LIST("Collection"), - value=[db.Record(name=el) - .add_parent(name="Collection") - for el in row["Collection"]]) - if "Sphere" in row and return_value_if_not_none(row["Sphere"]) is not None: - sample = _update_property(entity=sample, - property_id=db.get_entity_by_name("Sphere").id, - property_name="Sphere", - datatype=db.LIST("Sphere"), - value=[db.Record(name=el) - .add_parent(name="Sphere") - for el in row["Sphere"]]) if "PDFReport" in data.columns: sample = _update_property( @@ -435,6 +416,7 @@ def update_sample_records(data, htmluserlog_public): entity=sample, property_id=additional_property_ids[property_name], value=value, property_name=property_name) + sample = add_event_to_sample(sample, row) samples.append(sample) samples = post_process_samples(samples, data) diff --git a/sample-management-custom/caosdb-server/scripting/bin/sample_helpers/sample_upload_get_event.py b/sample-management-custom/caosdb-server/scripting/bin/sample_helpers/sample_upload_get_event.py index a14987626483078ce1fb389574e5f907124b2f92..aa624989c49f0fc0cb464a7b5b1ee655b8e14a75 100644 --- a/sample-management-custom/caosdb-server/scripting/bin/sample_helpers/sample_upload_get_event.py +++ b/sample-management-custom/caosdb-server/scripting/bin/sample_helpers/sample_upload_get_event.py @@ -31,7 +31,7 @@ def add_event_to_sample(sample: db.Record, data: pd.Series) -> db.Record: """ _perform_sanity_checks(sample, data) - + # TODO Add event-specific columns return sample