Open maxalbert opened 5 years ago
In addition, any filtering by hour-of-the-day etc. should be separated out.
One case of inconsistent use of stop
parameter is in Multilocation
https://github.com/Flowminder/FlowKit/blob/8167c5e321a7718863d6c1930d94efb612d072f2/flowmachine/flowmachine/features/utilities/multilocation.py#L50
where self.stop
(which isn't used elsewhere in the code) refers to the latest date in the list of daily locations, not the day after this date (whereas EventTableSubset
takes stop
to be the day after the end of the interval).
There are many places in the code base where dates are converted to/from strings, date checks are applied, etc. This results in code duplication, but more importantly there is a risk that different parts of the code apply different meaning to the
stop
/end
parameter, or that custom tweaks (such as this) are applied only in certain places but not others.There should be a single place (e.g. a
DateRange
class) which contains the logic about how date ranges are interpreted and processed. This class should validate its input and provide support for simple date-based operations. Any other code that needs to deal with dates should accept aDateRange
object and use its attributes rather than dealing with date strings directly.