Add support for dispatch/divide by days
Fixes govzeroaotearoa/openfisca-aotearoa#15 Depends on #1141
New features
- Introduce support for the
daydate unit inholders.set_input_dispatch_by_periodandholders.set_input_divide_by_period- Allows for dispatching values per day, for example, to provide a daily (week, fortnight) to an yearly variable.
- Inversely, allows for calculating the daily (week, fortnight) value of a yearly input.
Coverage increased (+0.07%) to 79.005% when pulling ab90087a82d84b37b113ca3d5d137379b8950170 on fix-day-periods into e18f23be34b5964e89ee65e33669da1a0996ee73 on master.
I will postpone reviewing this PR until the one it depends on is approved, and suggest that this one is set to draft. Indeed, I fail to see how it could be approved when #1141 might not go through.
Do you truly need #1141 for this one to be reviewed? 🙂 As an alternative to switching to draft, I suggest to remove the dependency and rebase straight on master. Yes, test-docs might fail until #1141 is fixed, but that is true of all PRs, not only of this one. This would enable reviews to be parallelised and proper solutions found for #1140 without blocking all the others.
Done!
I'm not sure if this is a new feature, or a bug-fix as the behaviour this adds was introduced as a replacement of a behaviour that was deprecated, however the pull request forgot to include days in that migration.
@maukoquiroga : looks very good to me.
Just a question: how does this PR handles month day size, february and leeap year for divide_by_period ?
It does not seem to be tested although there are a bunch of tests for that in Period and Instant.
@maukoquiroga : looks very good to me. Just a question: how does this PR handles month day size, february and leeap year for divide_by_period ? It does not seem to be tested although there are a bunch of tests for that in
PeriodandInstant.
I didn't do a lot more than «reenabling» a feature that already existed.
If you see in the tests, month days are handled appropriately (31 + 28 + 30).
Maybe test should be more precise about leap years.
(By the way, I think that holders implements it's own logic in terms of equivalences between days, months and years. We should see which is better, and keep just one in periods, as holder should not handle that kind of logic IMHO).
@benjello @MattiSG could you please take a look at this pull request again?
cc @MattiSG @benjello