Skip to content

Managing Orders

Create and manage clinical orders using the iFlow CLI.

Overview

Orders represent clinical cases in the iFlow platform. Each order can contain:

  • Samples - Biological samples for analysis
  • Pipeline runs - Associated analysis runs
  • Status tracking - FDA/CLIA-compliant workflow states

Prerequisites

  1. Installed CLI - See Installation
  2. Authenticated - Run iflow login
  3. Project selected - Run iflow config select-project

Listing Orders

List orders for the selected project:

iflow orders list

Filter by status:

iflow orders list --status created
iflow orders list --status analyzing
iflow orders list --status reviewed

Filter by priority:

iflow orders list --priority urgent
iflow orders list --priority stat

Creating Orders

Basic Order

iflow orders create -n "Patient Case 001"

With Clinical Details

iflow orders create \
  -n "Smith Family Case" \
  --accession ACC-2026-001 \
  --priority urgent \
  --indication "Family history of hereditary cancer" \
  --test-type "Whole Exome Sequencing" \
  --provider "Dr. Jane Smith" \
  --facility "City General Hospital" \
  -t hereditary \
  -t wes

Order Options

Option Description
-n, --display-id Order display ID (required)
--accession Lab accession number
--external-id External system reference
--description Order description
--priority Priority: routine, urgent, stat
--indication Clinical indication
--test-type Type of genetic test
--provider Ordering provider name
--facility Ordering facility name
-t, --tag Tags (can specify multiple)

Getting Order Details

iflow orders get ORDER_ID

Output:

Order: Smith Family Case
  ID: abc123-def456-...
  Status: created
  Priority: urgent
  Accession: ACC-2026-001
  Indication: Family history of hereditary cancer
  Test Type: Whole Exome Sequencing
  Provider: Dr. Jane Smith
  Facility: City General Hospital
  Created: 2026-01-13T10:00:00Z
  Tags: hereditary, wes

Order Status Workflow

Orders follow a FDA/CLIA-compliant workflow:

created → analyzing → reviewed → signed_off → completed
                                               amended

Any status can also transition to cancelled.

Transitioning Status

# Start analysis
iflow orders transition ORDER_ID analyzing

# Mark as reviewed
iflow orders transition ORDER_ID reviewed

# Final sign-off
iflow orders transition ORDER_ID signed_off

# Complete the order
iflow orders transition ORDER_ID completed

# Amend a completed order
iflow orders transition ORDER_ID amended

# Cancel at any point
iflow orders transition ORDER_ID cancelled

Available Statuses

created, analyzing, reviewed, signed_off, completed, amended, cancelled

Managing Samples

List Samples in Order

iflow orders samples ORDER_ID

Add Sample to Order

iflow orders add-sample ORDER_ID SAMPLE_ID

Remove Sample from Order

iflow orders remove-sample ORDER_ID SAMPLE_ID

Generating Samplesheet

Generate an nf-core compatible samplesheet CSV from all samples in an order:

iflow orders samplesheet ORDER_ID

Output (CSV format):

sample,fastq_1,fastq_2,strandedness,specimen_type,sex,accession_id
SAM-001,,,auto,FFPE,female,ACC-12345
SAM-002,,,auto,Blood,male,ACC-67890

Save to file:

iflow orders samplesheet ORDER_ID > samplesheet.csv

Deleting Orders

iflow orders delete ORDER_ID

You'll be prompted to confirm the deletion.

Complete Workflow Example

This example shows the full workflow from order creation to pipeline execution:

1. Login and Select Project

iflow login --token YOUR_PAT_TOKEN
iflow config select-project

2. Create the Order

iflow orders create \
  -n "Case-2026-0113" \
  --accession "ACC-2026-0113" \
  --priority urgent \
  --indication "Suspected hereditary cancer syndrome" \
  --test-type "Hereditary Cancer Panel" \
  -t hereditary \
  -t cancer

Output:

Order created successfully!
  ID: e7f8a9b0-1234-5678-90ab-cdef12345678
  Display ID: Case-2026-0113
  Status: created
  Priority: urgent
  Accession: ACC-2026-0113

3. Submit Pipeline Run with Order Association

File paths are relative to your project bucket:

iflow analyses submit \
  --pipeline hereditary-mock \
  --order-id e7f8a9b0-1234-5678-90ab-cdef12345678 \
  -P case_id=Case-2026-0113 \
  -P child_fastq=data/sample_R1.fastq.gz \
  -P child_fastq=data/sample_R2.fastq.gz \
  --watch

4. Transition Order to Analyzing

iflow orders transition e7f8a9b0-... analyzing

5. Check Order Status

iflow orders get e7f8a9b0-...

6. List Runs for Order

iflow analyses list --order-id e7f8a9b0-...

Using Different Projects

All order commands use your selected project by default. To work with a different project:

# Override for single command
iflow orders list -p OTHER_PROJECT_ID

# Or switch default project
iflow config select-project OTHER_PROJECT_ID

API Access

For programmatic access, the orders API is available at https://miner.flow.labpgx.com/api/v1/orders:

Create order:

curl -X POST https://miner.flow.labpgx.com/api/v1/orders \
  -H "Authorization: Bearer TOKEN" \
  -H "X-Project-ID: PROJECT_ID" \
  -H "Content-Type: application/json" \
  -d '{
    "display_id": "New Order",
    "priority": "routine",
    "indication": "Testing"
  }'

List orders:

curl https://miner.flow.labpgx.com/api/v1/orders \
  -H "Authorization: Bearer TOKEN" \
  -H "X-Project-ID: PROJECT_ID"

Transition status:

curl -X POST https://miner.flow.labpgx.com/api/v1/orders/ORDER_ID/transition \
  -H "Authorization: Bearer TOKEN" \
  -H "X-Project-ID: PROJECT_ID" \
  -H "Content-Type: application/json" \
  -d '{"status": "analyzing"}'

Troubleshooting

"No project specified"

You need to select a default project or provide -p:

# Select default project
iflow config select-project

# Or specify for single command
iflow orders list -p PROJECT_ID

"Invalid transition"

Order status transitions must follow the workflow. Check the current status:

iflow orders get ORDER_ID

Then verify the transition is valid according to the workflow diagram.

"Resource not found"

The order may not exist or you may not have access to it. Verify the order ID and project ID are correct.

Next Steps