Skip to main content
The batch track state pattern processes tracks after they expire, giving you the complete picture of what an object did — where it went, how long it stayed, how fast it moved, and what it interacted with. You trade real-time alerting for simplicity: one execution per track, complete zone history, and automatic event closure. This guide uses obstruction detection as the running example (vehicles blocking factory aisles), but the same pattern applies to any batch use case — failure to stop, PPE compliance, wrong-way detection, vehicle near-miss, and more.

What you’ll build

The workflow follows this structure:
  • Trigger receives batch track summaries for vehicles across the site
  • Type I Check evaluates zone thresholds — is the vehicle in an aisle zone long enough, with sufficient overlap, and low velocity?
  • Event Orchestrator routes based on check results — create event or no action
  • Create path captures a still image, creates the event in Worlds, and optionally generates a GIF and sends an email
  • Replay Trigger (disabled) is available for testing with historical data

Prerequisites

  • A Worlds site with aisle zones configured
  • GraphQL Subscription API credentials in the Workflow Builder
  • The state machine running and connected to your Workflow Builder instance
  • SendGrid API credentials (optional, for email alerts)

Step 1: Detection Webhook Trigger

Configure the trigger to ingest vehicle detections in batch mode.

Why batch mode?

For obstruction detection, you care about the complete picture of what a vehicle did — how long it was in the zone, its average velocity, where it entered and exited. You don’t need to alert while the vehicle is still sitting there. Batch mode gives you:
  • One execution per track instead of hundreds — less processing in the Workflow Builder
  • Complete zone history — total dwell time, entry and exit times
  • Known end time — the track has already expired, so you can set both start and end time when creating the event, which automatically closes it
Add a Replay Trigger connected to the same downstream node and keep it disabled. This gives you an easy way to test the workflow with a known track ID without modifying the live configuration.

Step 2: Type I Check (Track in Zone)

The check node evaluates whether the vehicle was in an aisle zone and meets obstruction criteria. What happens: Since this is batch data, the check automatically evaluates historical zones (zones the track visited and left). For each aisle zone the vehicle was in, it checks all three thresholds. If any zone passes all thresholds, the check passes. Threshold groups: You can group zones that share the same thresholds. If all your aisle zones have the same obstruction criteria, put them in a single group. If some zones need different dwell time thresholds (e.g., loading docks allow longer stops), create separate groups.

Adapting for similar use cases

Step 3: Event Orchestrator

The orchestrator reads the Type I check results and decides whether to create an event. Routing for batch workflows: In batch mode, the orchestrator routing is simpler than streaming because each track only arrives once (after it expires):
In batch mode, you typically only wire the Create Event output. Since each track arrives once after expiration, you won’t see update or close scenarios for the same track.

Step 4: Create still image

Capture a visual of the obstruction for the event record. Node: Worlds Actions → Process Detection Image → Create Still Choosing the timestamp: For obstruction, a good approach is to capture the image a few minutes after the vehicle entered the zone — this shows the vehicle clearly stopped in the aisle rather than just entering it:
This expression finds when the vehicle entered the matching zone and adds 5 minutes.

Step 5: Create event in Worlds

Write the event to the Worlds platform. Node: Event Manager → Create Event Metadata — add context for the Worlds UI: Uploads — attach the processed image: Snapshots — request a camera video clip:

Why batch simplifies event creation

Because batch data includes the complete track lifecycle, you can set both the start time and end time when creating the event. Setting an end time automatically marks the event as closed — there’s no need for a separate close event step in the workflow. This is a significant simplification compared to streaming workflows where you must handle event closure separately.

Step 6: Optional — GIF and email

After creating the event, you can optionally:
  1. Generate a GIF showing the vehicle’s movement sequence using Process Detection Image → Create GIF
  2. Send an email alert using Send Worlds Email with the GIF attached as the alert image
These are typically wired after the Event Manager and can be enabled or disabled as needed.

How it works end-to-end

  1. Vehicles are detected by cameras across the factory floor
  2. The state machine tracks each vehicle, monitoring zone interactions and motion
  3. A forklift enters an aisle zone and stops — the state machine records the entry time, dwell time, and velocity
  4. After the forklift leaves (or the track expires), the state machine emits a track_expired signal with the complete track summary
  5. The batch interval collects expired tracks — the forklift’s data arrives in the next batch window
  6. The Type I check evaluates: was the forklift in an aisle zone for 5+ minutes with low velocity? Yes → passes
  7. The orchestrator sees no existing event for this track → routes to Create Event
  8. A still image is captured showing the forklift in the aisle
  9. An event is created in Worlds with full metadata, the image, and a video snapshot
  10. The event appears in the Worlds platform with start/end times already set (closed)

Other use cases for this pattern

The batch track state pattern works for any use case where you don’t need real-time alerting and want the simplicity of processing complete track lifecycles: The core structure stays the same — Trigger → Check(s) → Orchestrator → Image → Event Manager — only the check configuration and event metadata change.

Testing with Replay

  1. Disable the Detection Webhook Trigger
  2. Enable the Replay Detection Trigger
  3. Set the processing mode to Batch
  4. Enter a track ID from a known obstruction event
  5. Run the workflow — the replay processes the historical track through the same logic
  6. Verify the event was created correctly in the Worlds platform