Skip to content
Snippets Groups Projects
Commit 6cde3c31 authored by Florian Spreckelsen's avatar Florian Spreckelsen
Browse files

ENH: Use separate event-adding module

parent 9e577d31
No related branches found
No related tags found
1 merge request!1F awi sams
......@@ -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)
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment