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

refactor discharge summary endpoints #1252

Merged
merged 20 commits into from
May 16, 2023

Conversation

sainak
Copy link
Member

@sainak sainak commented Apr 14, 2023

Proposed Changes

  • update patient discharge summary
  • move discharge routes to consultation viewset as it is more related to consultation
  • discharge and discharge summary now require consultation id
  • discharge summary is now generated and stored on s3 as soon as the patient is discharged, and is fetched from s3 for email and preview

new summary fromat:
8b7a659a-d59e-4c8b-bb30-27f95b142ebb1681659555.pdf

@coronasafe/code-reviewers

Merge Checklist

  • Tests added/fixed
  • Update docs in /docs
  • Linting Complete

@sainak sainak requested a review from a team as a code owner April 14, 2023 10:56
@sainak sainak added the P1 High priority; urgent label Apr 14, 2023
@codecov-commenter
Copy link

codecov-commenter commented Apr 14, 2023

Codecov Report

Patch coverage: 37.57% and project coverage change: +0.23 🎉

Comparison is base (cd15b6e) 56.18% compared to head (2e85e0c) 56.41%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1252      +/-   ##
==========================================
+ Coverage   56.18%   56.41%   +0.23%     
==========================================
  Files         195      195              
  Lines        9625     9658      +33     
  Branches     1615     1615              
==========================================
+ Hits         5408     5449      +41     
+ Misses       4162     4154       -8     
  Partials       55       55              
Impacted Files Coverage Δ
care/facility/api/viewsets/patient.py 52.23% <25.00%> (+6.86%) ⬆️
care/facility/static_data/icd11.py 78.78% <25.00%> (-17.22%) ⬇️
care/facility/tasks/patient/discharge_report.py 36.36% <30.35%> (+7.19%) ⬆️
care/facility/models/file_upload.py 67.21% <30.76%> (-2.60%) ⬇️
care/facility/api/viewsets/patient_consultation.py 51.61% <40.00%> (-11.66%) ⬇️
...e/facility/api/serializers/patient_consultation.py 36.61% <44.44%> (+3.28%) ⬆️
care/facility/models/patient_consultation.py 93.42% <50.00%> (-2.42%) ⬇️
care/facility/templatetags/filters.py 40.90% <71.42%> (+14.24%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@sainak sainak marked this pull request as draft April 14, 2023 11:12
@sainak sainak marked this pull request as ready for review April 14, 2023 11:21
@sainak
Copy link
Member Author

sainak commented Apr 14, 2023

required for coronasafe/care_fe#5246

care/facility/api/viewsets/patient_consultation.py Outdated Show resolved Hide resolved
if summary.upload_completed:
return Response(FileUploadRetrieveSerializer(summary).data)

if summary.created_date <= timezone.now() - timedelta(minutes=2):
Copy link
Member

Choose a reason for hiding this comment

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

What edge case are we solving here?

care/facility/tasks/patient/discharge_report.py Outdated Show resolved Hide resolved
associating_id=consultation.external_id,
).first()

if file_db_entry is None:
Copy link
Member

Choose a reason for hiding this comment

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

So the patient only has one discharge summary object?

if (
summary is not None
and not summary.upload_completed
and summary.created_date <= timezone.now() - timedelta(minutes=2)
Copy link
Member

Choose a reason for hiding this comment

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

should we maintain time restrictions in a system that is designed to be asynchronous?

},
ExpiresIn=2 * 24 * 60 * 60, # seconds
)
return signed_url
Copy link
Member

Choose a reason for hiding this comment

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

Where is this function used ?

@sainak sainak linked an issue Apr 18, 2023 that may be closed by this pull request
…ed count (#1286)

Add validation for current bed count to be LESSER than total bed count in FacilityCapacitySerializer
@nihal467
Copy link
Member

nihal467 commented May 5, 2023

@sainak what is the status on this PR

@sonarcloud
Copy link

sonarcloud bot commented May 9, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

Bug B 6 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@rithviknishad
Copy link
Member

@vigneshhari @sainak just a cautionary reminder/note:

Upon merging #1247 the dischare_prescriptions and discharge_prn_prescriptions are no longer JSON fields but a separate Model.

@rithviknishad
Copy link
Member

@sainak unable to download discharge summary. Am I missing some setup's to be done locally?

image

cc: @nihal467

@rithviknishad rithviknishad changed the base branch from master to med-admin-record May 16, 2023 07:35
@rithviknishad rithviknishad merged commit e658eee into med-admin-record May 16, 2023
5 of 6 checks passed
@sainak sainak deleted the feat/discharge-summary branch June 2, 2023 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 High priority; urgent waiting-for-review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Simplify the Discharge View by Converting it to a Serializer
7 participants