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

fix prescriptions migration #1305

Merged
merged 12 commits into from
May 24, 2023
Merged

Conversation

rithviknishad
Copy link
Member

@rithviknishad rithviknishad commented May 19, 2023

Proposed Changes

  • Adds missing migration for file upload (added discharge summary option)
  • Alter prescription fields to be nullable except medicine. (only dosage had to be made nullable, the rest was already done).
  • Ensured serializer does proper validation (no code changes were required here).
  • Reordered the migrations.
  • Clean the existing prescription data while migrating.
  • Skips creating the Prescription if Medicine is missing from old data.
  • Alter medicine field: Increased length to 1023 (failed with 100 and 255).
  • Rounds float values to the nearest int for integer fields (min hours between doses and days).
  • Alter prescribed_by field: set null=True as consultation.created_by is also null=True.
  • Detects which field is frequency and dosage and extracts values accordingly as shown in the screenshot.
    image

Tested Migrations with a staging duplicate DB

image

@coronasafe/code-reviewers

Merge Checklist

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

@codecov-commenter
Copy link

codecov-commenter commented May 19, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.01 ⚠️

Comparison is base (041a75f) 56.72% compared to head (14174c2) 56.72%.

❗ 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    #1305      +/-   ##
==========================================
- Coverage   56.72%   56.72%   -0.01%     
==========================================
  Files         198      198              
  Lines        9840     9841       +1     
  Branches     1640     1641       +1     
==========================================
  Hits         5582     5582              
- Misses       4203     4204       +1     
  Partials       55       55              
Impacted Files Coverage Δ
care/facility/models/prescription.py 82.35% <100.00%> (ø)

... and 1 file with indirect coverage changes

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

@rithviknishad rithviknishad marked this pull request as ready for review May 20, 2023 06:15
@rithviknishad rithviknishad requested a review from a team as a code owner May 20, 2023 06:15
@sonarcloud
Copy link

sonarcloud bot commented May 24, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot E 1 Security Hotspot
Code Smell A 6 Code Smells

No Coverage information No Coverage information
14.2% 14.2% Duplication

@rithviknishad rithviknishad merged commit 7979928 into master May 24, 2023
yaswanthsaivendra pushed a commit to yaswanthsaivendra/care that referenced this pull request May 30, 2023
* nullable dosage, re-order and adds missing fileupload migration

* clean prescriptions data when migrating

* skip if medicine is none

* nullable prescribed_by and set default for notes

* increase medicine max_length to 256

* round off min_hours_between_doses

* increase medicine max_length to 1023

* round off days

* clean int: return None if empty string or other exceptions

* squash migrations

* merge migrations
@sainak sainak deleted the fix-med-admin-record-migration branch June 6, 2023 15:42
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.

3 participants