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

WIP - Add ability to create a patient when adding a related person that does not exist #2207

Closed
wants to merge 18 commits into from

Conversation

JDarke
Copy link
Contributor

@JDarke JDarke commented Jul 7, 2020

Fixes #2106 .

Changes proposed in this pull request:

Current Functionality:

  1. If no match found in AddNewRelatedPanel search field, Save button click reveals CreateRelatedPersonPanel
  2. If Relationship Type field is left blank in AddNewRelatedPanel, filling in the matching field in CreateRelatedPersonPanel automatically copies the value to AddNewRelatedPanel, but will not overwrite an existing value (needs fixing)
  3. CreateRelatedPersonPanel successfully creates new patient record if required fields are supplied
  4. New patient must then still be added using the AddNewRelatedPanel.

Required functionality:

  1. After dispatching the new patient creation action, the id of the new patient should be captured and used to dispatch an addRelatedPerson action on the existing patient, rather than having to do it manually as in point 4 above.
  2. The Relationship Type field in AddNewRelatedPanel should take its value from Realtionship Type field in CreateRelatedPersonPanel, over-writing existing value if it exists.
  3. The Given Name and Relationship Type fields in CreateRelatedPersonPanel should autopopulate from the Related Person and Relationship Type fields in AddNewRelatedPanel.

Basically, the two Relationship Type fields should be synced, either in realtime or when either Save button is pressed, as should the respective Related Person and Given Name fields. If point 1 of the required functionality is achieved, then this only needs to happen in one direction, from AddNewRelatedPanel to CreateRelatedPersonPanel.

I'm submitting the PR at this stage as while I can see some ways to achieve the goals, such as adding referral props to the patient model, but that starts to seem a little messy and I'd mainly like some feedback on the following:

  1. Is the overall structure of the feature viable / advisable so far, or do I need to back up a few steps and rethink it?
  2. Is there a clean way to capture the id of the newly created patient after it is dispatched, without having to add entirely new functionality to the patient creation process?
  3. If not, is it more advisable to simply dispatch the new patient creator, then autopopulate the Related Person and Relationship fields in AddNewRelatedPanel from the values in the Given Name and Relationship fields in the CreateRelatedPersonPanel, and have the user manually confirm the final step there?

General tips and advice also welcome!

@gitpod-io
Copy link

gitpod-io bot commented Jul 7, 2020

@jackcmeyer jackcmeyer marked this pull request as draft July 8, 2020 01:03
@vercel
Copy link

vercel bot commented Jul 11, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/hospitalrun/hospitalrun-frontend/1gous11d2
✅ Preview: https://hospitalrun-frontend-git-fork-jdarke-addnewrelated.hospitalrun.vercel.app

@vercel vercel bot temporarily deployed to Preview July 11, 2020 08:29 Inactive
Copy link
Member

@jackcmeyer jackcmeyer left a comment

Choose a reason for hiding this comment

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

Haven't looked too much at the code, but some initial comments:

  • I think we should create a PatientQuickAdd component which only asks the user for given name, family name, sex, and dob.
  • We should only have on save/cancel button on the screen. The add related person redux thunk can start to accept two parameters, relatedPerson and newPatient or something like that. If the newPatient is present then it will first create the new patient then associate that to the related person.

@JDarke
Copy link
Contributor Author

JDarke commented Jul 16, 2020

@jackcmeyer Thanks for that - makes sense, I'll get on it.

@matteovivona matteovivona added the in progress indicates that issue/pull request is currently being worked on label Jul 30, 2020
@JDarke
Copy link
Contributor Author

JDarke commented Aug 14, 2020

Hey, Jack, sorry for the delay on this....had some deadlines to meet elsewhere. Working on it now!

@matteovivona
Copy link
Contributor

@JDarke need help?

@JDarke
Copy link
Contributor Author

JDarke commented Aug 25, 2020

@JDarke need help?

Thnaks, @tehkapa , that's much appreciated. I may take you up on the offer in a few days, but I think I have a solution. I've just been ridiculously busy over the past few weeks.

If this issue is holding up progress elsewhere, just let me know and I'll pass it on to someone else, but I'd really like to finish this one if possible!

@matteovivona matteovivona added this to the v2.0 milestone Aug 30, 2020
@jackcmeyer jackcmeyer closed this Sep 15, 2020
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ability to create a patient when adding a related person that does not exist
3 participants