Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
LinkAhead Sample Management
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
LinkAhead Sample Management
Commits
e8009701
Commit
e8009701
authored
1 month ago
by
Florian Spreckelsen
Browse files
Options
Downloads
Patches
Plain Diff
WIP: Remove some entries from sample exporter
parent
a447505b
No related branches found
Branches containing commit
No related tags found
1 merge request
!1
F awi sams
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
sample-management-custom/caosdb-server/scripting/bin/export_sample_csv.py
+1
-54
1 addition, 54 deletions
...t-custom/caosdb-server/scripting/bin/export_sample_csv.py
with
1 addition
and
54 deletions
sample-management-custom/caosdb-server/scripting/bin/export_sample_csv.py
+
1
−
54
View file @
e8009701
...
...
@@ -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
"
]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment