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
29b2b317
Commit
29b2b317
authored
1 week ago
by
Florian Spreckelsen
Browse files
Options
Downloads
Patches
Plain Diff
FIX(sample_upload): Use correct column names in event sanity checks
parent
cb62744a
No related branches found
Branches containing commit
No related tags found
1 merge request
!2
F sample name
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
sample-management-custom/caosdb-server/scripting/bin/sample_helpers/sample_upload_get_event.py
+15
-14
15 additions, 14 deletions
...r/scripting/bin/sample_helpers/sample_upload_get_event.py
with
15 additions
and
14 deletions
sample-management-custom/caosdb-server/scripting/bin/sample_helpers/sample_upload_get_event.py
+
15
−
14
View file @
29b2b317
...
...
@@ -85,6 +85,7 @@ def add_event_to_sample(sample: db.Record, data: pd.Series) -> db.Record:
# only add if there was any event data at all:
if
len
(
event
.
properties
)
>
0
:
sample
=
update_property
(
sample
,
event_rt
.
id
,
event
,
property_name
=
event_rt
.
name
)
return
sample
...
...
@@ -108,39 +109,39 @@ def _create_position(mode: str, lat: float, lng: float, ele: float):
def
_perform_sanity_checks
(
sample
,
data
):
if
(
get_column_header_name
(
"
end_date
"
)
in
data
and
return_value_if_not_none
(
data
[
get_column_header_name
(
"
end_date
"
)])
is
not
None
):
if
(
get_column_header_name
(
"
start_date
"
)
not
in
data
or
return_value_if_not_none
(
data
[
get_column_header_name
(
"
start_date
"
)])
is
None
):
if
(
get_column_header_name
(
"
end_date
_prop
"
)
in
data
and
return_value_if_not_none
(
data
[
get_column_header_name
(
"
end_date
_prop
"
)])
is
not
None
):
if
(
get_column_header_name
(
"
start_date
_prop
"
)
not
in
data
or
return_value_if_not_none
(
data
[
get_column_header_name
(
"
start_date
_prop
"
)])
is
None
):
raise
DataInconsistencyError
(
f
"
Sample with
{
get_entity_name
(
'
entity_id
'
)
}
{
sample
.
id
}
has a
"
f
"
{
get_column_header_name
(
'
end_date
'
)
}
but no valid
"
f
"
{
get_column_header_name
(
'
start_date
'
)
}
.
"
f
"
{
get_column_header_name
(
'
end_date
_prop
'
)
}
but no valid
"
f
"
{
get_column_header_name
(
'
start_date
_prop
'
)
}
.
"
)
for
name
in
[
"
start
"
,
"
stop
"
]:
bool_list
=
[
get_column_header_name
(
f
"
{
val
}
_
{
name
}
"
)
in
data
for
val
in
[
"
l
atitude
"
,
"
l
ongitude
"
,
"
e
levation
"
]]
bool_list
=
[
get_column_header_name
(
f
"
{
val
}
{
name
}
"
)
in
data
for
val
in
[
"
L
atitude
"
,
"
L
ongitude
"
,
"
E
levation
"
]]
raise_error
=
False
if
any
(
bool_list
):
if
not
all
(
bool_list
):
raise_error
=
True
elif
any
([
return_value_if_not_none
(
data
[
get_column_header_name
(
f
"
{
val
}
_
{
name
}
"
)])
is
None
for
val
in
[
"
l
atitude
"
,
"
l
ongitude
"
,
"
e
levation
"
]]):
elif
any
([
return_value_if_not_none
(
data
[
get_column_header_name
(
f
"
{
val
}
{
name
}
"
)])
is
None
for
val
in
[
"
L
atitude
"
,
"
L
ongitude
"
,
"
E
levation
"
]]):
raise_error
=
True
if
raise_error
:
raise
DataInconsistencyError
(
f
"
Sample with
{
get_
entity
_name
(
'
entity_id
'
)
}
{
sample
.
id
}
has an
"
f
"
Sample with
{
get_
column_header
_name
(
'
entity_id
'
)
}
{
sample
.
id
}
has an
"
f
"
invalid
{
name
}
position. Please make sure that latitude, longitude,
"
"
and elevation are provided.
"
)
# only need to check lat since we already checked that if lat is
# present, lng and ele are present, too
if
(
get_column_header_name
(
"
l
atitude
_
stop
"
)
in
data
and
return_value_if_not_none
(
data
[
get_column_header_name
(
"
l
atitude
_
stop
"
)])
is
not
None
):
if
(
get_column_header_name
(
"
l
atitude
_
start
"
)
not
in
data
or
return_value_if_not_none
(
data
[
get_column_header_name
(
"
l
atitude
_
start
"
)])
is
not
None
):
if
(
get_column_header_name
(
"
L
atitude
stop
"
)
in
data
and
return_value_if_not_none
(
data
[
get_column_header_name
(
"
L
atitude
stop
"
)])
is
not
None
):
if
(
get_column_header_name
(
"
L
atitude
start
"
)
not
in
data
or
return_value_if_not_none
(
data
[
get_column_header_name
(
"
L
atitude
start
"
)])
is
not
None
):
raise
DataInconsistencyError
(
f
"
Sample with
{
get_entity_name
(
'
entity_id
'
)
}
{
sample
.
id
}
has a
"
f
"
{
get_entity_name
(
'
StopPosition
'
)
}
but no valid
"
...
...
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