← All seeds & suites
seqcore ADL 0.5.1 Life Sciences

SeqCore LIMS

Laboratory information management for sequencing labs — accessioning, chain of custody, library QC, flow-cell runs, checksummed analysis, and director sign-out.

Resources (10)
client, requisition, specimen, custody, instrument, library, run, loading, analysis, report
Roles (5)
accessioner, analyst, director, technologist, admin
Features (10)
suitepermissionsstate_machinevalidationrules_engineviewsscheduled_tasksaudithistory_eventsindexes

Laboratory information management for sequencing labs. seqcore-lims.infinity-sdg.com. An Infinity Software Development Group product built on Kalos/ADL.

requisition → specimen (chain of custody) → library (QC) → loading → run → analysis → report

What it enforces

The rules below are enforced on the server, so no screen or API call can skip them.

  • A rejected specimen goes no further. Rejecting one requires a reason, and only accepted specimens can become libraries.
  • A library that failed QC never reaches a run.
  • A run’s contents are fixed once it starts.
  • No run starts on an instrument that is out of calibration. A daily schedule also takes lapsed instruments offline.
  • A completed run under 75% Q30 is flagged for the director.
  • Analysis starts only on a completed run. The pipeline version is written once, and every output carries a SHA-256 checksum.
  • A report is signed only against a completed analysis. The analyst reviews it, the director signs it, then it’s released. A signed report is frozen.
  • Chain-of-custody entries are append-only.
  • Turnaround is tracked per requisition. The turnaround board highlights overdue work.
  • Every change is audited with the old and new values, who made it and when.

Resources

client · requisition · specimen · custody · instrument · library · run · loading · analysis · report

Views: turnaroundBoard, runQuality, reportsAwaitingSignature. Roles: accessioner, technologist, analyst, director, admin.

Demo data

Two weeks of a clinical sequencing lab:

  • Specimens: 12 requisitions from 10 clients. One specimen was rejected (unlabeled tube) and one is still at receipt.
  • Libraries and runs: one library failed QC. Seven runs completed (one under 75% Q30, so it’s flagged), one failed, one is running and one is planned.
  • Results: analyses are complete, and reports sit at every stage: four released, two signed, three awaiting signature, one draft.
  • Calibration: one backup sequencer’s calibration has lapsed.

Regenerate the seed with python3 seeds/gen_seed.py.

Run it

This repo runs on a Kalos checkout, as one of its *.infinity-sdg.com sub-domain sites.

export KALOS_REPO=~/kalos        # defaults to ../kalos beside this repo
scripts/kalos.sh validate        # static checks (adlref + config + seed)
scripts/kalos.sh start           # certs + fresh DB + kalosd on :9206
scripts/kalos.sh verify          # boot, seed, exercise over TLS, stop

Sign in as admin / Admin123!, or as accessioner1, tech1, analyst1 or director1 / Demo123!.

Domain Resource Summary

ResourcePurpose & Lifecycle
clientWho sends work: a hospital, clinic, research group or biopharma sponsor.
requisitionOne ordered test. Carries the turnaround clock. (States: received, in_progress, reported, cancelled)
specimenA received specimen. Accepted or rejected at accessioning; rejected specimens go no further. (States: received, accepted, rejected, consumed)
custodyChain of custody: every hand-off of a specimen, by whom, where and when.
instrumentSequencers and prep instruments. Calibration gates use. (States: available, maintenance)
libraryA sequencing library prepared from an accepted specimen, with its QC. (States: prepared, pooled, discarded)
runA sequencing run on one flow cell. (States: planned, running, completed, failed)
loadingOne library loaded on one run, with its sample index.
analysisSecondary analysis of one library’s data with a versioned pipeline. (States: queued, running, completed, failed)
reportThe deliverable. Reviewed by an analyst, signed by the director, then released. (States: draft, reviewed, signed, released)
Inspect domain.yaml (512 lines)
# seqcore-lims/backend/domain.yaml
#
# SeqCore LIMS — laboratory information management for a sequencing lab.
#
#   requisition → specimen (chain of custody) → library (QC) → loading → run
#               → analysis → report (review → sign → release)
#
# Every hand-off is a gate the server enforces: a rejected specimen goes no
# further, a library that failed QC never reaches a run, a run never starts
# on an out-of-calibration instrument, and a report is signed only against a
# completed analysis. Turnaround is visible per requisition.
#
# An ISDG product, resellable to clinical, research-core and biopharma
# sequencing labs. Same construct set and field-naming rule as the other
# ISDG sites: query() filter keys are single lowercase words.

domain:
  name: seqcore
  version: "1.0.0"
  description: >
    Sequencing-lab LIMS: accessioning with chain of custody, library prep and
    QC, run loading, sequencing runs, analysis with versioned pipelines, and
    reports that are reviewed, signed and released.

  resources:

    client:
      description: "Who sends work: a hospital, clinic, research group or biopharma sponsor."
      object:
        id:    { type: uuid, primaryKey: true, protected: true, allowUserProvided: true }
        code:  { type: string, required: true, unique: true, maxLength: 24 }
        name:  { type: string, required: true, maxLength: 160 }
        kind:  { type: string, required: true, enum: [hospital, clinic, research, biopharma] }
        contactEmail: { type: email, required: true }
        active: { type: boolean, default: true }
      permissions:
        list:   [accessioner, technologist, analyst, director, admin]
        get:    [accessioner, technologist, analyst, director, admin]
        create: [accessioner, admin]
        update: [accessioner, admin]
        delete: [admin]
      features: { audit: true }

    requisition:
      description: "One ordered test. Carries the turnaround clock."
      object:
        id:         { type: uuid, primaryKey: true, protected: true, allowUserProvided: true }
        client:
          type: reference
          references: "adl.seqcore.seqcore.client"
          required: true
        accession:  { type: string, required: true, unique: true, maxLength: 24 }
        test:       { type: string, required: true, enum: [hereditary_panel, exome, tumor_panel, research_wgs, rna_panel] }
        priority:   { type: string, required: true, enum: [routine, stat], default: routine }
        receivedOn: { type: date, required: true }
        dueOn:      { type: date, required: true }
        reportedOn: { type: date }
        status:     { type: string, required: true, default: received }
      validation:
        dueAfterReceipt:
          rule: "dueOn == null || receivedOn == null || dueOn >= receivedOn"
          message: "A requisition cannot be due before it was received."
        accessionIsWrittenOnce:
          rule: "isCreate() || !fieldChanged('accession')"
          message: "An accession number is permanent."
      stateMachine:
        field: status
        initial: received
        states:
          received:
            transitions:
              begin:  { to: in_progress, guards: [accessioner, technologist, admin] }
              cancel: { to: cancelled, guards: [accessioner, director, admin] }
          in_progress:
            transitions:
              complete: { to: reported, guards: [director, admin], sets: { reportedOn: now() } }
              cancel:   { to: cancelled, guards: [director, admin] }
          reported: {}
          cancelled: {}
      permissions:
        list:   [accessioner, technologist, analyst, director, admin]
        get:    [accessioner, technologist, analyst, director, admin]
        create: [accessioner, admin]
        update: [accessioner, technologist, director, admin]
        delete: [admin]
      features: { audit: true }
      indexes:
        - { fields: [client] }
        - { fields: [dueOn] }
        - { fields: [status] }

    specimen:
      description: "A received specimen. Accepted or rejected at accessioning; rejected specimens go no further."
      object:
        id:          { type: uuid, primaryKey: true, protected: true, allowUserProvided: true }
        requisition:
          type: reference
          references: "adl.seqcore.seqcore.requisition"
          required: true
        barcode:     { type: string, required: true, unique: true, maxLength: 32 }
        kind:        { type: string, required: true, enum: [blood, saliva, tissue_block, extracted_dna, extracted_rna] }
        collectedOn: { type: date }
        receivedAt:  { type: datetime, required: true }
        rejectReason: { type: string, maxLength: 200 }
        status:      { type: string, required: true, default: received }
      validation:
        collectedBeforeReceipt:
          rule: "collectedOn == null || receivedAt == null || collectedOn <= receivedAt"
          message: "A specimen cannot be collected after it was received."
      stateMachine:
        field: status
        initial: received
        states:
          received:
            transitions:
              accept: { to: accepted, guards: [accessioner, admin] }
              reject: { to: rejected, guards: [accessioner, admin], requiredFields: [rejectReason] }
          accepted:
            transitions:
              consume: { to: consumed, guards: [technologist, admin] }
          rejected: {}
          consumed: {}
      permissions:
        list:   [accessioner, technologist, analyst, director, admin]
        get:    [accessioner, technologist, analyst, director, admin]
        create: [accessioner, admin]
        update: [accessioner, technologist, admin]
        delete: [admin]
      features: { audit: true }
      indexes:
        - { fields: [requisition] }
        - { fields: [status] }

    custody:
      description: "Chain of custody: every hand-off of a specimen, by whom, where and when."
      object:
        id:       { type: uuid, primaryKey: true, protected: true, allowUserProvided: true }
        specimen:
          type: reference
          references: "adl.seqcore.seqcore.specimen"
          required: true
        action:   { type: string, required: true, enum: [received, stored, moved, aliquoted, returned, disposed] }
        location: { type: string, required: true, maxLength: 80 }
        handledBy: { type: string, required: true, maxLength: 100 }
        at:       { type: datetime, required: true }
      validation:
        custodyIsAppendOnly:
          rule: "isCreate()"
          message: "Chain-of-custody entries are never edited. Add a correcting entry."
      permissions:
        list:   [accessioner, technologist, analyst, director, admin]
        get:    [accessioner, technologist, analyst, director, admin]
        create: [accessioner, technologist, admin]
        update: [admin]
        delete: []
      features: { audit: true }
      indexes:
        - { fields: [specimen] }
        - { fields: [at] }

    instrument:
      description: "Sequencers and prep instruments. Calibration gates use."
      object:
        id:       { type: uuid, primaryKey: true, protected: true, allowUserProvided: true }
        assetTag: { type: string, required: true, unique: true, maxLength: 24 }
        model:    { type: string, required: true, maxLength: 80 }
        kind:     { type: string, required: true, enum: [sequencer, liquid_handler, quantifier, thermocycler, fragment_analyzer] }
        calibrationDueOn: { type: date, required: true }
        status:   { type: string, required: true, default: available }
      stateMachine:
        field: status
        initial: available
        states:
          available:
            transitions:
              take_down: { to: maintenance, guards: [technologist, admin] }
          maintenance:
            transitions:
              return_to_service: { to: available, guards: [technologist, admin] }
      permissions:
        list:   [accessioner, technologist, analyst, director, admin]
        get:    [accessioner, technologist, analyst, director, admin]
        create: [admin]
        update: [technologist, admin]
        delete: [admin]
      features: { audit: true }

    library:
      description: "A sequencing library prepared from an accepted specimen, with its QC."
      object:
        id:        { type: uuid, primaryKey: true, protected: true, allowUserProvided: true }
        specimen:
          type: reference
          references: "adl.seqcore.seqcore.specimen"
          required: true
        code:      { type: string, required: true, unique: true, maxLength: 32 }
        kit:       { type: string, required: true, maxLength: 80 }
        kitLot:    { type: string, required: true, maxLength: 40 }
        concentrationNgUl: { type: decimal, precision: 8, scale: 3, min: 0 }
        fragmentBp: { type: integer, min: 0 }
        qc:        { type: string, required: true, enum: [pass, fail], default: pass }
        preparedBy: { type: string, required: true, maxLength: 100 }
        status:    { type: string, required: true, default: prepared }
      stateMachine:
        field: status
        initial: prepared
        states:
          prepared:
            transitions:
              pool:    { to: pooled, guards: [technologist, admin] }
              discard: { to: discarded, guards: [technologist, admin] }
          pooled: {}
          discarded: {}
      permissions:
        list:   [accessioner, technologist, analyst, director, admin]
        get:    [accessioner, technologist, analyst, director, admin]
        create: [technologist, admin]
        update: [technologist, admin]
        delete: [admin]
      features: { audit: true }
      indexes:
        - { fields: [specimen] }

    run:
      description: "A sequencing run on one flow cell."
      object:
        id:         { type: uuid, primaryKey: true, protected: true, allowUserProvided: true }
        instrument:
          type: reference
          references: "adl.seqcore.seqcore.instrument"
          required: true
        flowcell:   { type: string, required: true, unique: true, maxLength: 32 }
        chemistry:  { type: string, required: true, maxLength: 40 }
        plannedOn:  { type: date, required: true }
        startedAt:  { type: datetime }
        endedAt:    { type: datetime }
        q30Percent: { type: percentage }
        yieldGb:    { type: decimal, precision: 10, scale: 2, min: 0 }
        failureReason: { type: text }
        status:     { type: string, required: true, default: planned }
      stateMachine:
        field: status
        initial: planned
        states:
          planned:
            transitions:
              start: { to: running, guards: [technologist, admin], sets: { startedAt: now() } }
          running:
            transitions:
              complete: { to: completed, guards: [technologist, admin], sets: { endedAt: now() } }
              fail: { to: failed, guards: [technologist, admin], requiredFields: [failureReason], sets: { endedAt: now() } }
          completed: {}
          failed: {}
      permissions:
        list:   [accessioner, technologist, analyst, director, admin]
        get:    [accessioner, technologist, analyst, director, admin]
        create: [technologist, admin]
        update: [technologist, admin]
        delete: [admin]
      features: { audit: true }
      history:
        events:
          runStarted:   { trigger: transition, transition: start, severity: info }
          runCompleted: { trigger: transition, transition: complete, severity: success }
          runFailed:    { trigger: transition, transition: fail, capture: [failureReason], label: "Run failed: {failureReason}", severity: error }
      indexes:
        - { fields: [instrument] }
        - { fields: [status] }

    loading:
      description: "One library loaded on one run, with its sample index."
      object:
        id:      { type: uuid, primaryKey: true, protected: true, allowUserProvided: true }
        run:
          type: reference
          references: "adl.seqcore.seqcore.run"
          required: true
        library:
          type: reference
          references: "adl.seqcore.seqcore.library"
          required: true
        indexSeq: { type: string, required: true, maxLength: 24, pattern: "^[ACGT]{6,24}$" }
        lane:    { type: integer, min: 1, max: 8, default: 1 }
      permissions:
        list:   [technologist, analyst, director, admin]
        get:    [technologist, analyst, director, admin]
        create: [technologist, admin]
        update: [technologist, admin]
        delete: [admin]
      features: { audit: true }
      indexes:
        - { fields: [run] }
        - { fields: [library] }

    analysis:
      description: "Secondary analysis of one library's data with a versioned pipeline."
      object:
        id:          { type: uuid, primaryKey: true, protected: true, allowUserProvided: true }
        run:
          type: reference
          references: "adl.seqcore.seqcore.run"
          required: true
        library:
          type: reference
          references: "adl.seqcore.seqcore.library"
          required: true
        pipeline:        { type: string, required: true, maxLength: 60 }
        pipelineVersion: { type: string, required: true, maxLength: 20 }
        meanCoverage:    { type: decimal, precision: 8, scale: 1, min: 0 }
        outputUri:       { type: url }
        checksum:        { type: string, maxLength: 64, pattern: "^[a-f0-9]{64}$" }
        status:          { type: string, required: true, default: queued }
      validation:
        outputIsChecksummed:
          rule: "outputUri == null || checksum != null"
          message: "Analysis output must carry its SHA-256 checksum."
        pipelineVersionIsWrittenOnce:
          rule: "isCreate() || !fieldChanged('pipelineVersion')"
          message: "The pipeline version is part of the result. Re-run as a new analysis."
      stateMachine:
        field: status
        initial: queued
        states:
          queued:
            transitions:
              start: { to: running, guards: [analyst, admin] }
          running:
            transitions:
              complete: { to: completed, guards: [analyst, admin] }
              fail:     { to: failed, guards: [analyst, admin] }
          completed: {}
          failed: {}
      permissions:
        list:   [technologist, analyst, director, admin]
        get:    [technologist, analyst, director, admin]
        create: [analyst, admin]
        update: [analyst, admin]
        delete: [admin]
      features: { audit: true }
      indexes:
        - { fields: [run] }
        - { fields: [library] }

    report:
      description: "The deliverable. Reviewed by an analyst, signed by the director, then released."
      object:
        id:          { type: uuid, primaryKey: true, protected: true, allowUserProvided: true }
        requisition:
          type: reference
          references: "adl.seqcore.seqcore.requisition"
          required: true
        analysis:
          type: reference
          references: "adl.seqcore.seqcore.analysis"
          required: true
        summary:     { type: text, required: true }
        reviewedBy:  { type: string, maxLength: 100 }
        signedBy:    { type: string, maxLength: 100 }
        signedAt:    { type: datetime }
        releasedAt:  { type: datetime }
        status:      { type: string, required: true, default: draft }
      validation:
        signedReportsAreFrozen:
          rule: "isCreate() || status == 'draft' || status == 'reviewed' || !fieldChanged('summary')"
          message: "A signed report is frozen. Issue an amended report instead."
      stateMachine:
        field: status
        initial: draft
        states:
          draft:
            transitions:
              review: { to: reviewed, guards: [analyst, admin], sets: { reviewedBy: $user.id } }
          reviewed:
            transitions:
              sign: { to: signed, guards: [director, admin], sets: { signedBy: $user.id, signedAt: now() } }
          signed:
            transitions:
              release: { to: released, guards: [director, accessioner, admin], sets: { releasedAt: now() } }
          released: {}
      permissions:
        list:   [accessioner, analyst, director, admin]
        get:    [accessioner, analyst, director, admin]
        create: [analyst, admin]
        update: [analyst, director, accessioner, admin]
        delete: [admin]
      features: { audit: true }
      history:
        events:
          reportSigned:   { trigger: transition, transition: sign, severity: success }
          reportReleased: { trigger: transition, transition: release, severity: success }
      indexes:
        - { fields: [requisition] }
        - { fields: [status] }

  rules:

    rejectedSpecimensGoNoFurther:
      description: "A library is prepared only from an accepted specimen."
      trigger: { resource: library, events: [create] }
      condition: "some(query('specimen', { id: $record.specimen }), s => s.status != 'accepted')"
      action: reject
      severity: error
      regulation: "CAP LAB / CLIA 42 CFR 493.1242"
      message: "This specimen is not accepted. A library cannot be prepared from it."

    failedQcNeverReachesARun:
      description: "Only libraries that passed QC are loaded."
      trigger: { resource: loading, events: [create] }
      condition: "some(query('library', { id: $record.library }), l => l.qc != 'pass')"
      action: reject
      severity: error
      message: "This library failed QC and cannot be loaded."

    loadOnlyPlannedRuns:
      description: "A run's contents are fixed once it starts."
      trigger: { resource: loading, events: [create] }
      condition: "some(query('run', { id: $record.run }), r => r.status != 'planned')"
      action: reject
      severity: error
      message: "This run has already started. Load the library on a planned run."

    noRunOnAnOutOfCalibrationInstrument:
      description: "A run may not start on an instrument whose calibration has lapsed."
      trigger: { resource: run, events: [transition], transition: start }
      condition: "some(query('instrument', { id: $record.instrument }),
                       i => i.calibrationDueOn < today() || i.status != 'available')"
      action: reject
      severity: error
      regulation: "CLIA 42 CFR 493.1255"
      message: "The instrument is out of calibration or not available."

    lowQualityRun:
      description: "A completed run under 75% Q30 is flagged for the director."
      trigger: { resource: run, events: [transition], transition: complete }
      condition: "$record.q30Percent != null && $record.q30Percent < 75"
      action: warn
      severity: warning
      message: "Run quality is below 75% Q30. Review before analysis results are reported."

    analysisNeedsACompletedRun:
      description: "Analysis starts only on data from a completed run."
      trigger: { resource: analysis, events: [transition], transition: start }
      condition: "some(query('run', { id: $record.run }), r => r.status != 'completed')"
      action: reject
      severity: error
      message: "The run has not completed."

    signOnlyCompletedAnalyses:
      description: "A report is signed only against a completed analysis."
      trigger: { resource: report, events: [transition], transition: sign }
      condition: "some(query('analysis', { id: $record.analysis }), a => a.status != 'completed')"
      action: reject
      severity: error
      regulation: "CLIA 42 CFR 493.1291"
      message: "The analysis behind this report is not complete."

  schedules:

    takeLapsedInstrumentsOffline:
      description: "Every morning, instruments past their calibration date go to maintenance."
      recurrence: daily at 06:00
      source:
        resource: instrument
        filter: "status == 'available' && calibrationDueOn < today()"
      action: transition
      transition: take_down

  views:

    turnaroundBoard:
      description: "Open requisitions by due date — the lab's first screen of the day."
      source: requisition
      filter: "status == 'received' || status == 'in_progress'"
      permissions: [accessioner, technologist, analyst, director, admin]
      columns:
        - { field: accession,  label: "Accession" }
        - { field: test,       label: "Test" }
        - { field: priority,   label: "Priority" }
        - { field: receivedOn, label: "Received" }
        - { field: dueOn,      label: "Due" }
        - { field: status,     label: "State" }
        - name: overdue
          label: "Overdue"
          computed: "dueOn < today()"
          highlight:
            red: "== true"
      sort: dueOn asc
      defaultLimit: 200

    runQuality:
      description: "Every run with its quality and yield."
      source: run
      permissions: [technologist, analyst, director, admin]
      columns:
        - { field: flowcell,   label: "Flow cell" }
        - { field: chemistry,  label: "Chemistry" }
        - { field: q30Percent, label: "Q30 %" }
        - { field: yieldGb,    label: "Yield (Gb)" }
        - { field: status,     label: "State" }
      sort: plannedOn desc
      defaultLimit: 200

    reportsAwaitingSignature:
      description: "Reviewed reports waiting for the director."
      source: report
      filter: "status == 'reviewed'"
      permissions: [director, analyst, admin]
      columns:
        - { field: summary,    label: "Summary" }
        - { field: reviewedBy, label: "Reviewed by" }
        - { field: status,     label: "State" }
      defaultLimit: 200

Download seed bundle