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 M2M Consultation Diagnosis model #1690

Merged
merged 30 commits into from
Nov 8, 2023
Merged

Conversation

rithviknishad
Copy link
Member

@rithviknishad rithviknishad commented Oct 29, 2023

Proposed Changes

  • Added M2M model: ConsultationDiagnosis
  • Added boolean field is_principle
  • Added verification_status choice field (as per: https://www.hl7.org/fhir/valueset-condition-ver-status.html)
  • Deprecated diagnosis fields in Patient Consultation table
  • ⚠️ Custom Migration: Populate ConsultationDiagnosis table. icd11_diagnosis is mapped as Confirmed diagnosis and icd11_provisional_diagnosis is mapped as Provisional diagnosis
  • Updated discharge summary to reflect the same.
  • Added support for annotations in patient CSV export
  • Updated Patient CSV export to reflect new consultation diagnosis, dedicated column for each verification status + principal
  • Renamed PatientRelatedPermissionMixin to ConsultationRelatedPermissionMixin (see comment for details)

Associated Issue

Custom Migration

  • Populates confirmed diagnosis first and then provisional diagnosis for each consultation.
  • Skips any duplicate diagnosis for a specific consultation if any is encountered.

Architecture changes

  • Remove this section if not used

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

Functionality looks good to me @rithviknishad fix the test

@codecov
Copy link

codecov bot commented Oct 31, 2023

Codecov Report

Attention: 49 lines in your changes are missing coverage. Please review.

Comparison is base (92b99fd) 60.05% compared to head (8923d0d) 60.43%.
Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1690      +/-   ##
==========================================
+ Coverage   60.05%   60.43%   +0.38%     
==========================================
  Files         208      210       +2     
  Lines       11325    11473     +148     
  Branches     1607     1630      +23     
==========================================
+ Hits         6801     6934     +133     
- Misses       4300     4307       +7     
- Partials      224      232       +8     
Files Coverage Δ
...re/facility/api/viewsets/consultation_diagnosis.py 100.00% <100.00%> (ø)
...y/management/commands/load_icd11_diagnoses_data.py 85.41% <ø> (-0.30%) ⬇️
care/facility/models/icd11_diagnosis.py 97.77% <100.00%> (+2.32%) ⬆️
care/facility/static_data/icd11.py 91.66% <100.00%> (+21.66%) ⬆️
care/abdm/utils/fhir.py 31.36% <75.00%> (+0.31%) ⬆️
care/facility/api/viewsets/icd.py 40.00% <0.00%> (ø)
care/facility/api/viewsets/patient.py 62.45% <0.00%> (ø)
care/facility/models/mixins/permissions/patient.py 33.92% <83.33%> (+0.59%) ⬆️
care/facility/models/patient.py 93.82% <75.00%> (-1.03%) ⬇️
care/hcx/api/viewsets/gateway.py 44.23% <40.00%> (+0.96%) ⬆️
... and 4 more

... and 2 files with indirect coverage changes

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

@vigneshhari
Copy link
Member

@sainak review required

@rithviknishad
Copy link
Member Author

rithviknishad commented Nov 3, 2023

Additional changes:

PatientRelatedPermissionMixin has been renamed to ConsultationRelatedPermissionMixin as the mixin checks upon the fields self.patient and self.assigned_to which are specific to the consultation model and not the patient model.

It never failed so far in other places because:

  1. It was only inherited by the PatientNotes model and the Consultation model itself.
  2. It never failed so far for PatientNotes as we were not performing edit/object read with it (only create and list which was not dependent didn't have a check on assigned_to).

So the mixin has been renamed to: ConsultationRelatedPermissionMixin and a method has been added: get_related_consultation which defaults to return self.consultation and has been overridden in the ConsultationModel to return self.

Copy link
Member

@sainak sainak left a comment

Choose a reason for hiding this comment

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

LTGM

cc: @vigneshhari

@rithviknishad rithviknishad marked this pull request as draft November 3, 2023 16:55
@rithviknishad rithviknishad marked this pull request as ready for review November 3, 2023 17:21
@nihal467
Copy link
Member

nihal467 commented Nov 6, 2023

LGTM

Co-authored-by: Aakash Singh <mail@singhaakash.dev>
@vigneshhari vigneshhari merged commit cadfebf into master Nov 8, 2023
11 checks passed
@vigneshhari vigneshhari deleted the consultation_diagnoses_m2m branch November 8, 2023 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants