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

Incidents: Add optional patient impacted field #2493

Closed
blestab opened this issue Dec 6, 2020 · 10 comments · Fixed by #2532
Closed

Incidents: Add optional patient impacted field #2493

blestab opened this issue Dec 6, 2020 · 10 comments · Fixed by #2532
Assignees
Labels
🚀enhancement an issue/pull request that adds a feature to the application good first issue indicates an issue is good for a first time contributor in progress indicates that issue/pull request is currently being worked on incidents
Milestone

Comments

@blestab
Copy link
Contributor

blestab commented Dec 6, 2020

🚀 Feature Proposal

When recording a new incident or editing an existing one, add the ability to specify the impacted patient. This field will be optional.

Motivation

Some incidents impact patients while others will not. The system should provide a way to specify an impacted patient (if any)

Technical Details

Incident Model

Add an optional patient field:

patient?: string

Report Incident Form

Add an optional "Impacted Patient" field which updates the new patient field on the incident model
The user must either specify an existing patient or leave the field blank

NOTE; See the Request Lab form for an example of how to add the patient form element to the report incident form

@blestab blestab transferred this issue from HospitalRun/hospitalrun Dec 6, 2020
@blestab blestab added good first issue indicates an issue is good for a first time contributor help wanted indicates that an issue is open for contributions incidents 🚀enhancement an issue/pull request that adds a feature to the application labels Dec 6, 2020
@blestab blestab added this to the v2.0 milestone Dec 6, 2020
@CreaTorAlexander
Copy link

I would like to take it

@blestab blestab added in progress indicates that issue/pull request is currently being worked on and removed help wanted indicates that an issue is open for contributions labels Dec 12, 2020
@blestab
Copy link
Contributor Author

blestab commented Dec 12, 2020

Absolutely @CreaTorAlexander, thanks

@CreaTorAlexander CreaTorAlexander removed their assignment Dec 19, 2020
@rsousaj
Copy link
Contributor

rsousaj commented Dec 22, 2020

Hi, I think I can handle this one if its not under someone else development

@mattkuzco
Copy link
Contributor

Hi, can I be assigned to this issue?

@matteovivona
Copy link
Contributor

Wait a minute. Is anyone working on this? @blestab?

@blestab
Copy link
Contributor Author

blestab commented Dec 23, 2020

Wait a minute. Is anyone working on this? @blestab?

Looks like @CreaTorAlexander removed themself as an assignee, I am guessing that means they are no longer looking at it? I think @mattkuzco or @rsousaj could be assigned to take over this one.

@rsousaj
Copy link
Contributor

rsousaj commented Dec 23, 2020

Yeah @mattkuzco, go ahead buddy

@mattkuzco
Copy link
Contributor

Hey, sorry to bother :( I don't know if this is the best place to ask, but I'm having some trouble with the Typeahead component. I think I need the onInputChange callback to detect if the user is trying to enter a patient (to check if the field is blank, or in the case the patient doesn't exist to display an error message) but I'm not so confident with typescript so I'm not really sure how to add the callback. I tried editing the Typeahead.d.ts file and adding it there hoping it would be called from the typeahead.js but of course that's not the way

@rsousaj
Copy link
Contributor

rsousaj commented Dec 27, 2020

I don't think I'm the best here to help you but I'd like to try.

From what I've used, the component receives onChange and onSearch as callbacks.

  1. onSearch you pass a function that receive a string as argument and you return a Promise of the Search of that string from the Database.

  2. onChange is when the user select a Patient. In this case, this callback receive a Patient as argument (actually an array of Patient but with just one Patient) and then you update the incidente state.

So, I didn't understand why you need to display an error message. If the user type a search string that does not return a Patient, the field will be empty and perhaps its fine.

I hope I've helped.

Ps.: The Typeahead component is based on AsyncTypeahead from 'react-bootstrap-typeahead', if you want to know more.

@mattkuzco
Copy link
Contributor

mattkuzco commented Dec 27, 2020

Oh I thought about doing that, yeah for that onSearch and onChange are perfectly fine. It's just I wasn't sure if I had to it this way (pass a null patient on partial input) or prohibit inserting an incident when patient field contains invalid input. Thank you!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🚀enhancement an issue/pull request that adds a feature to the application good first issue indicates an issue is good for a first time contributor in progress indicates that issue/pull request is currently being worked on incidents
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants