Skip to content

Fix aggregate #112

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

Merged
merged 7 commits into from
Dec 13, 2023
Merged

Fix aggregate #112

merged 7 commits into from
Dec 13, 2023

Conversation

iaindillingham
Copy link
Member

@iaindillingham iaindillingham commented Dec 13, 2023

When the resampling function produced a series of floats, as was the case when it was the mean, values greater than 7.0 but less than 7.5 would be rounded down to 5. Now, values are rounded to the nearest integer and the series is cast to an int, so values in this range will be either redacted (e.g. 7.1 -> 7 -> 0) or rounded up to 10 (e.g. 7.5 -> 8 -> 10).

Thanks for spotting the bug in ebmdatalab/opensafely-output-review#719, @LFISHER7 and @Jongmassey. I've a couple more issues with this report to address, but will run and request a release when I'm done.

Closes #93

The bug occurs when the resampling function produces a series of floats,
as is the case when it is the mean. Values that are greater than 7.0,
but less than 7.5, will be rounded down to 5.
This complements `test_aggregate_mean_by_week` and replaces the
low-value `test_resample`.
Previously, we set the table names in `make_event_counts` but referred
to them in test functions. Although more verbose, it's easier to reason
about if we pass the table names to `make_event_counts`. This way, the
table names are set and referred to in the test functions.
We also remove a low-value test.
When the resampling function produced a series of floats, as was the
case when it was the mean, values greater than 7.0 but less than 7.5
would be rounded down to 5. Now, values are rounded to the nearest
integer and the series is cast to an `int`, so values in this range will
be either redacted (e.g. 7.1 -> 7 -> 0) or rounded up to 10 (e.g. 7.5 ->
8 -> 10).

Closes #93
@iaindillingham iaindillingham merged commit 54f1b1d into main Dec 13, 2023
@iaindillingham iaindillingham deleted the iaindillingham/counts-of-five branch December 13, 2023 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Investigate SDC
1 participant