question

Chandler avatar image
0 Likes"
Chandler asked Chandler commented

How to give a doctor a preferred number of patients?

I want to know if there is a way to do this. Let's say that I want doctors to have no more than 6 patients at a time. They will not be acquired always by the patient, but while the patient is in the model, the doctor is their doctor.

If I have the right number of doctors, I could maybe get the results I need by using utilization as a way to decide which to acquire, but let's assume I have slightly fewer than I need.

I would want to assign randomly/by utilization/by some other factor until I reach the preferred maxiumum, at which point I only want to assign to that doctor if all of the doctors in the group have reached their maximum.

I would think that I would want to dynamically manage list order of doctors, perhaps? Or, that there is something built in that could handle this.We are wondering, but have not yet tested, what is the function of "Operator capacity"? Is that by chance a feature that would allow multiple patients to keep the doctor acquired during their entire stay, up to a maximum number?

--
As usual, I'm just looking for the right tool to figure it out. I read a few posts from a while back mentioning global processes but I'm not certain that's the right fit here.

FlexSim 23.1.1
healthcareresources
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Julie Weller avatar image Julie Weller commented ·

Hi @Chandler, was one of Matthew Gillespie's or Julie Weller's answers helpful? If so, please click the "Accept" button at the bottom of the one that best answers your question. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always comment back to reopen your question.

0 Likes 0 ·
Matthew Gillespie avatar image
1 Like"
Matthew Gillespie answered Chandler commented

Here's an example using the Filter By field on the Staff resource. PatientsPerDoctor.fsm

First I added a NumPatients field to the Staff list.

1692204145919.png

Then I reference Num Patients in the Sort By and Filter By fields. The model has a Model Parameter called PatientsPerDoctor where you can change how many patients each doctor can have at a time. (We need the curly braces around the parameter so that the query executes that part as FlexScript to turn it into a number)

1692204020608.png

In the patient flow the patient adds themselves to the MD's Patients array label when it first acquires the MD, and then removes themselves from that label when they leave.


· 8
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Chandler avatar image Chandler commented ·

This is really interesting - nice to see some useful parts of the software I haven't stumbled upon before. I like the cleanliness of the method and going directly into the staff table makes a lot of sense to me. (Not to mention, it works as desired!)

Is there a way that I can reference that field into a label on the staff so that I can see it written out in the properties panel next to the Patients list?

Ideally it would look like this:

1692286310907.png


0 Likes 0 ·
1692286310907.png (14.8 KiB)
Matthew Gillespie avatar image Matthew Gillespie ♦♦ Chandler commented ·
No, but you could easily update that label at the same time the patient adds/removes themselves from the Patients label.
1 Like 1 ·
Chandler avatar image Chandler commented ·

EDIT: For future reference, this note was added by Chandler after a solution was reached. This method works, but there are a few key points reviewed further down in this thread. The key contents of this message are now in bold below - the parts of this comment that are not bold are tangential to the conversation.

Also - I think this breaks if the doctor has been released by a patient and then needs to be reacquired, but in the meantime has reached the limit of patients. The patient then can't look for the same doctor because the list is empty.

We assign staff to a token label after initial acquire. ( token.MD or token.Nurse). For a Nurse:

  • If token.Nurse doesn't have a value, use the model parameter so they don't overload the staff.
  • If token.Nurse has a value, use some large number so that the Nurse is not filtered out.


I don't know the syntax. Flexscript seems to be mostly C# but this doesn't work:

  • NumPatients < {(patient.Nurse?) ? Model.parameters.PatientsPerNurse : 1000}

Any way to do an inline conditional in flexscript inside the SQL query? Or where else could I handle this check?



0 Likes 0 ·
Matthew Gillespie avatar image Matthew Gillespie ♦♦ Chandler commented ·

No, that works fine. You can see it in the model I posted. The patient releases and reacquires the same doctor multiple times without any issue. This is because the patient adds themselves to the doctor's Patients label when they first acquire the doctor, and then don't remove themselves from that list until the very end (once they're done using the doctor for good).

I don't understand what you're asking after that first paragraph. Why are you acquiring the nurse if you already acquired it and have it stored on the Nurse label? Or is this the same thing you're talking about in the first paragraph?
0 Likes 0 ·
Chandler avatar image Chandler Matthew Gillespie ♦♦ commented ·

In my model I'm not actually keeping the nurse acquired through all of the processes. If we are ruling out the nurse for selection on a future Acquire Staff based on having a full patient load, wouldn't the same patient (who would ordinarily acquire the previously acquired nurse) only be looking at a list which has already ruled out that nurse?

Or, does it automatically acquire the same nurse and ignore the filter?

---

My last post was all on the same topic, sorry for the lack of clarity. It was a question and a demonstration of a solution that I was trying at the time..

0 Likes 0 ·
Show more comments
Julie Weller avatar image
1 Like"
Julie Weller answered Julie Weller commented

Hi @Chandler! I think there are probably a lot of ways to do that. One would be by adding a label to the doctor, something like this:

1692130711137.png

Then, when that doctor is acquired the first time increment that label. On the patient put a similar label that references the doctor. When they leave the system, access the doctor label on the patient and decrement the label on the doctor.

You could have a loop in process flow that checks if all the doctors are full and then assigns patients randomly or based on who has the least.

A less scale-able option would be to push the patients to a list for each doctors and then check how many values are on that list and then pull them off the list just before they exit.

If you want more help, you could toggle this post to private and post a model or post a sample model and we can take a closer look at helping you implement that! Someone else might have some ideas too :)


1692130711137.png (19.0 KiB)
· 8
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Julie Weller avatar image Julie Weller commented ·
Also operator capacity has to do with the capacity for the person to carry objects (it has more application in the standard environment) then with the capacity of them to juggle patients, though you could probably set that as the usual max patients and that would give you an easy way to check and change that value.
1 Like 1 ·
Julie Weller avatar image Julie Weller commented ·

Here's a sample model based on the HC tutorials that shows how you can set labels on the doctors to track the number of patients.

HC_DoctorLabelsTest.fsm

If the label is higher than 6, you would just need to add a decide before you acquire the doctor. I added the label on each doctor and nurse individually in 3D view here:

1692133176975.png

And then I set the labels in the process flow. I put big black arrows by the Activities I added to my original model to get it to work correctly so you can find them easily:

1692133245117.png

I hope that helps things!

1 Like 1 ·
1692133176975.png (27.1 KiB)
1692133245117.png (16.5 KiB)
Chandler avatar image Chandler Julie Weller commented ·

I made some changes to this model to get it functioning as expected:

1. Added the patients to an array on the MD and Nurse. This isn't useful yet but I think it's desirable functionality.

2. Added the SQL query in the sort by field as NumOfPatients DESC. This sorts them by highest number first I think?

3. Explicitly remove the MD/Nurse label from the patient before removing the patient. I have had problems which seemed to stem from keeping a pointer to an object (location/staff/etc.) on a patient label through removal. i think in truth I don't understand the problem, but it doesn't hurt to remove the label.

This all works great! I'm now trying to work in the advice that Matthew gave below.

1 Like 1 ·
Julie Weller avatar image Julie Weller Chandler commented ·
Yay!! Glad to hear it!!
0 Likes 0 ·
Chandler avatar image Chandler Julie Weller commented ·

Thanks for all of your replies Julie. I am taking a look at this today.

The label use makes enough sense. Is there any reason I can't add a reference to the patient to an array on the doctor instead of incrementing or decrementing an integer label? It would be nice to see which patients a doctor is attending to even when they aren't acquired.

I don't quite understand how that decide would work.Would I be deciding whether the patient is able to acquire any doctor? I would think that perhaps I could dynamically manage the list of doctors that are available (MD is member of MDs_Open if(NumOfPatients < Capacity) then only select from MDs after they've tried to select from MDs_Open...

Is there any way to use the labels created on the staff when sorting and filtering the available staff in the Staff resource? This doesn't quite work, but could something similar be done:

1692197883061.png

Thanks for your time!

0 Likes 0 ·
1692197883061.png (18.6 KiB)
Julie Weller avatar image Julie Weller Chandler commented ·

You can absolutely just add the patients to an array on the doctor, instead of NumOfPatients, you could just call it Patients and choose this from the picklist:

1692199227204.png

You can reference the patient by just saying "patient" in the label, like this:

1692199559110.png

Then at the end just remove that patient using the "Remove Value(s) from Array" option.You can also check the size with "Array Size" from the same picklist.

I think sorting in the staff resource is a good idea actually! That way if all the doctors are full you can just keep going. I've never really used the Sort By or Filter By options so I can't give you a really good idea of how to use them but there should be documentation at docs.flexsim.com that you can find. You might need to play around with it until it works. That would eliminate you having to use a decide or another activity, though perhaps a custom code block would work.

If you run into any problems let us know and we can brainstorm some other ideas or try to fix it!

0 Likes 0 ·
1692199227204.png (90.3 KiB)
1692199559110.png (18.5 KiB)
Show more comments

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.