Managing Subjects¶
Create and manage subjects (patients) using the iFlow CLI.
Overview¶
Subjects represent patients in the iFlow platform. Each subject can have:
- Samples - Biological samples for analysis
- Clinical metadata - Name, sex, date of birth, diagnosis, etc.
- Custom properties - Any additional key-value data (first_name, surname, gender, etc.)
Prerequisites¶
- Installed CLI - See Installation
- Authenticated - Run
iflow login - Project selected - Run
iflow config select-project
Listing Subjects¶
Creating Subjects¶
--display-id (-n) is required. All other fields are passed via --property/-P key=value:
# Basic subject
iflow subjects create --display-id "Patient Smith"
# With clinical metadata
iflow subjects create \
--display-id "SUB-2026-001" \
-P sex=female \
-P date_of_birth=1985-03-15 \
-P external_id=ACC-12345 \
-P first_name=Jane \
-P surname=Doe \
-P diagnosis="Hereditary cancer"
# With tags
iflow subjects create -n "SUB-2026-002" -P sex=male -t hereditary -t urgent
Property Types¶
Properties are split into two categories:
Model columns (stored as dedicated database fields):
| Key | Description |
|---|---|
sex |
Patient sex (male, female, other, unknown) |
date_of_birth |
Date of birth (YYYY-MM-DD) |
external_id |
External system reference / accession number |
diagnosis |
Clinical diagnosis |
clinical_notes |
Free-text clinical notes |
Custom properties (stored in JSONB):
Any other key goes into the flexible properties store. Common examples:
| Key | Description |
|---|---|
first_name |
Patient first name |
surname |
Patient surname |
gender |
Gender identity |
hpo_terms |
HPO phenotype terms |
phenotype_description |
Free-text phenotype |
Create Options¶
| Option | Description |
|---|---|
-n, --display-id |
Subject display ID (required) |
-P, --property |
Property key=value (repeatable) |
-t, --tag |
Tag (repeatable) |
-p, --project |
Project ID (uses default) |
--curl |
Output curl command |
Getting Subject Details¶
Output:
Subject: SUB-2026-001
ID: abc123-def456-...
Display ID: SUB-2026-001
External ID: ACC-12345
Sex: female
Date of Birth: 1985-03-15
Diagnosis: Hereditary cancer
Created: 2026-02-13T10:00:00Z
Properties:
first_name: Jane
surname: Doe
Updating Subjects¶
Update a subject's display ID, model fields, or custom properties:
# Change display ID
iflow subjects update SUBJECT_ID -n "NEW-ID"
# Update clinical metadata
iflow subjects update SUBJECT_ID -P sex=female -P diagnosis="Type 2 Diabetes"
# Update multiple fields at once
iflow subjects update SUBJECT_ID \
-n "SUB-2026-001-v2" \
-P external_id=ACC-99999 \
-P clinical_notes="Updated after follow-up"
Update Options¶
| Option | Description |
|---|---|
-n, --display-id |
New subject display ID |
-P, --property |
Property key=value (repeatable) |
-p, --project |
Project ID (uses default) |
--curl |
Output curl command |
Deleting Subjects¶
You'll be prompted to confirm. Deleting a subject cascades to its samples.
API Access¶
For programmatic access (LIS integration), use the REST API:
curl -X POST https://miner.flow.labpgx.com/api/v1/subjects \
-H "Authorization: Bearer TOKEN" \
-H "X-Project-ID: PROJECT_ID" \
-H "Content-Type: application/json" \
-d '{
"display_id": "SUB-2026-001",
"sex": "female",
"date_of_birth": "1985-03-15",
"external_id": "ACC-12345",
"properties": {
"first_name": "Jane",
"surname": "Doe",
"gender": "female"
}
}'
Property Promotion
When sending model-column keys (like sex) inside properties, they are automatically promoted to the correct field. This means LIS systems can send all metadata in properties without worrying about the distinction.
Next Steps¶
- Managing Samples - Create samples linked to subjects
- Order Management - Create orders and associate samples