-
Notifications
You must be signed in to change notification settings - Fork 67
Leonlu2/inequality issue time value #1124
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
base: dev
Are you sure you want to change the base?
Conversation
2. add test in test_covidcast.py accordingly 3. refactor minor places
2. add test for inequality in issues 3. minor changes
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.
Buncha questions to get through first
part = part[len(operator):] | ||
if not part: | ||
raise ValidationFailedException("missing parameter: date after the inequality operator") | ||
return (inequality_operator,), part |
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.
nit: using a length-1 tuple here feels weird
later on we're using the tuple type information to engage the inequalities logic instead of the range logic, so it's clearly needed, but it feels unsatisfying regardless
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.
hey @rzats do you have any ideas for how we can more clearly indicate that a date parameter value is an inequality? the return value from this function is read in the date span processing at _query.py:45, dates.py:125, and dates.py:147, where inequalities need to be handled differently from other kinds of spans.
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.
Yep, I can see what this PR is going for and there might be a better way to handle the inequalities. Right now this is returning a single-element tuple to fit within the following type structure;
IntRange: TypeAlias = Union[Tuple[int, int], int]
TimeValues: TypeAlias = Sequence[IntRange]
A clean solution would be to add a new type alias called IntStrRange
which is a union of Tuple[int, int]
, int
and a third type - either str
if we just want to know what the inequality operator is or Tuple[str, int]
if we want the date too.
TimeValues
can then be replaced with a Sequence[IntStrRange]
, and we can then refactor the date span processing functions where TimeValues
was previously used.
Co-authored-by: Katie Mazaitis <[email protected]>
Co-authored-by: Katie Mazaitis <[email protected]>
Co-authored-by: Katie Mazaitis <[email protected]>
Co-authored-by: Katie Mazaitis <[email protected]>
Co-authored-by: Katie Mazaitis <[email protected]>
Co-authored-by: Katie Mazaitis <[email protected]>
Kudos, SonarCloud Quality Gate passed!
|
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.
👍
Could merge as is but I'd like to hear Rostyslav's thoughts
closes #1085
Prerequisites:
dev
branchdev
Summary