Skip to content

Commit

Permalink
Fixed long-standing filtering bug for animal/cage treatments
Browse files Browse the repository at this point in the history
  • Loading branch information
TheChymera committed Sep 25, 2019
1 parent fdedc4c commit 32bced9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions labbookdb/report/selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,12 @@ def animal_treatments(db_path,
cage_stays = cage_periods(db_path, animal_filter=animals)
df = concurrent_cagetreatment(df, cage_stays)

# The concurrent cage treatment function cannot delete the entire entry for animals which have only one entry in the dataframe.
# This is because the row may still contain unique animal treatment information, which would otherwise be lost.
# As the `concurrent_cagetreatment()` function is unaware of this context, we perform this filtering here.
if cage_treatments:
df = df.loc[df['Cage_TreatmentProtocol_code'].isin(cage_treatments)]

return df


Expand Down

0 comments on commit 32bced9

Please sign in to comment.