care icon indicating copy to clipboard operation
care copied to clipboard

Dropped `age` column from patient registration and annotated age in patient viewset

Open rithviknishad opened this issue 11 months ago • 1 comments

Proposed Changes

  • Dropped DB field age from Patient Registration
  • Adds field death_datetime in Patient Registration
  • Custom Migration to copy last_consultation's death_datetime to patient registration if present
  • Updated consultation save method to update patient registration's death_datetime too if consultation has death_datetime.
  • Annotated patient viewset with age to calculate age based on data of birth/year of birth up to date of death or now.

Associated Issue

  • https://github.com/coronasafe/care_fe/issues/7383
  • FE: https://github.com/coronasafe/care_fe/pull/7411

[!NOTE]

Custom Migrations

  • Populates PatientRegistration.death_datetime with instance.last_consultation.death_datetime if present.

Screenshots

POST /api/v1/patient/ - Patient Create's request body: image

GET /api/v1/patient/ - Patient List's updated filters and response body: image

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

rithviknishad avatar Mar 12 '24 09:03 rithviknishad