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

Adds functionality for last_consultation_admitted_bed_type_list in discharge patient filters #2204

Merged
merged 23 commits into from
Sep 23, 2024

Conversation

shivankacker
Copy link
Member

@shivankacker shivankacker commented May 28, 2024

Proposed Changes

  • Overwrites last_consultation_admitted_bed_type_list filter in Discharge Patient Viewset

Associated Issue

Merge Checklist

  • Tests added/fixed
  • Update docs in /docs
  • Linting Complete
  • Any other necessary step

Only PR's with test cases included and passing lint and test pipelines will be reviewed

@coronasafe/care-backend-maintainers @coronasafe/care-backend-admins

@nihal467
Copy link
Member

nihal467 commented Jun 4, 2024

QA test failed, @skks1212 make the necessary fixes

@nihal467
Copy link
Member

QA test failed, @skks1212 make the necessary fixes

Copy link

codecov bot commented Jun 15, 2024

Codecov Report

Attention: Patch coverage is 85.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 65.50%. Comparing base (e029196) to head (6bbc84b).
Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
care/facility/api/viewsets/patient.py 83.33% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2204      +/-   ##
===========================================
+ Coverage    65.49%   65.50%   +0.01%     
===========================================
  Files          243      243              
  Lines        14054    14070      +16     
  Branches      1949     1952       +3     
===========================================
+ Hits          9204     9217      +13     
- Misses        4464     4465       +1     
- Partials       386      388       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@nihal467
Copy link
Member

LGTM

@nihal467
Copy link
Member

nihal467 commented Jul 3, 2024

@skks1212 can you modify the test as requested before proceeding to further review

@shivankacker
Copy link
Member Author

@sainak made requested changes, please review

care/facility/api/viewsets/patient.py Outdated Show resolved Hide resolved
care/facility/api/viewsets/patient.py Outdated Show resolved Hide resolved
queryset = (
PatientRegistration.objects.select_related(
PatientRegistration.objects.annotate(
last_discharge_consultation__id=Subquery(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You dont need to explicitly specify it as a subquery, it should automatically understand that its a subquery.
ids = Something.objects.values_list('id', flat=True)
SomethingElse.objects.filter(something_id__in=ids)

Will only have one query.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But will it not be required to use OuterRef?

@shivankacker
Copy link
Member Author

shivankacker commented Jul 8, 2024

Lint failing but I have no idea why.
pre-commit run --all-files throws :

flake8...................................................................Failed
- hook id: flake8
- exit code: 1

care/utils/assetintegration/hl7monitor.py:19:36: E713 test for membership should be 'not in'
care/utils/assetintegration/onvif.py:26:36: E713 test for membership should be 'not in'
care/utils/assetintegration/ventilator.py:19:36: E713 test for membership should be 'not in'

These files are not related to the PR
cc. @sainak

@shivankacker shivankacker self-assigned this Sep 2, 2024
filters.DjangoFilterBackend,
rest_framework_filters.OrderingFilter,
PatientCustomOrderingFilter,
)
filterset_class = PatientFilterSet
filterset_class = DischargePatientFilterSet
queryset = (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shivankacker This seems like a pretty complex query. Can you add a simple comment about what this filter does?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@anroopak I have added some documentation for the filter, please have a look

Copy link
Member

@vigneshhari vigneshhari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignore this approval

@vigneshhari vigneshhari merged commit c7637ea into develop Sep 23, 2024
7 of 8 checks passed
@vigneshhari vigneshhari deleted the discharge-admitted-to-filter branch September 23, 2024 07:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants