Skip to Content
ReferenceData Model

Data Model

SeqDesk uses Prisma ORM with PostgreSQL. This page describes the core entities and their relationships.

Entity Relationship Overview

User ──< Order ──< Sample >── Study │ │ │ │ ├── Read ├── PipelineRun ──< PipelineRunStep │ │ │ │ ├── Assembly ├── PipelineRunEvent │ │ │ │ └── Bin └── PipelineArtifact ├── Department └── AdminInvite

Core Models

User

FieldTypeDescription
idStringPrimary key (CUID)
emailStringUnique login identifier
passwordStringbcrypt hash
firstName, lastNameStringDisplay name
roleStringRESEARCHER or FACILITY_ADMIN
researcherRoleString?PI, POSTDOC, PHD_STUDENT, MASTER_STUDENT, TECHNICIAN, OTHER
institutionString?Research institution
departmentIdString?Foreign key to Department

Order

FieldTypeDescription
idStringPrimary key (CUID)
orderNumberStringUnique, format: ORD-YYYYMMDD-XXXX
nameString?Descriptive name
statusStringDRAFT, SUBMITTED, or COMPLETED
platformString?ILLUMINA, OXFORD_NANOPORE, PACBIO, etc.
libraryStrategyString?WGS, RNA-Seq, AMPLICON, etc.
librarySourceString?GENOMIC, METAGENOMIC, etc.
customFieldsString?JSON for form builder fields
userIdStringForeign key to User

Sample

FieldTypeDescription
idStringPrimary key (CUID)
sampleIdStringInternal ID (format: S-{timestamp}-{random})
sampleAliasString?User-friendly alias
scientificNameString?Taxonomic name
taxIdString?NCBI taxonomy ID
checklistDataString?JSON — MIxS metadata
checklistUnitsString?JSON — units for metadata
customFieldsString?JSON — custom form fields
orderIdStringForeign key to Order
studyIdString?Foreign key to Study (optional)

Study

FieldTypeDescription
idStringPrimary key (CUID)
titleStringStudy title
aliasString?Unique alias for ENA
checklistTypeString?MIxS checklist type
studyAccessionIdString?ENA accession (PRJEB…)
submittedBooleanWhether submitted to ENA
readyForSubmissionBooleanMarked ready by user
userIdStringForeign key to User (owner)

Read

FieldTypeDescription
idStringPrimary key (CUID)
file1String?Forward reads path (R1)
file2String?Reverse reads path (R2)
checksum1, checksum2String?MD5 checksums
experimentAccessionNumberString?ENA experiment (ERX…)
runAccessionNumberString?ENA run (ERR…)
sampleIdStringForeign key to Sample
sequencingRunIdString?Foreign key to SequencingRun

PipelineRun

FieldTypeDescription
idStringPrimary key (CUID)
runNumberStringUnique, format: {PIPELINE}-{DATE}-{NNN}
pipelineIdStringPipeline identifier (e.g., mag)
statusStringpending, queued, running, completed, failed, cancelled
progressInt0–100
studyIdStringForeign key to Study
userIdStringForeign key to User (who started it)
runFolderStringPath to run directory

Assembly

FieldTypeDescription
idStringPrimary key (CUID)
assemblyNameStringAssembly identifier
assemblyFileStringPath to FASTA file
assemblyAccessionString?ENA accession
sampleIdStringForeign key to Sample
createdByPipelineRunIdStringForeign key to PipelineRun

Bin

FieldTypeDescription
idStringPrimary key (CUID)
binNameStringBin identifier
binFileStringPath to bin FASTA
completenessFloatCheckM completeness (0–100)
contaminationFloatCheckM contamination (0–100)
sampleIdStringForeign key to Sample
createdByPipelineRunIdStringForeign key to PipelineRun

Supporting Models

ModelPurpose
DepartmentUser grouping with name, description, isActive
AdminInviteInvite codes for admin registration
StatusNoteAudit trail on orders (STATUS_CHANGE, SAMPLES_SENT, INTERNAL)
SequencingRunRun-level metadata and QC metrics
PipelineConfigPer-pipeline enabled flag and settings
PipelineRunStepIndividual process status within a run

The remaining supporting models are documented in detail below — each is either touched by automation, surfaced in a dashboard, or has structure that the table-summary doesn’t capture.

Sampleset

Per-order metadata form configuration. One Sampleset per Order (orderId is unique).

FieldTypeDescription
idStringPrimary key (CUID)
checklistsJSON stringArray of enabled MIxS checklist accessions, e.g. ["ERC000022"]
selectedFieldsJSON string?Subset of checklist fields the order surfaces, when narrower than the full checklist
fieldOverridesJSON string?Per-field overrides keyed by field id — typically { label, required, helpText } to localize defaults
sampleTypeIntDiscriminator (default 1 for standard biological samples)
orderIdString, uniqueForeign key to Order

The combination of checklists, selectedFields, and fieldOverrides is how a facility tailors the MIxS metadata form per order without forking the underlying checklist definition.

Submission

ENA submission tracking per entity. Drives the Submissions Dashboard.

FieldTypeDescription
idStringPrimary key (CUID)
submissionTypeStringSTUDY, SAMPLE, READ, ASSEMBLY, BIN
statusStringOne of PENDING, SUBMITTED, PARTIAL, ACCEPTED, REJECTED, ERROR, CANCELLED
xmlContentString?Generated XML SeqDesk sent to ENA (kept for debugging)
responseJSON string?ENA response plus a steps[] timeline rendered by the dashboard
accessionNumbersJSON string?Map of returned accessions, e.g. { "studyAccession": "PRJEB12345" }
entityTypeStringstudy or sample
entityIdStringFK into Study or Sample
createdAt, updatedAtDateTimeStandard timestamps

SequencingUpload

Tracks an in-progress chunked upload session for a sequencing artifact (reads, checksums, etc.). Created by POST /api/orders/[orderId]/sequencing/uploads and finalized by the matching complete endpoint.

FieldTypeDescription
idStringPrimary key (CUID)
orderIdStringForeign key to Order
sampleIdString?Optional; when the upload is a per-sample artifact
targetKindStringREADS, ASSEMBLY, CHECKSUMS, …
targetRoleStringRole within targetKind, e.g. SAMPLE_READ_FORWARD
originalNameStringFilename as submitted
tempPathStringServer path receiving chunks
finalPathString?Promoted path once complete succeeds
expectedSizeBigIntBytes expected by initiate
receivedSizeBigIntBytes received so far
statusStringPENDING, COMPLETED, ABORTED
checksumProvided, checksumComputedString?Optional MD5 verification
mimeTypeString?MIME type if known
metadataJSON string?Caller-supplied metadata
createdByIdStringUser who initiated the upload
createdAt, updatedAtDateTimeStandard timestamps

Indexes on (orderId, status) and (sampleId, status) keep the upload list queries fast.

PipelineRunEvent

Event-feed entry from a pipeline run, populated by the weblog endpoint and internal step transitions.

FieldTypeDescription
idStringPrimary key (CUID)
pipelineRunIdStringForeign key to PipelineRun
eventTypeStringrun_started, process_completed, process_failed, etc. — values are open, not gate-kept
processNameString?Nextflow process or SLURM step identifier
stepIdString?SeqDesk-side step id
statusString?RUNNING, COMPLETED, FAILED, …
messageString?Human-readable detail
payloadJSON string?Full event body, trimmed to a reasonable size
sourceString?weblog, trace, queue, process
occurredAtDateTimeIndexed alongside pipelineRunId for timeline queries

PipelineArtifact

Files produced by a pipeline run. Used by the assembly browser, bin viewer, and QC report previewer.

FieldTypeDescription
idStringPrimary key (CUID)
typeStringreads, assembly, bins, qc_report, alignment
nameString?Display name
pathStringPath relative to the configured data base path
checksumString?MD5 if computed
sizeBigInt?Bytes if known
studyId, sampleIdString?Optional lineage links
pipelineRunIdString?Foreign key to PipelineRun
producedByStepIdString?Step that wrote the artifact
metadataJSON string?Tool-specific info (e.g., MultiQC summary stats)
createdAtDateTimeStandard timestamp

DemoWorkspace

Disposable demo session record. See Demo mode for the full lifecycle.

FieldTypeDescription
idStringPrimary key (CUID)
tokenHashString, uniqueSHA-256 of the bootstrap token; raw token only lives in the browser cookie
userIdString, uniqueForeign key to User (the demo researcher)
adminUserIdString?, uniqueForeign key to User (demo facility admin)
seedVersionIntBumped when the seed schema changes
lastSeenAtDateTimeUpdated on each request
expiresAtDateTime, indexedCleanup query target
createdAt, updatedAtDateTimeStandard timestamps

SiteSettings

Singleton configuration row (id is always "singleton"). Stores the bulk of facility configuration; large or nested config is held in two JSON columns:

ColumnShape
modulesConfig{ "modules": { "sequencing-tech": true, … } } — module enable map
extraSettingsFree-form JSON for everything else: studyFormFields, studyFormGroups, pipelineExecution, telemetry, installProfile, ena, sequencingTechConfig, etc.

The installProfile sub-object is written by scripts/apply-install-profile.mjs and exposes { id, version, name, appliedAt } — the source of the install profile metadata shown in admin and reported in telemetry heartbeats.

OrderFormConfig

Single-row table holding the order form schema as configured in the Order Form Builder.

ColumnShape
schemaJSON { fields: [...], groups: [...], version: "..." } matching the response from GET /api/form-schema

The schema is merge-applied during install-profile application, so a profile can ship a default form without overwriting facility-local additions.

TicketMessage

Per-message row inside a Ticket thread. Tickets back the in-app messaging UI between researchers and facility admins.

FieldTypeDescription
idStringPrimary key (CUID)
ticketIdStringForeign key to Ticket
senderIdStringForeign key to User
bodyStringMessage body
readByJSON string?Array of user ids who have read this message
createdAtDateTimeStandard timestamp