Skip to content

Job Diagnostics

When a job completes, TORCH writes a full diagnostics report as an OperationOutcome JSON file served by the file server alongside the NDJSON output. The URL is provided in the completion manifest via the torch-job-diagnostics extension (see API — Job Completion Manifest Extensions).

The report contains two kinds of data:

  • Root extensions — job-level totals and timing (cohort query, pipeline stages)
  • Issues — one entry per exclusion criterion, with patient/resource counts and timing

Accessing the Report

The manifest extension carries a direct URL:

json
{
  "url": "torch-job-diagnostics",
  "valueUrl": "http://fileserver/<jobId>/reports/job-summary.json"
}

Fetch it with a plain GET.


Root Extensions

urlValue typeDescription
jobIdvalueStringUUID of the job
cohortPatientsTotalvalueIntegerTotal patients in the cohort across all batches
finalPatientsTotalvalueIntegerPatients remaining after all exclusions
cohortQueryDurationMsvalueIntegerWall-clock time for the Flare / CQL cohort query in ms (omitted when 0)
stage.<name>nestedPer-pipeline-stage throughput (see Stage Extensions)

Stage Extensions

Each stage.<name> extension is a nested object with:

urlValue typeDescription
durationMsvalueIntegerTotal wall-clock time spent in this stage (ms)
resourcesProcessedvalueIntegerResources (or patients) that passed through the stage
resourcesPerMinutevalueIntegerThroughput rate derived from the two fields above

Stage names (lower-kebab-case suffixes after stage.):

StageWhat is counted as a "resource"
consent-fetchpatients
direct-loadFHIR resources loaded
reference-resolveFHIR resources after resolution
cascading-deleteFHIR resources remaining after deletion
copy-redactFHIR resources written to output

Issues (per-criterion exclusions)

Each issue entry corresponds to one exclusion criterion. All have "severity": "information".

The code field maps the exclusion kind to a FHIR issue code:

Exclusion kindFHIR code
MUST_HAVEbusiness-rule
CONSENTsuppressed
REFERENCE_NOT_FOUNDnot-found
REFERENCE_INVALIDstructure
REFERENCE_OUTSIDE_BATCHinformational

details.coding carries the exclusion kind using system https://torch.mii.de/fhir/CodeSystem/exclusion-kind.

expression (when present) holds the FHIRPath attribute reference from the CRTDL.

Each issue has the following extensions:

urlValue typeDescription
elementIdvalueStringCRTDL element ID of the criterion (omitted when absent)
groupRefvalueStringResource group reference (omitted when absent)
patientsExcludedvalueIntegerPatients excluded by this criterion
resourcesExcludedvalueIntegerIndividual resources excluded by this criterion
durationMsvalueIntegerCumulative processing time for this criterion (ms)
invocationsvalueIntegerNumber of times this criterion was evaluated

Example

json
{
  "resourceType": "OperationOutcome",
  "extension": [
    { "url": "jobId",               "valueString":  "<jobId>" },
    { "url": "cohortPatientsTotal", "valueInteger": 100 },
    { "url": "finalPatientsTotal",  "valueInteger": 87 },
    { "url": "cohortQueryDurationMs", "valueInteger": 1240 },
    {
      "url": "stage.consent-fetch",
      "extension": [
        { "url": "durationMs",         "valueInteger": 850 },
        { "url": "resourcesProcessed", "valueInteger": 100 },
        { "url": "resourcesPerMinute", "valueInteger": 7058 }
      ]
    },
    {
      "url": "stage.direct-load",
      "extension": [
        { "url": "durationMs",         "valueInteger": 3200 },
        { "url": "resourcesProcessed", "valueInteger": 4300 },
        { "url": "resourcesPerMinute", "valueInteger": 80625 }
      ]
    }
  ],
  "issue": [
    {
      "severity": "information",
      "code": "suppressed",
      "details": {
        "coding": [
          {
            "system": "https://torch.mii.de/fhir/CodeSystem/exclusion-kind",
            "code": "CONSENT"
          }
        ]
      },
      "extension": [
        { "url": "patientsExcluded",  "valueInteger": 5 },
        { "url": "resourcesExcluded", "valueInteger": 0 },
        { "url": "durationMs",        "valueInteger": 320 },
        { "url": "invocations",       "valueInteger": 100 }
      ]
    },
    {
      "severity": "information",
      "code": "business-rule",
      "details": {
        "coding": [
          {
            "system": "https://torch.mii.de/fhir/CodeSystem/exclusion-kind",
            "code": "MUST_HAVE"
          }
        ],
        "text": "Observation.code"
      },
      "expression": [ "Observation.code" ],
      "extension": [
        { "url": "elementId",         "valueString":  "obs-code-check" },
        { "url": "groupRef",          "valueString":  "Observation" },
        { "url": "patientsExcluded",  "valueInteger": 8 },
        { "url": "resourcesExcluded", "valueInteger": 42 },
        { "url": "durationMs",        "valueInteger": 610 },
        { "url": "invocations",       "valueInteger": 95 }
      ]
    }
  ]
}