New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue 376 facilitate saving feedback annotations #377
Issue 376 facilitate saving feedback annotations #377
Conversation
Signed-off-by: F.N. Claessen <felix@seita.nl>
…tion type, and support returning an annotation data frame Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
) -> List["Annotation"]: | ||
"""Save a data frame with annotations. | ||
|
||
Expects the following columns (or multi-index levels): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you elaborate why this function should expect a DataFrame and not, say, a dict?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be honest, I just happened to be handling a DataFrame with annotations in our GripOnGas plugin. There, the choice for a DataFrame makes sense because of the slicing and sorting functionality of the timing columns. So here, I designed just what I needed, a function to save annotations that accepts input in the form I already had.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My take after thinking about this again: These functions are not for saving finished Annotations (the best way then would be to pass Annotation
objects), but to create and save multiple annotations from raw data (for which a data frame is a good representation).
There are method names to better represent this fact. I also looked up the similar method TimedBelief.add
(which in similar fashion gets a BeliefsDataFrame
).
I thus believe Annotation.add
would be a better choice for a name here.
We can then (in this PR or in follow-ups, I'd add TODOs) also use similar parameters:
- expunge_session
- allow_overwrite
- bulk_save_objects
- commit_transaction (you have this, requires just a renaming)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unsurprisingly, I have a renaming request.
) -> List["Annotation"]: | ||
"""Save a data frame with annotations. | ||
|
||
Expects the following columns (or multi-index levels): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My take after thinking about this again: These functions are not for saving finished Annotations (the best way then would be to pass Annotation
objects), but to create and save multiple annotations from raw data (for which a data frame is a good representation).
There are method names to better represent this fact. I also looked up the similar method TimedBelief.add
(which in similar fashion gets a BeliefsDataFrame
).
I thus believe Annotation.add
would be a better choice for a name here.
We can then (in this PR or in follow-ups, I'd add TODOs) also use similar parameters:
- expunge_session
- allow_overwrite
- bulk_save_objects
- commit_transaction (you have this, requires just a renaming)
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
This PR offers better support for saving and counting annotations on the level of generic assets. It also implements a Marshmallow validation field for generic asset ids.
closes #376