generated from opensafely-core/repo-template
-
Notifications
You must be signed in to change notification settings - Fork 5
Closed
Description
If you want to find out whether two events are within 14 days of each other without caring which comes first then you ought to be able to write:
abs((event_1.date - event_2.date).days) <= 14
Rather than having to write:
((event_1.date - event_2.date).days <= 14) & ((event_1.date - event_2.date).days >= -14)
In fact, once we close this related issue, you really ought to be able to write:
abs(event_1.date - event_2.date) <= days(14)
Implementing this is a matter of adding a Fuction.Abs
operation to the query model and in the query language supporting the __abs__
magic method on numeric series. Adding appropriate spec tests should drive out the rest of the implementation.
Metadata
Metadata
Assignees
Labels
No labels