Skip to content

Commit

Permalink
Merge pull request #73 from opensafely/iaindillingham/redact-le-seven
Browse files Browse the repository at this point in the history
`redact_le_five` -> `redact_le_seven`
  • Loading branch information
iaindillingham authored Jul 10, 2023
2 parents f294d35 + b021522 commit 83c8ef6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion analysis/aggregate.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def aggregate(event_counts, offset, func):
group_by, resample_by = event_counts.index.names
return (
event_counts.pipe(resample, offset, func)
.pipe(sdc.redact_le_five)
.pipe(sdc.redact_le_seven)
.pipe(sdc.round_to_nearest_five)
.unstack(level=group_by)
)
Expand Down
2 changes: 1 addition & 1 deletion analysis/sdc.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def redact_le(series, threshold):
return copy_of_series


redact_le_five = functools.partial(redact_le, threshold=5)
redact_le_seven = functools.partial(redact_le, threshold=7)


def round_to_nearest(series, multiple):
Expand Down
6 changes: 3 additions & 3 deletions tests/test_sdc.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
from analysis import sdc


@pytest.mark.parametrize("data_in,data_out", [(4, 0), (5, 0), (6, 6)])
def test_redact_le_five(data_in, data_out):
@pytest.mark.parametrize("data_in,data_out", [(6, 0), (7, 0), (8, 8)])
def test_redact_le_seven(data_in, data_out):
series = pandas.Series(data_in)
redacted_series = sdc.redact_le_five(series)
redacted_series = sdc.redact_le_seven(series)
assert series is not redacted_series
assert list(redacted_series) == [data_out]

Expand Down

0 comments on commit 83c8ef6

Please sign in to comment.