Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Edit patient details #1765

Closed
jackcmeyer opened this issue Jan 21, 2020 · 11 comments · Fixed by #1806 or #1826
Closed

Edit patient details #1765

jackcmeyer opened this issue Jan 21, 2020 · 11 comments · Fixed by #1806 or #1826
Assignees
Labels
in progress indicates that issue/pull request is currently being worked on patients issue/pull request that interacts with patients module v2.x
Projects

Comments

@jackcmeyer
Copy link
Member

Scenario

AS

A user with write access to patients

I WANT

The ability to edit patient details

SO THAT

I can have more accurate patient information or change the patient information when needed.

Acceptance Criteria

GIVEN

An existing patient and a user with write access to the patient

WHEN

I click the edit button the on patients page

THEN

The fields become editable

AND

a save and cancel button toolbar appear at the bottom of the screen

AND

when I click the button, then the updated patient details are persisted

AND

I get a success message saying I have successfully updated the patient details.

Related Issues

HospitalRun/hospitalrun-frontend#1671

Technical Notes

@MatthewDorner
Copy link
Contributor

I can work on this.

@jackcmeyer
Copy link
Member Author

@MatthewDorner all yours!

I would wait until #1738 gets merged to start implementing the database stuff, since this should provide a nice function to update fields with.

However, this shouldn't block doing some of the UI part of this work.

@fox1t
Copy link
Member

fox1t commented Jan 26, 2020

@MatthewDorner nice!

@jackcmeyer jackcmeyer transferred this issue from HospitalRun/hospitalrun-frontend Jan 26, 2020
@matteovivona matteovivona transferred this issue from HospitalRun/hospitalrun Jan 29, 2020
@matteovivona
Copy link
Contributor

@jackcmeyer #1738 merged

@matteovivona matteovivona added in progress indicates that issue/pull request is currently being worked on good first issue indicates an issue is good for a first time contributor v2.x patients issue/pull request that interacts with patients module labels Jan 29, 2020
@jackcmeyer jackcmeyer removed the good first issue indicates an issue is good for a first time contributor label Jan 30, 2020
@MatthewDorner
Copy link
Contributor

Still working on this. Trying to see if I can just use the GeneralInformation form as New/Edit patient instead of having additional form, but getting in trouble with logic around saving and loading the model, Redux state, and state + props for the form.

I found the code for loading Patients is also currently bugged. The Spinner in ViewPatient never gets shown because it's checking for !patient, but useSelector returns an empty object when patient state is empty. But even if we did check for empty object this wouldn't suffice as the patient state could already be loaded with an old Patient you were looking at and there's no way to tell the difference.

Also if you view one Patient with all the fields filled in and then go view a Patient where those fields are supposed to be blank, you will still see the values from the first Patient in those fields, but I think this is a separate bug.

@jackcmeyer
Copy link
Member Author

I'm digging into why the component is not updating when the new patient gets loaded.

The store is getting updated, but the component is not reflecting those changes.

@MatthewDorner
Copy link
Contributor

It must be something to do with empty strings.

@jackcmeyer
Copy link
Member Author

jackcmeyer commented Feb 2, 2020

After further investigation,

This seems like an issue with The TextInput and TextField components in the hospitalrun/components library.

I verified and all of components are getting passed the proper data, however, TextInput and TextField are just not displaying them properly.

I verified this by swapping out TextInput and TextField with just a normal input field and in TextFieldWithLabelFormGroup and TextInputWithLabelFormGroup and the screen worked as expected.

I've opened an issue here to track the work: HospitalRun/components#259

@fox1t
Copy link
Member

fox1t commented Feb 2, 2020

It must be something to do with empty strings.

I really want to avoid passing empty strings for "signaling" that is a new patient. Do you have any alternative ideas, @MatthewDorner ?

After further investigation,

This seems like an issue with The TextInput and TextField components in the hospitalrun/components library.

I verified and all of components are getting passed the proper data, however, TextInput and TextField are just not displaying them properly.

I verified this by swapping out TextInput and TextField with just a normal input field and in TextFieldWithLabelFormGroup and TextInputWithLabelFormGroup and the screen worked as expected.

I've opened an issue here to track the work: HospitalRun/components#259

Good findings @jackcmeyer!

@MatthewDorner
Copy link
Contributor

MatthewDorner commented Feb 4, 2020

I've written a draft that I think will work. It uses GeneralInformation as the form for New, Edit, and View Patient, and NewPatient, EditPatient, ViewPatient containers that manage fetching and saving data and which contain the state.

MatthewDorner/hospitalrun-frontend@MatthewDorner:master...MatthewDorner:edit-patient-draft-3

I have to fix all the tests now, so while I do that, any comments or suggestions are welcome.

EDIT: Also kind of changed Approximate Age and DOB stuff in merging the two forms. Now it only shows either Date of Birth OR Approximate Age, based on whether the "Unknown" is checked, I can make it different if desired. Also the checkbox has no way to set its value, no value prop so that doesn't work exactly right.

@fox1t
Copy link
Member

fox1t commented Feb 5, 2020

If you want, feel free to open a PR so we can discuss it there.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
in progress indicates that issue/pull request is currently being worked on patients issue/pull request that interacts with patients module v2.x
Projects
Version 2.0
  
Done
4 participants