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

dates: Consolidate date parsing logic #936

Open
2 of 7 tasks
victorlin opened this issue May 18, 2022 · 0 comments
Open
2 of 7 tasks

dates: Consolidate date parsing logic #936

victorlin opened this issue May 18, 2022 · 0 comments
Assignees

Comments

@victorlin
Copy link
Member

victorlin commented May 18, 2022

Context

Date parsing across Augur has come about in the form of convergent evolution, with separate functions trying to do roughly the same thing. A summary:

Also note there is some date parsing that currently lives outside of augur.dates:

  • augur filter when called with --group-by <year|month|week> parses dates in the form of <year>-<month>-<day>, <year>-<month>, or <year> (src)

Potential solutions

  • Merge numeric_date() and get_numerical_date_from_value() since these are serving similar purposes.
  • Leave is_date_ambiguous() as-is since it serves its purpose and is not duplicated. No point in trying to use numeric_date() internally since ambiguous dates must be in ISO format.
  • Leave get_iso_year_week() as-is since it serves its purpose and is not duplicated. No point in trying to use numeric_date() internally since this is only used by augur filter --group-by which requires ISO format.
  • For augur filter --group-by <year|month|week>, first run the date string through numeric_date() then convert to ISO date which can be split into year/month/date parts. If the conversion is not possible (i.e. negative date), just drop the sequence.
  • Explicitly drop support for numeric dates in most part of the code? This may be more for Add documentation page on supported date formats #882

Progress

Issues that should be fixed as a result of this work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: In Progress
Development

No branches or pull requests

1 participant