Skip to content
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

fix: convert pd.NaT to None for event_timestamp #1105

Merged
merged 4 commits into from Feb 7, 2022

Conversation

dcfidalgo
Copy link
Contributor

When providing a pandas NaT as event_timestamp, the server response is:

import rubrix as rb

rec = rb.TextClassificationRecord(inputs="test", event_timestamp=pd.NaT)
rb.log(rec, "test")
""" output
ValidationApiError: Rubrix server returned an error with http status: 422
Error details: [{'code': 'rubrix.api.errors::ValidationError', 'params': {'model': 'Request', 'errors': [{'loc': ['body', 'records', 0, 'event_timestamp'], 'msg': 'invalid datetime format', 'type': 'value_error.datetime', 'value': 'NaT'}]}}]
"""

This PR converts pandas NaT to None when provided as input to a Rubrix client model.

@dcfidalgo dcfidalgo added this to In progress in Release via automation Feb 7, 2022
@dcfidalgo dcfidalgo added the type: bug Indicates an unexpected problem or unintended behavior label Feb 7, 2022
@dcfidalgo dcfidalgo self-assigned this Feb 7, 2022
@frascuchon
Copy link
Member

When providing a pandas NaT as event_timestamp, the server response is:

import rubrix as rb

rec = rb.TextClassificationRecord(inputs="test", event_timestamp=pd.NaT)
rb.log(rec, "test")
""" output
ValidationApiError: Rubrix server returned an error with http status: 422
Error details: [{'code': 'rubrix.api.errors::ValidationError', 'params': {'model': 'Request', 'errors': [{'loc': ['body', 'records', 0, 'event_timestamp'], 'msg': 'invalid datetime format', 'type': 'value_error.datetime', 'value': 'NaT'}]}}]
"""

This PR converts pandas NaT to None when provided as input to a Rubrix client model.

nice error info ! :-)

Release automation moved this from In progress to Review Feb 7, 2022
src/rubrix/client/models.py Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Feb 7, 2022

Codecov Report

Merging #1105 (391d170) into master (e931543) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1105   +/-   ##
=======================================
  Coverage   94.98%   94.98%           
=======================================
  Files         119      119           
  Lines        4483     4491    +8     
=======================================
+ Hits         4258     4266    +8     
  Misses        225      225           
Flag Coverage Δ
pytest 94.98% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/rubrix/client/models.py 98.91% <100.00%> (+0.10%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e931543...391d170. Read the comment docs.

@frascuchon frascuchon merged commit 029eda8 into master Feb 7, 2022
Release automation moved this from Review to Done Feb 7, 2022
@frascuchon frascuchon moved this from Done to Ready to DEV QA in Release Feb 7, 2022
@dcfidalgo dcfidalgo deleted the fix/event_timestamp_nat_to_none branch February 7, 2022 16:41
frascuchon pushed a commit that referenced this pull request Feb 7, 2022
* fix: convert nat to none

* test: add test

* test: fix tests

* test: switch from root_validators to validators

(cherry picked from commit 029eda8)
@frascuchon frascuchon moved this from Ready to DEV QA to Release Ready in Release Feb 7, 2022
@frascuchon frascuchon moved this from Release Ready to Ready to DEV QA in Release Feb 7, 2022
@frascuchon frascuchon moved this from Ready to DEV QA to Release Ready in Release Feb 7, 2022
frascuchon pushed a commit that referenced this pull request Feb 10, 2022
* fix: convert nat to none

* test: add test

* test: fix tests

* test: switch from root_validators to validators

(cherry picked from commit 029eda8)
dvsrepo added a commit that referenced this pull request Feb 10, 2022
* 'master' of https://github.com/recognai/rubrix: (26 commits)
  feat(#1061): unify records results title (#1111)
  refactor(#945): using new search service (#1117)
  fix(#1121):  Adjust search bar width (#1124)
  fix(#945): validate label for single label text classification dataset (#1123)
  docs: fix skweak images (#1120)
  fix(#831): Remove sort field when only one is applied (#1116)
  refactor(#945): add current search aggregations as metrics (#1115)
  chore(#982): extends search area (#1112)
  chore(#1054): long records margin adjustment #1114
  feat(#1063): Token Classifier fine tuning content selection (#1084)
  refactor(#1102): remove "Update Summary" button rules summary (#1110)
  refactor(#945): revert index config for text2text (#1108)
  fix: convert pd.NaT to None for event_timestamp (#1105)
  fix(#1094): return empty list for no predicted_as (#1107)
  docs(#1089): remove pip install elasticsearch from docs (#1104)
  fix(#1054): reduce collapsable area. Optimize for annotation (#1106)
  fix(#945): include default aggregations for text2text (#1097)
  refactor(#1044): include last updated field for sort (#1093)
  fix(#1094): remove computed record fields returned in API results (#1095)
  feat(#1051): keep predictions labels when annotating (#1077)
  ...
@dcfidalgo dcfidalgo moved this from Ready to Release QA to Approved Release QA in Release Feb 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Indicates an unexpected problem or unintended behavior
Projects
No open projects
Release
Approved Release QA
Development

Successfully merging this pull request may close these issues.

None yet

2 participants