Find Silent Periods Longer Than Ten Minutes in Warehouse Robot Heartbeats

Last updated: November 29, 2026

Quick Overview

Fulfillment center drive units send heartbeat pings (robot_id, ts). In pandas, return every gap longer than ten minutes between consecutive heartbeats of the same robot, with the gap start, end and length in minutes.

Amazon
Data Manipulation (SQL/Python)
Data Engineer
Amazon
November 29, 2026
Data Engineer
Phone Screen
Data Manipulation (SQL/Python)
Easy

0

0

0 solved


Fulfillment center drive units send heartbeat pings (robot_id, ts). In pandas, return every gap longer than ten minutes between consecutive heartbeats of the same robot, with the gap start, end and length in minutes.

Amazon Robotics fleets in fulfillment centers report health telemetry continuously, and silent robots point to network dead zones or hardware faults. This phone screen warm-up checks groupby plus shift, sorting within groups, and comparing timedeltas correctly.

What the Interviewer Expects
  • Sort by robot and time before computing differences
  • Use groupby shift (or diff) so gaps never span two robots
  • Compare against a Timedelta, not a raw number
  • Remove duplicate pings before diffing
  • Return interpretable columns: start, end, minutes
Key Topics to Cover
groupby shift
time deltas
gap detection
sorting
telemetry
How to Approach This
  1. Clarify the schema and expected output format before writing queries.
  2. Use CTEs (WITH clauses) to break complex queries into readable steps.
  3. Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
  4. Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
  5. For pandas, prefer vectorized operations over row-by-row iteration.
Possible Follow-up Questions
  • How would you also detect a robot that went silent and never came back before the end of the window?
  • How would you aggregate gaps by floor zone to find dead spots?
  • How would you do this as a streaming job instead of a batch?
  • What if clocks on robots drift by a few seconds?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice SQL Problems
Sample Answer
Clarify the Data
  • df(robot_id, ts); one row per heartbeat, but duplicate pings occur when a message is retried and rows are not sorted.
  • A gap is the time between two consecutive heartbeats of the same robot stric...
Approach

Parse timestamps, drop exact duplicates, sort by (robot_id, ts), then compute the previous timestamp per robot with groupby("robot_id")["ts"].shift(1). The first ping of each robot has no previous...


Submit Your Answer
Markdown supported