augur icon indicating copy to clipboard operation
augur copied to clipboard

dates: Rewrite using regular expressions

Open victorlin opened this issue 2 years ago • 4 comments

Description of proposed changes

This rewrites the date parsing functions currently used by filter and frequencies --min-date/--max-date parameters, and adds support for ambiguous dates (e.g. 2020-XX-XX) and incomplete dates (e.g. 2020-06, 2020). This means --max-date with year only will be inclusive now.

Motivated by work in #854.

Related issue(s)

  • Fixes #893
  • Related to #662
  • Related to #882

Testing

Added doctests and pytests.

TODO

  • [ ] squash 7fb35acbdfff4cd8ed121939d375ee11c9460185...468f3b46b3f056670b1e2b1e6c88ee2776b11d2b into fc297541df179491f4d67a39a901d79ca627306a
  • [ ] add tests for 7fb35acbdfff4cd8ed121939d375ee11c9460185...468f3b46b3f056670b1e2b1e6c88ee2776b11d2b

victorlin avatar May 16 '22 22:05 victorlin

Codecov Report

Base: 63.32% // Head: 59.47% // Decreases project coverage by -3.85% :warning:

Coverage data is based on head (6229db7) compared to base (8b3c33d). Patch coverage: 93.24% of modified lines in pull request are covered.

:exclamation: Current head 6229db7 differs from pull request most recent head 53cb6c1. Consider uploading reports for the commit 53cb6c1 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #928      +/-   ##
==========================================
- Coverage   63.32%   59.47%   -3.86%     
==========================================
  Files          57       50       -7     
  Lines        6628     6314     -314     
  Branches     1632     1599      -33     
==========================================
- Hits         4197     3755     -442     
- Misses       2147     2295     +148     
+ Partials      284      264      -20     
Impacted Files Coverage Δ
augur/dates.py 89.74% <92.64%> (-3.32%) :arrow_down:
augur/filter.py 95.78% <100.00%> (+0.04%) :arrow_up:
augur/frequencies.py 50.84% <100.00%> (-0.82%) :arrow_down:
augur/io/vcf.py 42.50% <0.00%> (-43.75%) :arrow_down:
augur/translate.py 38.18% <0.00%> (-36.43%) :arrow_down:
augur/utils.py 64.28% <0.00%> (-7.33%) :arrow_down:
augur/traits.py 80.83% <0.00%> (-4.42%) :arrow_down:
augur/reconstruct_sequences.py 27.58% <0.00%> (-2.42%) :arrow_down:
augur/lbi.py 21.91% <0.00%> (-2.09%) :arrow_down:
... and 38 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

codecov[bot] avatar May 18 '22 17:05 codecov[bot]

Converting to draft, at least until #989 is resolved

victorlin avatar Jun 24 '22 19:06 victorlin

Is the plan to eventually replace the remaining treetime-based functions like augur.date.get_numerical_dates() with the new ones introduced here?

tsibley avatar Jun 24 '22 19:06 tsibley

@tsibley yes, that's my plan with #938

victorlin avatar Jun 24 '22 19:06 victorlin