question

Amelia Radtke avatar image
0 Likes"
Amelia Radtke asked Amelia Radtke commented

Bed Assignment Based on Provider Workload

I am working on a urgent care simulation that has six beds and either 2 or 3 providers working, each provider “owns” 2 or 3 beds accordingly. When patients arrive the nurses room them to keep the providers even (first patient goes to Provider 1, second to Provider 2, third to Provider 3, fourth to 1 and so on). I expect that determining all of this will come down to FlexScript which is where I’m running into challenges.

How would I do this? My current model assigns providers based on the room so I am trying to build the logic into the patient destination of the rooming step. My pseudo code is below:

Global Variables: Provider1Count, Provider2Count,
Provider3Count
If (getgroupstat(MDs, 1) == 2)
{
If (Provider1Count <= Provider2Count)
{
Provider1Count ++
Return (ExamTable1 || ExamTable2 || ExamTable3) \\ how is this done? What type of variable am I returning?
}
Else
{
Provider2Count++
Return (ExamTable4 || ExamTable5 || ExamTable6)
}
}
Else if (getgroupstat(MDs, 1) ===3)
{
If (Provider1Count <= Provider2Count)
{
Provider1Count ++
Return (ExamTable1 || ExamTable2)
}
Elseif (Provider2Count <= Provider3Count)
{
Provider2Count++
Return (ExamTable3 || ExamTable4) \\ how is this done? What type of variable am I returning?
}
Else
{
Provider3Count++
Return (ExamTable5 || ExamTable6) \\ how is this done? What type of variable am I returning?
}
}

Finally, are there any guidelines around the necessary headers?

Thank you!

FlexSim HC 5.3.2
flexscripturgent carebed assignmentpatient allocation
5 |100000

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

1 Answer

·
Cliff King avatar image
0 Likes"
Cliff King answered Amelia Radtke commented

Amelia,

For your education, I've included a translation of your psuedo code into real code that could be used in the Patient Destination field of the patient's room placement activity; however, I think there might be better approaches. The code returns NULL in cases where none of the exam tables are available for the intended provider. If the Patient Destination field returns NULL (i.e. 0), then default behavior in the software will force the Patient Destination field to be reevaluated at future times whenever a downstream location becomes available. Don't forget you'll need to decrement the global variables whenever the patient leaves the care of the provider, and make sure you decrement the variables just before the patient leaves the downstream exam tables rather than just after.

You also might want to check out my answer in the following post. There are similarities to your modeling situation that you might find helpful.

I'm also thinking there might be some more straight forward approaches to consider, but their likely hood depends on how you intend to switch between two or three providers. Is this switch something that needs to occur dynamically during a model run, or is it something that can be switched up front as simply a new modeling scenario scenario?

if (getgroupstat(MDs, 1) == 2)
{
	if (Provider1Count <= Provider2Count)
	{
		Provider1Count ++
		if (getavailablelocation(ExamTable1))
			return ExamTable1;
		else if (getavailablelocation(ExamTable2))
			return ExamTable2;
		else if (getavailablelocation(ExamTable3))
			return ExamTable3;
		else
			return NULL;
	}
	else
	{
		Provider2Count++
		if (getavailablelocation(ExamTable4))
			return ExamTable4;
		else if (getavailablelocation(ExamTable5))
			return ExamTable5;
		else if (getavailablelocation(ExamTable6))
			return ExamTable6;
		else
			return NULL;
	}
}
else if(getgroupstat(MDs, 1) == 3)
{
	if (Provider1Count <= Provider2Count)
	{
		Provider1Count ++
		if (getavailablelocation(ExamTable1))
			return ExamTable1;
		else if (getavailablelocation(ExamTable2))
			return ExamTable2;
		else
			return NULL;
	}
	else if (Provider2Count <= Provider3Count)
	{
		Provider2Count++
		if (getavailablelocation(ExamTable3))
			return ExamTable3;
		else if (getavailablelocation(ExamTable4))
			return ExamTable4;
		else
			return NULL;
	}
	else
	{
		Provider3Count++
		if (getavailablelocation(ExamTable5))
			return ExamTable5;
		else if (getavailablelocation(ExamTable6))
			return ExamTable6;
		else
			return NULL;
	}
}
· 6
5 |100000

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

Amelia Radtke avatar image Amelia Radtke commented ·

Thank you Cliff!

I don't believe I need to decrement the global variables - patients are allocated based on how many patients have arrived to the provider not how many are currently in the care of the provider (which does become a serious issue when one provider operates much faster than the other...)

Right now we only need to change the number of providers for modeling scenarios. However the number of providers working on a given day might be a discussion in the future state.

0 Likes 0 ·
Cliff King avatar image Cliff King Amelia Radtke commented ·

In that case, I think your approach may be the easiest solution. Let us know if it works for you!

0 Likes 0 ·
Amelia Radtke avatar image Amelia Radtke commented ·

I keep receiving the following warning:

WarningMODEL:/Tools/PatientBin/Normal Patients - Lab in UC/Normal Patients - Lab in UC>variables/ActivityTable/ 40_Rooming/PatientDestinationline 9Too few parameters in call to getgroupstat

Any thoughts on how to clean that up?

0 Likes 0 ·
Amelia Radtke avatar image Amelia Radtke Amelia Radtke commented ·

I've discovered that writing "getgroupstat(MDs, 1, 0, 0)" cleans up the compiler - thanks!

0 Likes 0 ·
Cliff King avatar image Cliff King Amelia Radtke commented ·

Amelia,

I should have caught this before. There is actually a better command that you ought to be using. The getgroupstat() command was deprecated awhile back. It has been superceded by the command called getnumresources().

0 Likes 0 ·
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.