Skip to content

Track analysis status

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.

Two different statuses

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" }
]
FieldTells youSet by
processing_statusWhether the data is ready: files transferred, pipeline and annotation doneFranklin
statusWhere the case is in your lab's workflow: PENDING, IN_PROGRESS, RESOLVED, CANCELLEDYour users in Franklin

processing_status values

ValueMeaning
NEW, UPLOADING, UPLOAD_DONEFiles are being received
PROCESSING_PIPELINE, PIPELINE_DONESecondary analysis is running or finished (FASTQ input)
PROCESSING_ANNOTATIONVariants are being annotated
READYEvery annotation for the case has finished. The case can be reviewed and its variants retrieved
PENDING_FILESA shell case whose files haven't been linked yet
PARTIAL_ANNOTATIONAnnotation completed only partly. Contact support if it doesn't progress
ARCHIVED, IN_ARCHIVING_PROCESSThe case's files have been moved to archive storage
ERROR, ERROR_UPLOAD, ERROR_PIPELINE, ERROR_ANNOTATIONProcessing 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.

Wait until a case is ready

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.

Look up by name

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"})

Sync workflow status to your system

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.