Open victorlin opened 2 years ago
This is a great idea! We should also consider linking out to examples of ISO 8601 dates, since users may not be familiar with this term (or will not know that they know the associated formats). Linking to the ISO 8601 calendar dates and durations sections on wikipedia would be fine for this.
Relatedly, I've done a bunch of date parsing work in #854 (see dates.py), but this has yet to be merged.
Do we want to also support and document the following formats?
YYYY-MM (Day unknown)
YYYY (Month and day unknown)
Fauna's format_date function seems to process it, but I assume it will be superseded by augur's version. I could also see dropping any parenthetical strings "\s(\S.*)" as a pre-processing step and outside the scope.
@j23414 yeah, that would be 2018
and 2018-03
in the issue description examples.
The current support for those isn't in dates.py, but rather a hidden feature of augur filter's subsampling logic which only applies to the metadata date
column during subsampling:
As a path to follow, we should aim to support the same date formats across different use cases via functions in dates.py.
One way to think about incomplete dates like YYYY
and YYYY-MM
would be to standardize/sanitize these to YYYY-XX-XX
and YYYY-MM-XX
, respectively, early in a workflow. This could be part of the proposed work in #860.
740 improves the help text for
filter
's--min-date
/--max-date
. Similar documentation should also be provided for metadata dates, which is slightly different (e.g. no support for relative dates). Moving some things over from an old wiki page as a starter:Overview
Augur supports a variety of date formats:
2018
- Year only2018.23
- Numerical (floating point)2018-03
- Year, month (positive only)2018-03-25
- Year, month, day (ISO 8601 date) (positive only)2018-03-XX
- Year, month, ambiguous day (positive only)2018-XX-XX
- Year, ambiguous month, ambiguous day (positive only)Generally, this comes down to flavors of numerical or (potentially incomplete) ISO dates.
Implementation
Internally, Augur stores dates in numerical format for the following reasons:
Related discussions