Gather data only for staff on shift

Gather data only for staff on shift

jose_andres_ca
Not applicable
151 Views
4 Replies
Message 1 of 5

Gather data only for staff on shift

jose_andres_ca
Not applicable

[ FlexSim 21.2.4 ]

I have a model in which I calculate discharge rates per hour for physicians. To calculate this I am doing total discharges/model.time(). This takes into account even when they are off schedule. I wanted to know if there is a way to check how much time a staff member spends off schedule or in different down behaviors and divide it by that. I also want to know if there is a better way to do this, for example, filtering out the data when staff is not on shift.


Thank you.

0 Likes
Accepted solutions (1)
152 Views
4 Replies
Replies (4)
Message 2 of 5

moehlmann_fe
Advocate
Advocate
Accepted solution

The healthcare environment automatically tracks how much time each object (including staff) spend in each state in a "people table".

1636531680834.png

To get the active time you can subtract the "OffSchedule" value from the "TotalTime" value. To do this you could set up a calculated table or use the same query that calculated table uses directly in code.

Both methods are demonstrated in the attached model. (Code in script console returns the "OnSchedule" time of MD1)

HealthcareActiveTime.fsm

Message 3 of 5

jose_andres_ca
Not applicable

I need to code this calculation inside a statistics collector. What I tried is instance.stats.state().getTotalTimeAt("OffSchedule"); but it is not working. I dont know what specific code I can write to acess that number.

0 Likes
Message 4 of 5

jose_andres_ca
Not applicable

code.jpg

This is a picture of what I am trying to do.

0 Likes
Message 5 of 5

moehlmann_fe
Advocate
Advocate

"OffSchedule" is part of the HC state profile, which you have to signify in the "state()" command. Otherwise the default profile is used.

instance.stats.state(2).getTotalTimeAt("OffSchedule");

The code in the script console at the bottom in my attached model should also work. Only the reference to the staff member needs to be adjusted.

Table.query("SELECT [OffSchedule] FROM [StaffStates.StatisticsCollector] WHERE Staff == $1", StatisticsCollector.getID(staffReference))[1][1];