-
Notifications
You must be signed in to change notification settings - Fork 128
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
Allow precise date ranges #1304
Comments
Add support for the treetime ambiguous date format `[float_min:float_max]`, e.g. `[2004.43:2005.58]` This is useful for when ambiguity is not limited to month/year boundaries. Resolves #1304
This was discussed recently on Slack with some different ideas. I'll plan to work on this soon so I've updated the issue description with latest ideas. Commenting on some things from the original issue description:
On the Slack discussion the existing ISO standard format
I'll shoot this down as this would be confusing if/when we're to bring this to augur filter which already has
Making this change across all date handling is the best/easiest way to do it since date handling is centralized under augur/dates. Doing it only in one subcommand would require extra work and cause more confusion to users. |
Cool! I agree to ditch
Though I think I most prefer either Pythonic colon/bracket eg |
I vote to stay consistent with the ISO format we're already following, I don't see any compelling reasons to deviate from it. It also allows more concise forms like "2008-02-15/03-14", where "/03-14" implies "/2008-03-14". |
Consistent with ISO gets my vote. In past work for Seattle Flu Study, we used range types in various places. That used Postgres range syntax, which includes support for inclusive ( |
Taking my name off as I haven't gotten to this and it doesn't seem high priority at the moment. |
Thanks for the discussion! Bumping this as it would be great to have a way to pass in ranges, it's ok if it's ISO instead of treetime format. |
Context
Currently, date ranges can only be defined by ambiguous/incomplete dates in the format
YYYY-MM-DD
with some characters swapped in with the wildcard characterX
¹. This only allows date ranges to be bounded by start/end of a year or month and not a more precise range within or across year/month boundaries.¹ this could be better documented: #882
Scope
Anywhere that currently accepts ambiguous/incomplete dates (i.e. uses
AmbiguousDate
):augur filter
augur frequencies
augur refine
Potential solutions
--min-date-column
/--max-date-column
date
column¹[min:max]
wheremin
andmax
are numeric datesmin/max
wheremin
andmax
are ISO dates[min/max]
wheremin
andmax
are any scalar date accepted by Augur (ISO or numeric)¹ there is a feature request to make the date column name customizable: #1443
original issue description
Context
To ensure patient privacy, Denmark bins SARS-CoV-2 collection dates to the Monday of the week the actual collection date lies in.
Currently, we seem to be unable to specify such ambiguity within
augur refine
even though treetime supports arbitrarily constrained date ranges.The only workaround right now I can think of is to make the date ambiguous, but that throws away information while also not working in situations where the week crosses a month boundary.
The issue has become particularly noticeable when making BA.2.86 trees where Denmark has provided ~30% of global sequences so far. To remove bias, I could add 3/4 days to the dates, but it would be nice if refine just accepted ranges as such.
Description
Make refine support arbitrary min/max input dates.
Possible solution
The simplest way to implement this would be to accept the min/max date format that's natively supported by treetime:
[min:max]
as in[2022.3452:2022.3649]
(opening bracket, min date as year float, colon, max date as year float, closing bracket)A neater solution might be to allow min and max dates to be specified through two columns:
--min-date
and--max-date
.This change could potentially be made across all date handling: it would be more general than our current x'ing strategy, e.g.
2021-10-XX
for ambiguous date of month. That'd be a lot of work though.The text was updated successfully, but these errors were encountered: