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

Improve date handling #1519

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

Improve date handling #1519

wants to merge 2 commits into from

Conversation

jameshadfield
Copy link
Member

Previously a tree was considered temporal (i.e. you could use a temporal tree metric) or not based on the presence of num_date on the root node. The allowed partially temporal trees (e.g. those where some tip dates were known) to be displayed as div trees with a colouring of num_date, however the date slider wasn't available. Here's what this looked like:

image


The first commit in this PR allows "partially temporal trees" which are defined as tree(s) where the number of nodes with num_date is more than zero but fewer than the total node count. These get a date-range filter, but aren't able to be displayed as true time trees:

image

Note that this has one strange / misleading effect. For tips without a num_date they are never filtered out by the date slider. This is obvious when colouring by num_date (they are grey) but when using a different colouring one must consider that a node may be visible because it is inside the selected date range or it doesn't have a date! For instance here's the MPX tree filtered to dates before 2013 😨

image


The second commit allows temporal scales ("type": "numeric") as long as they are numeric in the JSON. In the future it'd be nice to allow YYYY-MM-DD values, but that's for another PR (and comes with its own complexities - what about -XX dates?). Here's some randomised data, with 10% of nodes undefined:

image

@nextstrain-bot nextstrain-bot temporarily deployed to auspice-improve-date-ha-hlwawn June 2, 2022 09:05 Inactive
Previously a tree was considered temporal (i.e. you could use a temporal
tree metric) or not based on the presence of `num_date` on the root
node. The allowed partially temporal trees (e.g. those where some tip
dates were known) to be displayed as div trees with a colouring of
`num_date`, however the date slider wasn't available.

Here we allow "partially temporal trees" which are defined as tree(s)
where the number of nodes with `num_date` is more than zero but fewer
than the total node count. These get a date-range filter, but aren't
able to be displayed as true time trees [1].

Note that this has one strange / misleading effect. For tips without
a `num_date` they are never filtered out by the date slider. This
is obvious when colouring by `num_date` (they are grey) but when using
a different colouring one must consider that a node may be visible
because it is inside the selected date range _or_ it doesn't have a
date!

[1] I explored hiding nodes without date information but the results
weren't ideal - it could be done, but it would require modifications to
the tree layout code.
This implements a feature I've long wanted & it does it the quick and
easy way: by requiring that the value already be numeric! In the future
it'd be nice to allow YYYY-MM-DD values, but that's for another PR (and
comes with its own complexities - what about -XX dates?)

This commit will require a corresponding one in augur to update the
schema
@jameshadfield jameshadfield force-pushed the improve-date-handling branch from b1e0741 to b5ab0ae Compare June 2, 2022 20:37
@nextstrain-bot nextstrain-bot temporarily deployed to auspice-improve-date-ha-hlwawn June 2, 2022 20:38 Inactive
@jameshadfield jameshadfield marked this pull request as draft June 16, 2022 01:26
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: Backlog
Development

Successfully merging this pull request may close these issues.

2 participants