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

track previous consultation #1907

Merged
merged 4 commits into from
Mar 24, 2024
Merged

Conversation

Omkar76
Copy link
Contributor

@Omkar76 Omkar76 commented Feb 22, 2024

Proposed Changes

  • Brief of changes made.
    • added a migration to add foreign key previous_consultation and also to populate this columns values on older records.
    • added some more patientconsultation objects to factility.json for same patient (id: 18).
    • updated create method of serializer to assign value to previous_consultation when creating new consultation.

Associated Issue

#1806
Implemented as per last comment from Rithvik, tracking previous consultation without considering the number of days <30 criteria. That's handled by another existing field is_readmission.

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

@Omkar76
Copy link
Contributor Author

Omkar76 commented Feb 22, 2024

after running the migration, printed the consultation to verify values. just make sure dummy data is loaded before running this migration.

from care.facility.models.patient_consultation import PatientConsultation
import datetime

pc = PatientConsultation.objects.all()
for c in pc:
    print([c.id, c.patient.id, None if c.previous_consultation is None else c.previous_consultation.id, c.created_date.strftime("%d/%B/%Y")])
consultationid, patientid, previous_consultation, created_date
[25, 18, None, '06/February/2022']
[24, 18, 25, '06/May/2022']
[1, 1, None, '27/September/2022']
[26, 18, 24, '06/August/2023']
[2, 2, None, '06/December/2023']
[3, 3, None, '06/December/2023']
[4, 4, None, '06/December/2023']
[5, 5, None, '06/December/2023']
[6, 6, None, '06/December/2023']
[7, 7, None, '06/December/2023']
[8, 8, None, '06/December/2023']
[9, 9, None, '06/December/2023']
[10, 10, None, '06/December/2023']
[11, 11, None, '06/December/2023']
[12, 12, None, '06/December/2023']
[13, 13, None, '06/December/2023']
[14, 14, None, '06/December/2023']
[15, 15, None, '06/December/2023']
[16, 16, None, '06/December/2023']
[17, 17, None, '06/December/2023']
[18, 18, 26, '06/December/2023']
[19, 18, 18, '07/December/2023']
[20, 18, 19, '15/December/2023']
[21, 18, 20, '30/January/2024']
[22, 18, 21, '28/February/2024']
[23, 18, 22, '01/April/2024']

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.

^

Co-authored-by: Aakash Singh <mail@singhaakash.dev>
Copy link

codecov bot commented Feb 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (411e89c) 61.83% compared to head (dbcc4b8) 61.84%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1907   +/-   ##
=======================================
  Coverage   61.83%   61.84%           
=======================================
  Files         221      221           
  Lines       12163    12165    +2     
  Branches     1735     1735           
=======================================
+ Hits         7521     7523    +2     
  Misses       4334     4334           
  Partials      308      308           

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

@sainak
Copy link
Member

sainak commented Feb 22, 2024

@Omkar76 fix lint issues

@sainak
Copy link
Member

sainak commented Feb 22, 2024

and make sure that you have added precommit hook, run pre-commit install
it will auto resolve these issue before you make a commit

@Omkar76
Copy link
Contributor Author

Omkar76 commented Feb 22, 2024

@sainak sorry, what's command to format without the hook.

Edit: I linted by first running isort . then git commit which triggered precommit hook

@sainak
Copy link
Member

sainak commented Feb 22, 2024

@sainak sorry, what's command to format without the hook.

pre-commit run --files $(git diff --name-only origin/master...HEAD)

@vigneshhari vigneshhari merged commit 55a7581 into ohcnetwork:develop Mar 24, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants