After files are linked, Franklin transfers them, runs the pipeline if needed, and annotates the variants. This recipe tells when a case is ready for review, and keeps your system in sync with case status.
POST /v1/analyses/status returns both for up to 100 cases per call:
r = client.request("POST", "/v1/analyses/status", json={"analysis_ids": [12345, 12346]})
r.raise_for_status()
for a in r.json():
print(a["id"], a["status"], a["processing_status"], a["last_annotated"])[
{ "id": 12345, "name": "PAT-001_WES", "status": "IN_PROGRESS",
"processing_status": "READY", "assay_id": "assay-uuid-123",
"created_at": "2024-01-15", "last_annotated": "2024-01-15 11:00:00 UTC" }
]| Field | Tells you | Set by |
|---|---|---|
processing_status | Whether the data is ready: files transferred, pipeline and annotation done | Franklin |
status | Where the case is in your lab's workflow: PENDING, IN_PROGRESS, RESOLVED, CANCELLED | Your users in Franklin |
| Value | Meaning |
|---|---|
NEW, UPLOADING, UPLOAD_DONE | Files are being received |
PROCESSING_PIPELINE, PIPELINE_DONE | Secondary analysis is running or finished (FASTQ input) |
PROCESSING_ANNOTATION | Variants are being annotated |
READY | Every annotation for the case has finished. The case can be reviewed and its variants retrieved |
PENDING_FILES | A shell case whose files haven't been linked yet |
PARTIAL_ANNOTATION | Annotation completed only partly. Contact support if it doesn't progress |
ARCHIVED, IN_ARCHIVING_PROCESS | The case's files have been moved to archive storage |
ERROR, ERROR_UPLOAD, ERROR_PIPELINE, ERROR_ANNOTATION | Processing failed. Contact support with the analysis ID |
An ID that doesn't exist, or isn't in your organization, comes back with status: "INVALID" and an empty processing_status. The call itself doesn't fail.
Poll gently; processing takes minutes to hours depending on the input.
import time
TERMINAL_ERRORS = {"ERROR", "ERROR_UPLOAD", "ERROR_PIPELINE", "ERROR_ANNOTATION"}
def wait_until_ready(client, analysis_ids, interval=300):
pending = set(analysis_ids)
while pending:
r = client.request("POST", "/v1/analyses/status", json={"analysis_ids": sorted(pending)[:100]})
r.raise_for_status()
for a in r.json():
if a["processing_status"] == "READY":
print(f"{a['id']} ready")
pending.discard(a["id"])
elif a["processing_status"] in TERMINAL_ERRORS or a["status"] == "INVALID":
print(f"{a['id']} failed: {a['processing_status'] or a['status']}")
pending.discard(a["id"])
if pending:
time.sleep(interval)Batch your IDs: one call for 100 cases is far cheaper than 100 calls, and less likely to hit the rate limit.
If you only stored your own identifier as the case name, use POST /v1/analyses/status_by_name:
r = client.request("POST", "/v1/analyses/status_by_name", json={"analysis_name": "PAT-001_WES"})To pick up cases your users resolved since the last sync, list them with GET /v1/analyses/list, then fetch their details:
r = client.request("GET", "/v1/analyses/list", params={
"status": "RESOLVED",
"status_change_after": "2024-01-14", # yyyy-MM-dd, day granularity
})
ids = [i for group in r.json()["analyses_by_assay"].values() for i in group]The result is grouped by assay: {"assay-uuid-123": [12345, 12346], "no-assay-configured": [12348]}. The date filters are day-granular, so overlap your window by a day and de-duplicate on your side. When the case is resolved, continue with From workbench to signed report.