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

WIP: Remove some entries from sample exporter

parent a447505b
No related branches found
No related tags found
1 merge request!1F awi sams
......@@ -63,19 +63,6 @@ ERROR_PREFIX = 'Something went wrong: '
ERROR_SUFFIX = ' Please conatct <a href="mailto:biosamples@geomar.de">biosamples@geomar.de</a> if you encounter this issue.'
# Declare mapping of different time/date column names to property names
TIME_NAME_MAPPINGS = {
"date collected start": "time start",
"time collected start": "time start",
"date collected stop": "time stop",
"time collected stop": "time stop",
"date sampled start": "time sampled start",
"time sampled start": "time sampled start",
"date sampled stop": "time sampled stop",
"time sampled stop": "time sampled stop",
}
def cached_record(i):
return cached_get_entity_by(eid=i)
......@@ -212,29 +199,6 @@ def extract_date_time(record, p):
return extract_value_as_list(record, p)
def extract_date(record, key):
if key.lower() in TIME_NAME_MAPPINGS.keys():
time_key = TIME_NAME_MAPPINGS[key.lower()]
else:
time_key = key
date_times = extract_date_time(record, time_key)
return [isoparse(t).date().isoformat() for t in date_times]
def extract_time(record, key):
if key.lower() in TIME_NAME_MAPPINGS.keys():
time_key = TIME_NAME_MAPPINGS[key.lower()]
else:
time_key = key
date_times = extract_date_time(record, time_key)
return [isoparse(t).time().isoformat() for t in date_times]
def extract_time_zone(record, key):
date_times = extract_date_time(record, "Time start")
return [isoparse(t).tzname() for t in date_times]
def extract_station_number(record, key):
source_ev = retrieve_source_event(record)
return [e.get_property(key).value for e in source_ev if
......@@ -377,7 +341,7 @@ def extract_event_url(record, key):
return None
# must be same keys as SPECIAL_TREATMENT
# must include all keys from SPECIAL_TREATMENT
EXTRACTORS = {
"BIS ID": lambda record, key: record.id,
"Parent BIS ID": extract_parent_sample,
......@@ -399,11 +363,6 @@ EXTRACTORS = {
"Nagoya case number": extract_nagoya_case_number,
"PDFReport": extract_pdf_id,
"Subevent": extract_source_event_name,
"Time collected start": extract_time,
"Time collected stop": extract_time,
"Time sampled start": extract_time,
"Time sampled stop": extract_time,
"Timezone": extract_time_zone,
"Station ID": extract_station_id,
"Station number": extract_station_number,
"Sampling depth start": extract_sampling_depth_start,
......@@ -436,14 +395,9 @@ REVERSE_COLUMN_CONVERTER = {
# List of sample properties to be ignored because they are treated
# otherwise. Similar, but not identical to SPECIAL TREATMENT.
IGNORE_KEYS = [
"NagoyaCase",
"Parent Sample",
"Container",
"SourceEvent",
"Event",
"Date",
"Sampling depth",
"Water depth"
]
# Additional list of keys to be ignored when extracting parent sample information
......@@ -455,15 +409,8 @@ IGNORE_KEYS_PARENT = IGNORE_KEYS + [
# the import.
ADDITIONAL_EXPORTS = [
"BIS URL",
"Date sampled start",
"Date sampled stop",
"IGSN URL",
"IGSN",
"Parent BIS ID",
"Storage chain",
"Time sampled start",
"Time sampled stop",
"URL SourceEvent"
]
......
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