Skip to content

StepCompletedEvent

EventType: STEP_COMPLETEDDomain: production Broker subject: progress.notification.production

Marks a single step within an active batch as done by writing a StepExecutionData record. If this was the last pending step in the batch, triggers BatchCompletedEvent as a child. Otherwise updates job step-progress counters in place.

Sequence Diagram

Trigger

Triggered by: POST /event (universal event dispatcher)

Dispatched via POST /event in backend/api/endpoints/traceability.py with event_type: STEP_COMPLETED. The production webapp sends this when the operator completes a step in the step-check flow.

Preconditions

  • Batch exists with key info.batch_key
  • Job is retrievable from batch.job_key
  • An active WorkSession exists for the job

State Changes (Transaction)

Collections: Inherited from BaseProductionEvent.get_tx_collections()

  • StepExecutionData upserted: records step completion with user_key, work_session_key, batch_key, step_key, completed timestamp, status: DONE, and optional form_data
  • If all steps done: BatchCompletedEvent spawned as child (see that page for further mutations)
  • If steps remain: job step-progress counters updated

Side Effects (post_processing)

Inherits post_processing() from BaseProductionEvent:

  • Updates job.last_online
  • Recalculates work order status
  • Publishes to progress.notification.production

InfoModel Fields

FieldTypeDescription
batch_keystrArangoDB key of the active batch
step_keystrArangoDB key of the step being completed
job_keystr | NoneJob key (resolved from batch)
work_order_keystr | NoneWork order key (resolved from batch)
form_datalist[FormFieldValue] | NoneForm field values captured at step completion
batch_serialslist[str] | NoneSerial keys for the batch (forwarded to BatchCompletedEvent)

Source

StepCompletedEvent on GitHub

Released under the Apache 2.0 License.