Skip to content

Commit

Permalink
remove detailed check during v3,v5 overlap with additional visit (month
Browse files Browse the repository at this point in the history
33) added by v5.  the assumption that the resulting month 33 would start
before the v3 month 30 is not always the case.
  • Loading branch information
pbugni committed Mar 12, 2024
1 parent bab41f7 commit 696fc86
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions portal/models/qb_timeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,11 @@ def int_or_none(value):
for row in qbt_rows:
# Confirm expected order
if last_at:
assert row.at >= last_at
if last_at > row.at:
raise ValueError(
f"patient {row.user_id} has overlapping qb_timeline rows"
f" {last_at} and {row.at}"
)

key = f"{row.qb_id}:{row.qb_iteration}"
if previous_key and previous_key != key:
Expand Down Expand Up @@ -975,11 +979,9 @@ def attempt_update(user_id, research_study_id, invalidate_existing):
if (
pending_qbts[j].qb_id != remove_qb_id or
pending_qbts[j].qb_iteration != remove_iteration):
# To qualify for this special case,
# having worked back to previous QB, if
# at > start, take action
if pending_qbts[j].at > start:
unwanted_count = len(pending_qbts)-j-1
# unwanted_count represents all rows from
# overlapped, unwanted visit
unwanted_count = len(pending_qbts)-j-1
break

# keep a lookout for work done in old RP
Expand Down

0 comments on commit 696fc86

Please sign in to comment.