Announcements
Autodesk Community will be read-only between April 26 and April 27 as we complete essential maintenance. We will remove this banner once completed. Thanks for your understanding

How to give a doctor a preferred number of patients?

cphilpottX22K5
Enthusiast Enthusiast
0 Views
19 Replies
Message 1 of 20

How to give a doctor a preferred number of patients?

cphilpottX22K5
Enthusiast
Enthusiast

[ FlexSim 23.1.1 ]

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.

0 Likes
Accepted solutions (1)
1 View
19 Replies
Replies (19)
Message 2 of 20

julie_weller
Not applicable

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 🙂

Message 3 of 20

julie_weller
Not applicable
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.
Message 4 of 20

julie_weller
Not applicable

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!

Message 5 of 20

cphilpottX22K5
Enthusiast
Enthusiast

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
Message 6 of 20

julie_weller
Not applicable

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
Message 7 of 20

matthew_gillespie
Not applicable
Accepted solution

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.

Message 8 of 20

matthew_gillespie
Not applicable
Sort By is the ORDER BY part of the SQL query

Filter By is the WHERE part

So you can treat it just like any other pull from list SQL query with those two statements

Message 9 of 20

cphilpottX22K5
Enthusiast
Enthusiast
This is great info!
0 Likes
Message 10 of 20

cphilpottX22K5
Enthusiast
Enthusiast

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.

Message 11 of 20

cphilpottX22K5
Enthusiast
Enthusiast

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
Message 12 of 20

cphilpottX22K5
Enthusiast
Enthusiast

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
Message 13 of 20

julie_weller
Not applicable
Yay!! Glad to hear it!!
0 Likes
Message 14 of 20

matthew_gillespie
Not applicable
No, but you could easily update that label at the same time the patient adds/removes themselves from the Patients label.
Message 15 of 20

matthew_gillespie
Not applicable

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
Message 16 of 20

julie_weller
Not applicable

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
Message 17 of 20

cphilpottX22K5
Enthusiast
Enthusiast

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
Message 18 of 20

matthew_gillespie
Not applicable

That's the point of the example model I posted. The first acquire uses the filter to get someone who's not overloaded. After that, the patient releases the doctor, but doesn't remove themselves from their list of patients. So even though the doctor has been released their number of patients hasn't decreased.

From the 2nd acquire onwards, it no longer uses the filter and just acquires the doctor stored on the MD label.

0 Likes
Message 19 of 20

cphilpottX22K5
Enthusiast
Enthusiast

Oh... it sure does!

I didn't mean to suggest it wasn't an airtight solution ... just that tried building it myself and it broke (I should have said: "this logic breaks" so that it couldn't be interpreted as "this model breaks".

When I rebuilt it myself I overlooked that detail, and you hadn't explicitly said that that was a function at work... though I can see now that it's evident in the second MD resource being a primary reference (blue staff icon, not white).

Thanks for your help! I'm going to mark this respnse as an answer and add an "EDIT:..." note to my comments above for clarity for anyone seeking a similar solution in the future.

0 Likes
Message 20 of 20

cphilpottX22K5
Enthusiast
Enthusiast
I will also add that part of this problem arose on my end because (in my model) I was acquiring MDs at an arbitrary time - if a patient needs one immediately, then they acquire one at the beginning, if not then they acquire one later on for the first time.


At that second (later on) acquire, I had both people who already had acquired an MD and people who had not yet acquired an MD passing through the same Acquire on the same resource. That caused problems that I wasn't explicitly describing here.


I'm switching to an initial acquire for all patients at the time they are placed in an exam room, which would allow your method to work plug and play.


If I end up needing to do the arbitrary acquire (if a PA can handle the first part of a patients treatment, leaving the MD available for other patients), I'll have to check whether token.MD has a value and use different logic depending on the check.
0 Likes

Type a product name