Creating a new Labor Model Rule
Each Deputy install does come with the ability for users to setup their own labor models within the UI, however it is possible to highly customise this and add your own labor models to apply to the shift generation process via the Deputy API.
URL
The URL to add a new labor model is as follows
curl --POST 'https://{install}.{geo}.deputy.com/api/v2/labor-model/location/{locationid}
Sample Payload
{
"data": [
{
"area": 1,
"metric": "Sales",
"metricValueType": "currency",
"metricAmount": "10.00",
"laborAmount": 1,
"minLabor": 1,
"maxLabor": 3,
"coverage": 2,
"steps": [
{
"from": 11,
"to": 20,
"laborAmount": 2
}
],
"maxMetricAmount": 21,
"timeframe": 1,
"useBuffers": true,
"buffers": {
"open": {
"hours": 1,
"minutes": 0,
"direction": "before"
},
"close": {
"hours": 1,
"minutes": 0,
"direction": "after"
},
"subMetric":"forecast"
},
}
],
}
This example will add a new Labor Model Rule which is using the Range type of model as opposed to the linear model.
Element | Data Type | Info |
---|---|---|
area | Integer | The id of the area the labor model should apply to |
metric | String | The sales metric which is being applied to the labor model rule |
metricValueType | String | This is either currency or unit and needs to match the type of metric that the Sales Metric uses in its data storage. |
metricAmount | Integer | The initial metric upper limit amount to begin the labor model on. In this example the upper limit for the first range has been set to 10.00 so the initial range is 0-10.00. |
minLabor | Integer | The minimum amount of staff for the initial range |
maxLabor | Integer | The maximum amount of staff you are allowing under the labor model for the initial range. |
coverage | Integer | Whether |
steps array | Array with Objects | The steps array contains the objects which defines the ranges past the initial range. |
steps - from | Integer | The number where this new range begins. |
steps - to | Integer | The number where this new range ends |
steps - laborAmount | Integer | The amount of staff to put on under the labor model based on the defined range in the object. |
maxMetricAmount | Integer | The maximum number the labor model should be calculated on as a metric |
timeframe | Integer | Whether the labor model should take into account the opening hours of the business or whether it should be considered that the business is always open. |
useBuffers | Boolean - true/false | When you set the labor model to take into account the opening hours of the business, you can include buffers of pre and post opening to be included in the labor model calculations. |
buffers | Object | This object contains information about the buffers which are being defined for the labor model |
open | Object | This Object contains information about what the buffer should be. In the example this has been set to include 1 hour before opening time in the labor model calcuations. |
open - hours | Integer | The number of hours to take into account in the buffer. |
open - minutes | Integer | The number of minutes to take into account in the buffer. |
close - direction | String | Which way this buffer is being set, before the opening time or after the closing time. In this example its before so this means its a before opening buffer time. |
close | Object | This Object contains information about what the closing buffer should be. In the example this has been set to 1 hour after closing time in the labor model calculations. |
close - hours | Integer | The number of hours to take into account in the buffer |
close - minutes | Integer | The number of minutes to take into account in the buffer |
close - direction | String | Which way this buffer is being set, before the opening time or after the closing time. In the example its after so this means its an after closing buffer time. |
subMetric | String | This is either actual or forecast. This will determine whether actual figures from the metric or forecast measures from the metric will be used with the labor model. |
Sample Response
{
"success": true,
"data": [
{
"id": "25",
"area": 12,
"metric": "Food",
"metricValueType": "currency",
"metricAmount": 10,
"laborAmount": 1,
"minLabor": 1,
"maxLabor": 3,
"coverage": 2,
"steps": [
{
"from": 11,
"to": 20,
"laborAmount": 2
}
],
"maxMetricAmount": 21,
"timeframe": 1,
"useBuffers": true,
"buffers": {
"open": {
"hours": 1,
"minutes": 0,
"direction": "before"
},
"close": {
"hours": 1,
"minutes": 0,
"direction": "after"
}
},
"subMetric": "forecast"
}
]
}
The response basically repeats the same information that was provided in the API request, which allows you to confirm the data has been set correctly.
Updated over 1 year ago