> ## Documentation Index
> Fetch the complete documentation index at: https://docs.junction.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Order Lifecycle

> Reference for all order lifecycle statuses in the at-home testkit flow, including shipping, sample collection, and lab processing stages.

The **At-Home Testkit** can be composed of two distinct **Order** lifecycles, which we detail below.

## Order Lifecycle

As discussed in [`Lab Test Lifecycle - Statuses`](/lab/workflow/lab-test-lifecycle#statuses),
each lab testing modality has the following format:

`[HIGH-LEVEL STATUS].[TEST MODALITY].[LOW-LEVEL STATUS]`

For each modality, there can be multiple **low-level statuses**, for **At-Home Testkit** the
possible low-level statuses are:

### Registered Testkits

* `ordered`: Junction received the order, stored it into our system, and started processing it asynchronously.
* `requisition_created`: An order requisition form was validated and created with the partner laboratory, making the order available to be carried out.
* `requisition_bypassed`: An order requisition form wasn't created when the order was placed with us because it already existed.
* `transit_customer`: The testkit is shipped and in transit to the customer.
* `out_for_delivery`: The testkit is out for delivery.
* `with_customer`: The testkit is delivered to the customer.
* `transit_lab`: The customer has sent the testkit back to the lab.
* `delivered_to_lab`: The lab has received the testkit.
* `failure_to_deliver_to_customer`: The shipping company was unable to deliver the testkit to the customer.
* `failure_to_deliver_to_lab`: The shipping company was unable to deliver the testkit to the lab.
* `problem_in_transit_customer`: The shipping company encountered a problem while delivering the testkit to the customer.
* `problem_in_transit_lab`: The shipping company encountered a problem while delivering the testkit to the lab.
* `lab_processing_blocked`: The lab encountered an issue while processing the sample.
* `sample_error`: The collected sample was unprocessable by the lab.
* `completed`: The laboratory processed the blood sample and final results are available.
* `cancelled`: The order was cancelled by either the patient, Junction, or you.

The Finite State Machine that defines the possible transitions for the low-level statuses described above is illustrated
in the following diagram.

<Frame caption="Possible state transitions for the At-Home Testkit Order low-level statuses.">
  <img src="https://mintcdn.com/vital/deJB3IUUpJEYmyW_/img/testkit_lifecycle.png?fit=max&auto=format&n=deJB3IUUpJEYmyW_&q=85&s=f67d85bbb2bb3b680466483df058fabb" width="1776" height="781" data-path="img/testkit_lifecycle.png" />
</Frame>

### Registrable Testkits

* `ordered`: Junction received the order, stored it into our system, and started processing it asynchronously.
* `awaiting_registration`: Order is created but no user has been registered yet.
* `transit_customer`: The testkit is shipped and in transit to the customer.
* `out_for_delivery`: The testkit is out for delivery.
* `with_customer`: The testkit is delivered to the customer.
* `registered`: Order has been registered, and a requisition will be created.
* `requisition_created`: An order requisition form was validated and created with the partner laboratory, making the order available to be carried out.
* `transit_lab`: The customer has sent the testkit back to the lab.
* `delivered_to_lab`: The lab has received the testkit.
* `failure_to_deliver_to_customer`: The shipping company was unable to deliver the testkit to the customer.
* `failure_to_deliver_to_lab`: The shipping company was unable to deliver the testkit to the lab.
* `problem_in_transit_customer`: The shipping company encountered a problem while delivering the testkit to the customer.
* `problem_in_transit_lab`: The shipping company encountered a problem while delivering the testkit to the lab.
* `lab_processing_blocked`: The lab encountered an issue while processing the sample.
* `sample_error`: The collected sample was unprocessable by the lab.
* `completed`: The laboratory processed the blood sample and final results are available.
* `cancelled`: The order was cancelled by either the patient, Junction, or you.

The Finite State Machine that defines the possible transitions for the low-level statuses described above is illustrated
in the following diagram.

<Frame caption="Possible state transitions for the registrable At-Home Testkit Order low-level statuses.">
  <img src="https://mintcdn.com/vital/deJB3IUUpJEYmyW_/img/testkit_lifecycle_registrable.png?fit=max&auto=format&n=deJB3IUUpJEYmyW_&q=85&s=0a804cd5a751be8f828142d197f99a7a" width="1794" height="1053" data-path="img/testkit_lifecycle_registrable.png" />
</Frame>

<br />

<Info>In **sandbox**, there is no async transition from the `ordered` state to the `requisition_created` state. This must be **manually triggered** via the **Junction Dashboard**.</Info>
