ETA Requests, PickupAt and Sandbox Environment

Hello!

My company is currently working on integrating our POS system and kitchen management software with Stuart. Our customers are in business of selling food, and as such, we account for Preparation Time when calculating PickupAt value for the API requests.

We are mindful that a driver might not necessarily always be available to pick up a package at earliest possible time, and going by Order Scheduling - Tips & Best Practices - Stuart developers community as well as Using the ‘Request a Job ETA’ endpoint we understand that we should call the v2/jobs/eta endpoint to get a more or less realistic value in order to delay preparation of food accordingly.

Going by this post ETA Requests - pickup_at - #2 by Marta we understand that if we include an initial PickupAt value in the v2/jobs/eta request, we will get a response back with the additional time needed for driver to arrive on top of the time requested.

So, for example, if we request pickup time at 13:00:00, and get response value of 2400 back, realistically the driver will arrive at approximately 13:40:00.

First question is:
Once we know the ETA, should we then account for it in the subsequent request? For example, when making actual POST to v2/jobs to create a delivery job, should we make the PickupAt value equal to the calculated 13:40:00 to ensure that there is no attempt to collect the package before it is ready in case the ETA was on the higher side?

Second question:
We’re testing the behaviour in the Sandbox environment. Most things are looking good so far, but I’m noticing that ETAs we get from v2/jobs/eta endpoint are not very useful. For the most part, we get 40 minutes ETA back most of the time no matter if we request PickupAt time moments or hours from now. At the same time, the driver bots are happy to actually collect package as early as few minutes, seemingly completely ignoring the ETAs.

Other times we receive ETAs of 0, even when the PickupAt is effectively set to be 1 minute from Now.

Is this an issue with Sandbox environment? Because we’re dealing with hot food, we need to manage orders in our kitchen management software, to make sure that the order isn’t being prepared too soon as to grow cold. Having an ETA lets us delay the orders appropriately, but we’re not able to test it on the Sandbox Environment reliably, given the behaviour I described above.

I would appreciate some insight on these two queries.

Thank you!

Hello @Sebastian,

Thank you for your complete message and for exploring so thoroughly our forum!

For your first question, this may depend on your order and preparation flow. Some questions that might help are:

  • When in the flow would you request the ETA?
  • Do you know the preparation time of each order?
  • When in the order flow will you trigger the Stuart job to be created?

Note that the ETA is most accurate at representing the current state of the Stuart fleet at the time of ordering.

Regarding the sandbox environment ETAs, we appreciate this feedback. Indeed the ETAs in this environment might not be as ‘realistic’ as we might like due to the way that driver bots are managed. We will report these issues you reported internally to see how we can improve.

Perhaps a possible workaround to avoid a 0 value for example, could be to create several jobs around the same location. This would typically cause more driver bots to spawn and this availability should then be reflected in the ETAs.

Hi Lauren,

Thanks for coming back to me.

Regarding the sandbox environment ETAs, we appreciate this feedback. Indeed the ETAs in this environment might not be as ‘realistic’ as we might like due to the way that driver bots are managed. We will report these issues you reported internally to see how we can improve.

Perhaps a possible workaround to avoid a 0 value for example, could be to create several jobs around the same location. This would typically cause more driver bots to spawn and this availability should then be reflected in the ETAs.

Thank you, we will continue testing on the Sandbox environment. I did notice that the values tended to be more “accurate” when multiple deliveries were being made, but they were rather fast to reset back to defaults, and the timings weren’t too clear. Any improvement to simulations and ETAs will be welcome, but I realize that can take time to change. Hence why I sought to reach out to confirm how it would / should behave in Production.

For your first question, this may depend on your order and preparation flow. Some questions that might help are:

Generally we are dealing with two kinds of scenarios:

  1. An ASAP delivery. At which point we would put PickupAt = Now + PreparationTime
  2. A scheduled delivery, where a customer places an order for the future

Therefore, in short:

  • Do you know the preparation time of each order?

Yes. Our system operates with a general Meal Preparation Time setting that is being used for all time estimate calculations our end and it is a known value for each job.

  • When in the flow would you request the ETA?

In our scenarios, we would have to know ETAs at the time of customer placing order within our system in order to:

  1. Provide customer with earliest possible time of delivery
  2. Determine whether order can be sent to kitchen for preparation right away, or whether it has to be delayed so that the food isn’t prepared too early in relation to Pickup.

As such we would likely call an ETA endpoint as soon as we have an Address.

  • When in the order flow will you trigger the Stuart job to be created?

In case of an ASAP delivery, we would create a delivery Job as soon as the order is placed with the site, at which point we should already have received an ETA to account for with food preparation. I’ll provide an example below.

In case of Scheduled Deliveries for later time, I admit I am not completely certain what the best route is. I imagine we would also book in delivery Job at the time the order is placed with site, so that we can “book” a job within Stuart system for requested (or closest available) Pickup time. Again, this is mostly so that we can schedule what time we should start preparing the food in such a way that it isn’t picked up too early, or too late.

Hopefully that describes our use case scenario. However, let me provide some examples, for the sake of being thorough and leaving information for anyone else having similar questions.

Example 1: ASAP Delivery Scenario

In the first scenario when customer orders food for ASAP, I imagine we would request an ETA as soon as we have customer’s address, at the time of customer placing the order. This will be used for two things:

  • Provide customer with estimate time
  • Determine whether we can start preparing food immediately based on driver availability, or whether we have to delay preparation of food because no driver can pick it up right away. This is fairly important to ensure that the dish is as fresh as possible.

Assuming that customer is happy with estimates, we would then create a delivery Job right at the end of customer placing the order, with reasonable PickupAt time that can satisfy both kitchen staff and driver.

To work with some values, let’s assume it’s 13:00 now, and a customer phones in and orders food for ASAP. Assuming our Meal Prep Time is 20 minutes, we would then request a PickupAt time of 13:20, and then call the /v2/jobs/eta endpoint to check if we can get an ETA that confirms that the time can be met.

If I understood the linked forum posts correctly, we would then receive either an ETA of 0, which we read as “we are likely to meet the requested PickupAt time”, or any positive integer value, which means something along the lines of “we cannot guarantee a driver to be available at this PickupAt time, we need extra time of {Eta Respone}”.

In case of ETA 0, we would send an order to the kitchen for preparation immediately, and create delivery Job right away for PickupAt 13:20.

However, if we receive an ETA of, let’s say, 20 minutes (so eta of 1,200 secods, but I’ll keep referring in minutes), I would currently interpret that as “we cannot guarantee an order to be picked up before 13:40 (13:20 + 20 minutes ETA)”. At which time we would delay sending the order to kitchen by 20 minutes, but we would still create delivery Job with PickAt 13:40.

Scheduled Delivery

For the most part I imagine this would work in similar way, except instead of working with times relative to now, we’re working with future time, which I understand makes coming up with realistic time estimates slightly harder because, as you say, they represent current state of the fleet. I suppose the valid question here is, do the ETAs server by the endpoint account for already scheduled deliveries across your customers?

I appreciate that estimates are just that, estimates. Our default approach would be to place a delivery Job at the time of accepting customer’s order our end. Say, customer places order at 13:00, but they want the food ready and delivered at 18:00. Let’s assume average delivery time of 20 minutes, this would make us request a PickupAt value of 17:40 (18:00 - avg. delivery time of 20) and internally schedule food for prep at 17:20 (18:00 - avg. delivery time - prep time).

With how I understand the system currently, I am thinking that the best approach is to call the ETA endpoint at the time of placing the order (which would be at 13:00), and send an ETA request with PickupAt 17:40. In my mind, and that is 100% assumption on my side and might be completely wrong on this, this would effectively create an ETA based on the number of scheduled deliveries across your customers around that time, to estimate whether or not that time can be met.

Like with ASAP deliveries, I imagine that if we receive ETA of 0, then that means there is currently no heavy load predicted for around that time and a driver is likely to arrive at requested PickupAt time, therefore we would create delivery Job with PickupAt of 17:40.

If we receive a positive number, we would, once again, delay the order by ETA time received. So, say, if we receive ETA of 20 back, we would relay this info back to user to make them aware of delay, and if they’re happy with that, we would then create a delivery Job with PickupAt of 18:00 (original pickup time 17:40 + 20 minutes ETA) (and consequently schedule food to be prepared at 17:40 instead of 17:20).

Summary

Apologies for a lengthy post, I I thought it best to explain how we currently understand the behaviour based on the provided documentation, since ETAs on Sandbox behave in the way they do and have left us with degree of uncertainty.

Please let me know if the above matches with the recommended usage of the system, or if not, I would appreciate if you could correct me where my understanding is incorrect / suggest alternative approach.

I appreciate your help.

Kind regards,

Sebastian

Hello @Sebastian,

Thank you for your detailed response! A few notes based on this information:

Firstly, note that an ETA of 0 is unlikely in our Production environment, though I understand you’ve noticed this in our sandbox environment.

Note that as I mentioned the ETA endpoint is responding based on the current state of the fleet. What I maybe didn’t clarify, is that it is not accounting for the scheduled time.

Hence, your ASAP scenario, when requesting an ETA with the intention to start preparing the order asap, you should schedule with ‘pickup_at’ as now plus the larger of either the preparation time to the ETA. The food preparation should then be triggered when now = pickup time - preparation time.

For example, if the current time is 13:00 and both the ETA and preparation time is 20 mins, order with pickup_at 13:20. The Stuart couriers ETA to arrive at the restaurant is 20 mins, so you can start preparing now. Here are a couple more examples:

now = 13:00
eta = 20 mins
prep time = 10 mins
schedule pickup at = 13:20
start preparing when now = 13:20 - 10 mins (start preparing in 10 mins)

now = 13:00
eta = 10 mins
prep time = 20 mins
schedule pickup at = 13:20
start preparing when now = 13:20 - 20 mins (start preparing now)

For the scheduling into the future scenario, it might not be very useful to rely on the ETA that was gathered so far in the past. Instead, maybe you can assume the average pickup time such as 10 mins.

An option that would provide the best results in both ASAP and scheduled cases would be to request the ETA just prior to preparation, in order to determine whether to go ahead preparing or to postpone.

Hopefully, this provides some clarification!

Hi!

I think this gives us clearer direction to work with.

Thank you for clarification and suggestion. This is much appreciated!

Best regards,

Sebastian

1 Like