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
└── AdminInviteCore Models
User
| Field | Type | Description |
|---|---|---|
| id | String | Primary key (CUID) |
| String | Unique login identifier | |
| password | String | bcrypt hash |
| firstName, lastName | String | Display name |
| role | String | RESEARCHER or FACILITY_ADMIN |
| researcherRole | String? | PI, POSTDOC, PHD_STUDENT, MASTER_STUDENT, TECHNICIAN, OTHER |
| institution | String? | Research institution |
| departmentId | String? | Foreign key to Department |
Order
| Field | Type | Description |
|---|---|---|
| id | String | Primary key (CUID) |
| orderNumber | String | Unique, format: ORD-YYYYMMDD-XXXX |
| name | String? | Descriptive name |
| status | String | DRAFT, SUBMITTED, or COMPLETED |
| platform | String? | ILLUMINA, OXFORD_NANOPORE, PACBIO, etc. |
| libraryStrategy | String? | WGS, RNA-Seq, AMPLICON, etc. |
| librarySource | String? | GENOMIC, METAGENOMIC, etc. |
| customFields | String? | JSON for form builder fields |
| userId | String | Foreign key to User |
Sample
| Field | Type | Description |
|---|---|---|
| id | String | Primary key (CUID) |
| sampleId | String | Internal ID (format: S-{timestamp}-{random}) |
| sampleAlias | String? | User-friendly alias |
| scientificName | String? | Taxonomic name |
| taxId | String? | NCBI taxonomy ID |
| checklistData | String? | JSON — MIxS metadata |
| checklistUnits | String? | JSON — units for metadata |
| customFields | String? | JSON — custom form fields |
| orderId | String | Foreign key to Order |
| studyId | String? | Foreign key to Study (optional) |
Study
| Field | Type | Description |
|---|---|---|
| id | String | Primary key (CUID) |
| title | String | Study title |
| alias | String? | Unique alias for ENA |
| checklistType | String? | MIxS checklist type |
| studyAccessionId | String? | ENA accession (PRJEB…) |
| submitted | Boolean | Whether submitted to ENA |
| readyForSubmission | Boolean | Marked ready by user |
| userId | String | Foreign key to User (owner) |
Read
| Field | Type | Description |
|---|---|---|
| id | String | Primary key (CUID) |
| file1 | String? | Forward reads path (R1) |
| file2 | String? | Reverse reads path (R2) |
| checksum1, checksum2 | String? | MD5 checksums |
| experimentAccessionNumber | String? | ENA experiment (ERX…) |
| runAccessionNumber | String? | ENA run (ERR…) |
| sampleId | String | Foreign key to Sample |
| sequencingRunId | String? | Foreign key to SequencingRun |
PipelineRun
| Field | Type | Description |
|---|---|---|
| id | String | Primary key (CUID) |
| runNumber | String | Unique, format: {PIPELINE}-{DATE}-{NNN} |
| pipelineId | String | Pipeline identifier (e.g., mag) |
| status | String | pending, queued, running, completed, failed, cancelled |
| progress | Int | 0–100 |
| studyId | String | Foreign key to Study |
| userId | String | Foreign key to User (who started it) |
| runFolder | String | Path to run directory |
Assembly
| Field | Type | Description |
|---|---|---|
| id | String | Primary key (CUID) |
| assemblyName | String | Assembly identifier |
| assemblyFile | String | Path to FASTA file |
| assemblyAccession | String? | ENA accession |
| sampleId | String | Foreign key to Sample |
| createdByPipelineRunId | String | Foreign key to PipelineRun |
Bin
| Field | Type | Description |
|---|---|---|
| id | String | Primary key (CUID) |
| binName | String | Bin identifier |
| binFile | String | Path to bin FASTA |
| completeness | Float | CheckM completeness (0–100) |
| contamination | Float | CheckM contamination (0–100) |
| sampleId | String | Foreign key to Sample |
| createdByPipelineRunId | String | Foreign key to PipelineRun |
Supporting Models
| Model | Purpose |
|---|---|
| Department | User grouping with name, description, isActive |
| AdminInvite | Invite codes for admin registration |
| StatusNote | Audit trail on orders (STATUS_CHANGE, SAMPLES_SENT, INTERNAL) |
| Sampleset | MIxS checklist configuration per order |
| SequencingRun | Run-level metadata and QC metrics |
| SiteSettings | Singleton configuration (branding, ENA, modules) |
| OrderFormConfig | Order form field definitions |
| PipelineConfig | Per-pipeline enabled flag and settings |
| PipelineRunStep | Individual process status within a run |
| PipelineRunEvent | Event log from weblog/trace |
| PipelineArtifact | Output files with metadata |
| Submission | ENA submission tracking per entity |