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

ENH: Add start/end time treatment

parent e8009701
No related branches found
No related tags found
1 merge request!1F awi sams
...@@ -28,7 +28,7 @@ def get_parser(): ...@@ -28,7 +28,7 @@ def get_parser():
def get_column_names(data): def get_column_names(data):
# Make sure each header starts with BIS ID and Main User # Make sure each header starts with BIS ID and Main User
starting_names = ["entity_id", "Main User"] starting_names = [get_column_header_name(name) for name in ["entity_id", "Main User"]]
# required_column_names is just a string of column names separated by # required_column_names is just a string of column names separated by
# commas. # commas.
other_names = data["required_column_names"].split(',') + data["column_names"] other_names = data["required_column_names"].split(',') + data["column_names"]
......
...@@ -53,13 +53,20 @@ def add_event_to_sample(sample: db.Record, data: pd.Series) -> db.Record: ...@@ -53,13 +53,20 @@ def add_event_to_sample(sample: db.Record, data: pd.Series) -> db.Record:
) )
) )
if positions: if positions:
update_property(event, position_prop.id, positions, event = update_property(event, position_prop.id, positions,
datatype=db.LIST(get_entity_name("Position"))) datatype=db.LIST(get_entity_name("Position")))
# TODO: Start/end date, remaining event props for time_p in ["start_date_prop", "end_date_prop"]:
prop = db.get_entity_by_name(get_entity_name(time_p))
if (get_column_header_name(time_p) in data and
return_value_if_not_none(data[get_column_header_name(time_p)]) is not None):
event = update_property(event, prop.id, return_value_if_not_none(
data[get_column_header_name(time_p)]))
# only add if there was any event data at all:
if len(event.properties) > 0:
sample = update_property(sample, event_rt.id, event)
sample = update_property(sample, event_rt.id, event)
return sample 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