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-2953: Add the ability to edit and delete vitals and biometrics #1812

Conversation

senthil-athiban
Copy link
Contributor

@senthil-athiban senthil-athiban commented Apr 25, 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 enables editing or deleting vitals and biometrics data from the Patient Chart. In edit mode, obs are retrieved using the encounter UUID and displayed in the form. When deleting data, the encounter UUID is used to void observations.

Screenshots

https://www.loom.com/share/b47c4ddf00724b6d97c17d71513d37c8?sid=19a6b632-fea9-4c09-9c84-03e41a7f6847

Related Issue

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

@senthil-athiban senthil-athiban force-pushed the feature/vitals-biometrics-crud-actions branch 2 times, most recently from bfd0a01 to 7685482 Compare April 25, 2024 13:02
@denniskigen
Copy link
Member

pulling @denniskigen @ibacher @vasharma05 , as due to register workspace deprecated in this PR. The workspace doesn't seem to work for me from my side. is that same on your side as well, couldn't access the workspace? Screenshot (977) Screenshot (978)

Rebasing against main and then doing a hard reload in your browser should fix this.

@senthil-athiban
Copy link
Contributor Author

thanks @denniskigen. Working as expected!

@senthil-athiban senthil-athiban force-pushed the feature/vitals-biometrics-crud-actions branch from f046907 to 52628d5 Compare May 8, 2024 05:08
@denniskigen denniskigen requested a review from samuelmale May 22, 2024 11:54
Copy link
Member

@ibacher ibacher left a comment

Choose a reason for hiding this comment

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

Thanks for this! A few comments and things that should be addressed.

} catch (error) {
createErrorHandler();
showSnackbar({
title: t('vitalsAndBiometricsDeleteError', 'Error Deleting Vitals and Biometrics'),
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
title: t('vitalsAndBiometricsDeleteError', 'Error Deleting Vitals and Biometrics'),
title: t('vitalsAndBiometricsDeleteError', 'Error deleting Vitals and Biometrics'),

packages/esm-patient-vitals-app/translations/en.json Outdated Show resolved Hide resolved
packages/esm-patient-vitals-app/translations/en.json Outdated Show resolved Hide resolved
packages/esm-patient-vitals-app/translations/en.json Outdated Show resolved Hide resolved
packages/esm-patient-vitals-app/translations/en.json Outdated Show resolved Hide resolved
@denniskigen
Copy link
Member

@senthil-k8s so one of the main things to take care of here is that deleting vitals and biometrics data should void the observations instead of deleting the encounter.

@denniskigen denniskigen changed the title feat(O3-2953): Implemented Edit and Delete Actions for Vitals and Biometrics forms (feat) O3-2953: Add the ability to edit and delete vitals and biometrics May 22, 2024
@senthil-athiban senthil-athiban force-pushed the feature/vitals-biometrics-crud-actions branch from 27b225c to 0dd058f Compare May 25, 2024 07:52
@denniskigen
Copy link
Member

@ibacher so what's the ideal approach for @senthil-k8s to pursue w.r.t to voiding the observations using the Delete action?

@senthil-athiban senthil-athiban force-pushed the feature/vitals-biometrics-crud-actions branch from 0f74de6 to e41cb59 Compare June 3, 2024 12:40
@senthil-athiban
Copy link
Contributor Author

senthil-athiban commented Jun 4, 2024

@denniskigen When editing vitals and biometrics (i.e., updating existing observations), my current approach results in creating a new observation each time a user edits the vitals. Is there a better approach to edit the vitals without creating new observations every time?

@denniskigen
Copy link
Member

@samuelmale do you mind clarifying what the approach should look like?

@ibacher
Copy link
Member

ibacher commented Jun 4, 2024

I think this is where EMR API could actually be helpful, but I'm not sure what the specific API to use there is. Otherwise, yes, I think the only real option is a request-per-obs.

@samuelmale
Copy link
Member

samuelmale commented Jun 4, 2024

I think we just have to grep and group obs by a derived category ie. "vitals" vs "biometrics" and then simply mark them as voided:

function getVitalsObs(encounter: Encounter): Array<OpenmrsResource> {
   // return vitals specific observations
}

function deleteVitals(encounter: Encounter) {
   const vitalsToBeVoided = getVitalsObs(encounter).map(obs => ({ uuid: obs.uuid, voided: true }));
   // You can either save them all at once as part of the encounter OR save them individually using the Obs endpoint.
}

I prefer saving all the voided obs apart of the encounter object in a single shot.

@senthil-athiban
Copy link
Contributor Author

@samuelmale, @denniskigen, could you please let me know if my approach makes sense?

https://www.loom.com/share/c85f115c1e8b417a9f920b2f3b93e8b5

@denniskigen denniskigen requested a review from brandones June 12, 2024 11:35
@denniskigen denniskigen force-pushed the feature/vitals-biometrics-crud-actions branch from ded9476 to 31c7b22 Compare June 13, 2024 10:26
@denniskigen
Copy link
Member

@senthil-k8s I've squashed your commits into a single one to ensure a cleaner commit history. This should simplify future rebasing and merges.

Thank you for your understanding and contributions!

@denniskigen denniskigen force-pushed the feature/vitals-biometrics-crud-actions branch from 31c7b22 to 9e8e6a2 Compare June 13, 2024 10:42
@denniskigen denniskigen force-pushed the feature/vitals-biometrics-crud-actions branch 3 times, most recently from 483caaf to 6a6eac3 Compare June 14, 2024 11:43
@denniskigen denniskigen force-pushed the feature/vitals-biometrics-crud-actions branch from 6a6eac3 to 67450f5 Compare June 14, 2024 11:48
@denniskigen
Copy link
Member

Ok, thanks, guys! Looks like this is good to go!

@denniskigen denniskigen merged commit 8427782 into openmrs:main Jun 14, 2024
6 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