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

(feat) O3-3840 : Improvements to the registration form Death info section #1290

Merged
merged 1 commit into from
Aug 29, 2024

Conversation

usamaidrsk
Copy link
Collaborator

@usamaidrsk usamaidrsk commented Aug 21, 2024

Requirements

  • This PR has a title that briefly describes the work done including the ticket number. If there is a ticket, make sure your PR title includes a conventional commit label. See existing PR titles for inspiration.
  • My work conforms to the OpenMRS 3.0 Styleguide and design documentation.
  • My work includes tests or is validated by existing tests.

Summary

This PR makes the following changes to the Death info section of the registration form:

  • Replace the Is dead text field with a checkbox. This makes for better UX, as it's easier to understand and use.
  • Add a Date of death date picker and a Time of death date picker for capturing when the person died. The Date of death date picker also uses the OpenmrsDatePicker component under the hood, which means it has support for multiple calendar systems and improved localization out of the box.
  • Add a Cause of death dropdown field for recording the cause of death. The answers are taken from the Cause of death concept. If Other is selected, a text field is shown for the user to enter the non-coded cause of death.
  • Amend the registration app config schema to support the changes above.

Sample schema for testing this PR

Paste it into the JSON editor in the Implementer tools panel when running your dev server.

{
  "@openmrs/esm-patient-registration-app": {
    "registrationObs": {
      "encounterTypeUuid": "7b68d557-85ef-4fc8-b767-4fa4f5eb5c23"
    },
    "sections": [
      "demographics",
      "death"
    ],
    "fieldConfigurations": {
      "name": {
        "displayCapturePhoto": true,
        "displayMiddleName": false,
        "allowUnidentifiedPatients": false,
        "displayReverseFieldOrder": false
      }
    },
    "sectionDefinitions": [
      {
        "id": "demographics",
        "name": "Basic Information",
        "fields": [
          "name",
          "gender",
          "dob",
          "id"
        ]
      },
      {
        "id": "death",
        "name": "Death Information",
        "fields": [
          "dateAndTimeOfDeath",
          "causeOfDeath"
        ]
      }
    ]
  }
}

Screenshots

register-dead-patient.mp4

Related Issue

https://openmrs.atlassian.net/browse/O3-3840

Other

@usamaidrsk usamaidrsk self-assigned this Aug 21, 2024
@usamaidrsk usamaidrsk changed the title (feat) O3-3840; (feat) O3-3840: Enhance Death Info Section on Patient Registration and Configuration Aug 21, 2024
@vasharma05
Copy link
Member

@usamaidrsk , the video is not playing for me, can you please add a new video for me?
Thanks!

@usamaidrsk
Copy link
Collaborator Author

usamaidrsk commented Aug 22, 2024

@usamaidrsk , the video is not playing for me, can you please add a new video for me? Thanks!

I have replaced the video, check now!

Copy link
Member

@vasharma05 vasharma05 left a comment

Choose a reason for hiding this comment

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

Overall work done is good, but error scenarios are not handled at all, which will become an issue in the future.

Identified the error scenarios, we can take the PR forward after the same is done.
Thanks!

Copy link
Member

@vasharma05 vasharma05 left a comment

Choose a reason for hiding this comment

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

Overall work done is good, but error scenarios are not handled at all, which will become an issue in the future.

Identified the error scenarios, we can take the PR forward after the same is done.
Thanks!

Copy link
Member

@vasharma05 vasharma05 left a comment

Choose a reason for hiding this comment

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

Some nitpicks, looks good otherwise!

@denniskigen
Copy link
Member

Mind sharing what schema I can use to test this locally.

@usamaidrsk
Copy link
Collaborator Author

usamaidrsk commented Aug 23, 2024

Mind sharing what schema I can use to test this locally.

Yes @denniskigen , here is the schema you can test with.

{
  "@openmrs/esm-patient-registration-app": {
    "registrationObs": {
      "encounterTypeUuid": "7b68d557-85ef-4fc8-b767-4fa4f5eb5c23"
    },
    "sections": [
      "demographics",
      "death"
    ],
    "fieldConfigurations": {
      "name": {
        "displayCapturePhoto": true,
        "displayMiddleName": false,
        "allowUnidentifiedPatients": false,
        "displayReverseFieldOrder": false
      },
    },
    "sectionDefinitions": [
      {
        "id": "demographics",
        "name": "Basic Information",
        "fields": [
          "name",
          "gender",
          "dob",
          "id"
        ]
      },
      {
        "id": "death",
        "name": "Death Information",
        "fields": [
          "dateAndTimeOfDeath",
          "causeOfDeath"
        ]
      }
    ]
  }
}

@denniskigen
Copy link
Member

denniskigen commented Aug 23, 2024

Should we include a free text field below the Cause of Death dropdown to record a non-coded cause of death when the user selects Other as the cause of death? Similar to what we're doing here:

non-coded-cause-of-death.mp4

This isn't a blocker though and could be worked in in the future.

@denniskigen
Copy link
Member

Also, might it be worth showing a separate time picker to record the time of death?

@usamaidrsk
Copy link
Collaborator Author

usamaidrsk commented Aug 23, 2024

Also, might it be worth showing a separate time picker to record the time of death?

I can add this.

non-coded cause of death

I will add this as well
cc @denniskigen

@denniskigen
Copy link
Member

Does editing work correctly for the Cause of death fields?

@denniskigen
Copy link
Member

Good improvements with adding validations, @vasharma05. I think you also need to add the corresponding translation strings to get them to display correctly in the UI.

@vasharma05
Copy link
Member

vasharma05 commented Aug 28, 2024

I think you also need to add the corresponding translation strings to get them to display correctly in the UI.

Yes @denniskigen, I was missing on the translations. I have added them.
Thanks!

@denniskigen
Copy link
Member

Ok. Reviewing now.

@denniskigen denniskigen force-pushed the ft/3840 branch 2 times, most recently from f69a268 to a6114b0 Compare August 28, 2024 20:48
@denniskigen denniskigen changed the title (feat) O3-3840: Enhance Death Info Section on Patient Registration and Configuration (feat) O3-3840: Improvements to the registration form Death info section Aug 28, 2024
@denniskigen
Copy link
Member

denniskigen commented Aug 29, 2024

I will merge this PR shortly as it's a critical fix for the registration app (if the build passes). We should however ensure that the following loose ends are tied:

  • Fixes to the validation logic - the validation logic seems to be working non-deterministically. I don't know if this is an issue with the Yup validation schema or how the fields are validated.

  • Fix for an issue with translation strings not loading correctly in the form errors snackbar notification:

    CleanShot 2024-08-29 at 3  16 34@2x

  • Missing test coverage for the new components

@vasharma05 @usamaidrsk

@denniskigen denniskigen merged commit 87217e4 into openmrs:main Aug 29, 2024
6 checks passed
@denniskigen denniskigen mentioned this pull request Aug 29, 2024
3 tasks
@vasharma05 vasharma05 changed the title (feat) O3-3840: Improvements to the registration form Death info section (feat) O3-3840 : Improvements to the registration form Death info section Aug 30, 2024
@gracepotma
Copy link
Contributor

@usamaidrsk thank you so much for your work on this. Can you please file tickets for the remaining tasks that Dennis mentioned above? He was expecting you to but I think this maybe wasn't so clear :P :)

@usamaidrsk
Copy link
Collaborator Author

@usamaidrsk thank you so much for your work on this. Can you please file tickets for the remaining tasks that Dennis mentioned above? He was expecting you to but I think this maybe wasn't so clear :P :)

Yeah, thanks @gracepotma for the reminder.
Going to create them.

@brandones
Copy link
Contributor

@usamaidrsk Please post links to the tickets here once you create them.

@usamaidrsk
Copy link
Collaborator Author

@usamaidrsk thank you so much for your work on this. Can you please file tickets for the remaining tasks that Dennis mentioned above? He was expecting you to but I think this maybe wasn't so clear :P :)

Yeah, thanks @gracepotma for the reminder. Going to create them.

Here is the follow-up ticket https://openmrs.atlassian.net/browse/O3-3907

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