Skip to content
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

Added a way to handle filtering admitted but no bed assigned #1318

Merged
merged 23 commits into from
Sep 11, 2023
Merged
Changes from 11 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
8946d5f
used prefetch_related method to optimize the query performed to fetch…
yaswanthsaivendra May 23, 2023
7d410fd
Revert "add direnv support (#1304)"
yaswanthsaivendra May 26, 2023
7179fdf
Revert "Revert "add direnv support (#1304)""
yaswanthsaivendra May 26, 2023
9cb5f7c
Revert "used prefetch_related method to optimize the query performed …
yaswanthsaivendra May 26, 2023
d2134a9
Merge branch 'coronasafe:master' into master
yaswanthsaivendra May 26, 2023
7000a38
used prefetch where we are querying the skills using UserAssigned Ser…
yaswanthsaivendra May 26, 2023
5fbe144
made neccessary changes to filter for having admitted but no bed assi…
yaswanthsaivendra May 26, 2023
719129e
Revert "used prefetch where we are querying the skills using UserAssi…
yaswanthsaivendra May 27, 2023
f201c9b
updated the view to handle none option for bed type
yaswanthsaivendra May 27, 2023
b5a5b06
changed value 8 into None for None option
yaswanthsaivendra May 28, 2023
6c89ff4
made use of Q function to write the filter
yaswanthsaivendra May 29, 2023
883ef24
made use of in lookup
yaswanthsaivendra Jun 7, 2023
91e5535
fix
yaswanthsaivendra Jun 7, 2023
436314c
added tests and minor fixes in code
yaswanthsaivendra Jun 14, 2023
e8011e9
updated the test to make use of testbase
yaswanthsaivendra Jun 15, 2023
ff20e99
Merge branch 'master' into none
rithviknishad Jul 26, 2023
bc0ced8
Merge branch 'master' into none
rithviknishad Aug 9, 2023
b581a8a
Merge branch 'master' into none
sainak Aug 29, 2023
6056779
minor refactor
sainak Aug 29, 2023
536ab30
add more tests
sainak Aug 29, 2023
61da24e
refactor
sainak Sep 6, 2023
f81a7f8
Merge branch 'master' into none
sainak Sep 6, 2023
2b29fcb
Merge branch 'master' into none
vigneshhari Sep 11, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion care/facility/api/viewsets/patient.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,23 @@
field_name="last_consultation__symptoms_onset_date"
)
last_consultation_admitted_bed_type_list = MultiSelectFilter(
field_name="last_consultation__current_bed__bed__bed_type"
field_name="last_consultation__current_bed__bed__bed_type",
method="filter_by_bed_type",
)

def filter_by_bed_type(self, queryset, name, value):

Check notice on line 154 in care/facility/api/viewsets/patient.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

care/facility/api/viewsets/patient.py#L154

Method could be a function
values = value.split(",")
filter_q = Q()

for val in values:
val = val.strip()
if val == "None":
filter_q |= Q(last_consultation__current_bed__isnull=True)
else:
filter_q |= Q(last_consultation__current_bed__bed__bed_type=val)
yaswanthsaivendra marked this conversation as resolved.
Show resolved Hide resolved

return queryset.filter(filter_q)
sainak marked this conversation as resolved.
Show resolved Hide resolved

last_consultation_admitted_bed_type = CareChoiceFilter(
field_name="last_consultation__current_bed__bed__bed_type",
choice_dict=REVERSE_BED_TYPES,
Expand Down