Skip to content

Commit 6b04ace

Browse files
committed
Update documentation
1 parent a138e66 commit 6b04ace

47 files changed

Lines changed: 2057 additions & 1810 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

explanation/data-pipelines/index.html

Lines changed: 38 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6531,15 +6531,28 @@ <h2 id="pipeline-architecture">Pipeline Architecture<a class="headerlink" href="
65316531
</table>
65326532
<p>These components work together: code defines the schema and computations, the database tracks all metadata and relationships, and object storage holds the large scientific data files.</p>
65336533
<h2 id="pipeline-as-a-dag">Pipeline as a DAG<a class="headerlink" href="#pipeline-as-a-dag" title="Permanent link">&para;</a></h2>
6534-
<p>A DataJoint pipeline forms a <strong>Directed Acyclic Graph (DAG)</strong> at two levels:</p>
6535-
<p><img alt="Pipeline DAG Structure" src="../../images/pipeline-modules.svg" /></p>
6536-
<p><strong>Nodes</strong> represent Python modules, which correspond to database schemas — the dashed clusters in the diagram above.</p>
6537-
<p><strong>Edges</strong> represent:</p>
6538-
<ul>
6539-
<li>Python import dependencies between modules</li>
6540-
<li>Bundles of foreign key references between schemas</li>
6541-
</ul>
6542-
<p>This dual structure ensures that both code dependencies and data dependencies flow in the same direction.</p>
6534+
<p>A DataJoint pipeline forms a <strong>Directed Acyclic Graph (DAG)</strong> at two levels, and the same
6535+
pipeline can be viewed at either one.</p>
6536+
<p><strong>Module level — the collapsed view.</strong> Each node is a Python module, which corresponds to a
6537+
database schema. There is one edge per pair of schemas, standing for a bundle of dependencies:
6538+
every foreign key reference between the two schemas' tables, together with the Python import
6539+
dependency between their modules. A collapsed edge records only that the bundle exists — line
6540+
weight and line style describe an individual foreign key, so they are read at the table level,
6541+
not here. Below, <code>lab → session</code> and <code>session → imaging</code> each bundle two foreign keys,
6542+
<code>reference</code> supplies both <code>session</code> and <code>imaging</code>, and fourteen tables (including parts)
6543+
collapse to four nodes.</p>
6544+
<p><img alt="Pipeline DAG at the module level" src="../../images/pipeline-modules-collapsed.svg" /></p>
6545+
<p><strong>Table level — the expanded view.</strong> Each node is a table; the dashed clusters group the
6546+
tables of each module. Each edge is an individual foreign key constraint — the two foreign
6547+
keys that cross the <code>session → imaging</code> boundary (<code>Scan → ScanQuality</code> and
6548+
<code>ScanInfo → MotionCorrection</code>) appear separately here, having collapsed into the single
6549+
bundled edge above; likewise <code>Subject → Session</code> and <code>User → Session</code> across
6550+
<code>lab → session</code>. Each edge here carries the full notation — line weight for cardinality, line
6551+
style for whether the reference is part of the child's primary key — as specified in
6552+
<a href="../../reference/specs/diagram/">Diagram</a>.</p>
6553+
<p><img alt="Pipeline DAG at the table level" src="../../images/pipeline-modules.svg" /></p>
6554+
<p>This dual structure ensures that both code dependencies and data dependencies flow in the
6555+
same direction: collapsing every module's tables into a single node must itself yield a DAG.</p>
65436556
<h3 id="dag-constraints">DAG Constraints<a class="headerlink" href="#dag-constraints" title="Permanent link">&para;</a></h3>
65446557
<blockquote>
65456558
<p><strong>All foreign key relationships within a schema MUST form a DAG.</strong></p>
@@ -6562,18 +6575,18 @@ <h2 id="the-relational-workflow-model">The Relational Workflow Model<a class="he
65626575
</ul>
65636576
<p>This model treats the database schema as an <strong>executable workflow specification</strong>—defining not just what data exists but when and how it comes into existence.</p>
65646577
<h2 id="schema-organization">Schema Organization<a class="headerlink" href="#schema-organization" title="Permanent link">&para;</a></h2>
6565-
<p>Each schema corresponds to a dedicated Python module. The module import structure mirrors the foreign key dependencies between schemas:</p>
6566-
<p>Within a schema, tables of different tiers form their own DAG — here, a <code>scan</code> schema with lookup, manual, and imported tables, including a master table with its part tables:</p>
6567-
<p><img alt="Schema Structure" src="../../images/scan-schema.svg" /></p>
6578+
<p>Each schema corresponds to a dedicated Python module, and the module import structure mirrors the foreign key dependencies between schemas. The pipeline above is organized as:</p>
65686579
<div class="highlight"><pre><span></span><code>my_pipeline/
65696580
├── src/
65706581
│ └── my_pipeline/
65716582
│ ├── __init__.py
6572-
│ ├── subject.py # subject schema (no dependencies)
6573-
│ ├── session.py # session schema (depends on subject)
6574-
│ ├── acquisition.py # acquisition schema (depends on session)
6575-
│ └── analysis.py # analysis schema (depends on acquisition)
6583+
│ ├── lab.py # lab schema (no dependencies)
6584+
│ ├── reference.py # reference schema (no dependencies)
6585+
│ ├── session.py # session schema (imports lab, reference)
6586+
│ └── imaging.py # imaging schema (imports session, reference)
65766587
</code></pre></div>
6588+
<p>Within a schema, tables form their own DAG. Drilling into the <code>imaging</code> module: computed tables, including two masters with their part tables — <code>Segmentation</code> with <code>Segmentation.Roi</code>, and <code>Fluorescence</code> with <code>Fluorescence.Trace</code>, whose rows reference individual ROIs:</p>
6589+
<p><img alt="The imaging module expanded" src="../../images/imaging-schema.svg" /></p>
65776590
<p>For practical guidance on organizing multi-schema pipelines, configuring repositories, and managing team access, see <a href="../../how-to/manage-pipeline-project/">Manage a Pipeline Project</a>.</p>
65786591
<h2 id="object-augmented-schemas">Object-Augmented Schemas<a class="headerlink" href="#object-augmented-schemas" title="Permanent link">&para;</a></h2>
65796592
<p>Scientific data often includes large objects—images, recordings, time series, instrument outputs—that don't fit efficiently in relational tables. DataJoint addresses this through <strong>Object-Augmented Schemas (OAS)</strong>, a hybrid storage architecture that preserves relational semantics while handling arbitrarily large data.</p>
@@ -6619,26 +6632,29 @@ <h3 id="the-oas-philosophy">The OAS Philosophy<a class="headerlink" href="#the-o
66196632
<p>When a database row is deleted, its associated stored objects are garbage-collected. Foreign key cascades work correctly—delete upstream data and downstream results (including their objects) disappear. The database and object store remain synchronized without manual cleanup.</p>
66206633
<p><strong>5. Multiple storage tiers support diverse access patterns.</strong></p>
66216634
<p>Different attributes can route to different stores:</p>
6622-
<div class="highlight"><pre><span></span><code><span class="k">class</span><span class="w"> </span><span class="nc">Recording</span><span class="p">(</span><span class="n">dj</span><span class="o">.</span><span class="n">Imported</span><span class="p">):</span>
6635+
<div class="highlight"><pre><span></span><code><span class="k">class</span><span class="w"> </span><span class="nc">ScanInfo</span><span class="p">(</span><span class="n">dj</span><span class="o">.</span><span class="n">Imported</span><span class="p">):</span>
66236636
<span class="n">definition</span> <span class="o">=</span> <span class="s2">"""</span>
6624-
<span class="s2"> -&gt; Session</span>
6637+
<span class="s2"> -&gt; Scan</span>
66256638
<span class="s2"> ---</span>
6626-
<span class="s2"> raw_data : &lt;blob@fast&gt; # Hot storage for active analysis</span>
6639+
<span class="s2"> nframes : int32</span>
6640+
<span class="s2"> fps : float32</span>
6641+
<span class="s2"> raw_movie : &lt;blob@fast&gt; # Hot storage for active analysis</span>
66276642
<span class="s2"> archive : &lt;blob@cold&gt; # Cold storage for long-term retention</span>
66286643
<span class="s2"> """</span>
66296644
</code></pre></div>
6645+
<p>Here the pipeline's <code>ScanInfo</code> table keeps its scalar metadata (<code>nframes</code>, <code>fps</code>) in the database while routing its payloads to two different stores.</p>
66306646
<p>This architecture lets teams work with terabyte-scale datasets while retaining the query power, integrity guarantees, and reproducibility of the relational model.</p>
66316647
<h2 id="pipeline-workflow">Pipeline Workflow<a class="headerlink" href="#pipeline-workflow" title="Permanent link">&para;</a></h2>
66326648
<p>A typical data pipeline workflow:</p>
66336649
<ol>
66346650
<li>
6635-
<p><strong>Acquisition</strong> — Data is collected from instruments, experiments, or external sources. Raw files land in object storage; metadata populates Manual tables.</p>
6651+
<p><strong>Acquisition</strong> — Data is collected from instruments, experiments, or external sources. Raw files land in object storage; metadata populates Manual tables (<code>Session</code>, <code>Scan</code>).</p>
66366652
</li>
66376653
<li>
6638-
<p><strong>Import</strong> — Automated processes parse raw data, extract signals, and populate Imported tables with structured results.</p>
6654+
<p><strong>Import</strong> — Automated processes parse raw data, extract signals, and populate Imported tables with structured results (<code>ScanInfo</code>).</p>
66396655
</li>
66406656
<li>
6641-
<p><strong>Computation</strong> — The <code>populate()</code> mechanism identifies new data and triggers downstream processing. Compute resources execute transformations and populate Computed tables.</p>
6657+
<p><strong>Computation</strong> — The <code>populate()</code> mechanism identifies new data and triggers downstream processing. Compute resources execute transformations and populate Computed tables (<code>MotionCorrection</code>, <code>Segmentation</code>, <code>Fluorescence</code>).</p>
66426658
</li>
66436659
<li>
66446660
<p><strong>Query &amp; Analysis</strong> — Users query results across the pipeline, combining data from multiple stages to generate insights, reports, or visualizations.</p>

explanation/relational-workflow-model/index.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6607,10 +6607,10 @@ <h1 id="the-relational-workflow-model">The Relational Workflow Model<a class="he
66076607
the lineage of relational modeling follows.</p>
66086608
<h2 id="a-worked-example">A worked example<a class="headerlink" href="#a-worked-example" title="Permanent link">&para;</a></h2>
66096609
<p>Diagrams in this documentation use the same notation as <code>dj.Diagram</code> in
6610-
<code>datajoint-python</code>: <strong>Manual</strong> tables are green rectangles, <strong>Lookup</strong>
6611-
tables are gray rectangles, <strong>Imported</strong> tables are blue ovals, and
6612-
<strong>Computed</strong> tables are red ovals. A <strong>Part</strong> table is a plain rectangle
6613-
grouped with its master inside a light box. Tier is conveyed by shape and
6610+
<code>datajoint-python</code>: <strong>Manual</strong> tables are green rounded boxes, <strong>Lookup</strong>
6611+
tables are gray rounded boxes, <strong>Imported</strong> tables are blue ellipses, and
6612+
<strong>Computed</strong> tables are orange ellipses. A <strong>Part</strong> table is a small plain box
6613+
grouped with its master inside a light box (the <em>entity cluster</em>). Tier is conveyed by shape and
66146614
color, and <strong>edge thickness</strong> shows how a child relates to its parent — a
66156615
thick line means the child <strong>extends</strong> the parent (one per parent); a thin
66166616
line means the child is <strong>contained within</strong> the parent (many per parent).
@@ -6633,7 +6633,7 @@ <h2 id="a-worked-example">A worked example<a class="headerlink" href="#a-worked-
66336633
or combining several, inheriting its whole key and adding no new
66346634
dimension. The legend below the figure keys the full notation.</p>
66356635
<p><img alt="Worked-example imaging pipeline diagram spanning two schemas: experiment (Mouse → Session → Scan) and analysis (AverageFrame → Segmentation → Fluorescence, with Lookup SegmentationParam feeding Segmentation, and the Part tables Roi on Segmentation and Trace on Fluorescence)." src="../../images/rwm-pipeline.svg" /></p>
6636-
<p><img alt="Legend: table tiers — Manual (green rectangle), Lookup (gray rectangle), Imported (blue oval), Computed (red oval), Part (smaller plain rectangle); an underlined name is a new entity type (a new schema dimension, many rows per parent) while a plain name is composed from existing entities (one row per parent); edge thickness — thick means the child extends the parent, thin means the child is contained within the parent; a dashed rounded box is a schema module (labeled in the corner); a gray box encloses a master with its parts; edges have no arrowheads, so direction follows the layout." src="../../images/rwm-legend.svg" /></p>
6636+
<p><img alt="Legend: table tiers — Manual (green rounded box), Lookup (gray rounded box), Imported (blue ellipse), Computed (orange ellipse), Part (smaller plain box); an underlined name is a new entity type (a new schema dimension, many rows per parent) while a plain name is composed from existing entities (one row per parent); edge thickness — thick means the child extends the parent, thin means the child is contained within the parent; a dashed rounded box is a schema module (labeled in the corner); a gray box encloses a master with its parts; edges have no arrowheads, so direction follows the layout." src="../../images/rwm-legend.svg" /></p>
66376637
<p>The notation is specified in full in the <a href="../../reference/specs/diagram/">Diagram specification</a>. The concepts it depicts are explained in depth elsewhere: <a href="../entity-integrity/">entity integrity</a> (keys, entity types, and schema dimensions), <a href="../../reference/specs/master-part/">master–part tables</a> (the entity group and its all-or-nothing populate), the <a href="../computation-model/">computation model</a> (how <code>make()</code> produces Imported and Computed tables), and <a href="../semantic-matching/">semantic matching</a> (why a name means the same thing everywhere it appears).</p>
66386638
<p>The pipeline spans two schemas: <strong><code>experiment</code></strong> holds the raw, manually
66396639
entered tables, and <strong><code>analysis</code></strong> holds everything derived from them.

how-to/demo_modules/__init__/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3301,7 +3301,7 @@ <h1> init </h1>
33013301
</style>
33023302
<!-- End of mermaid configuration --><div class="jupyter-wrapper">
33033303
<div class="jp-Notebook" data-jp-theme-light="true" data-jp-theme-name="JupyterLab Light">
3304-
<div class="jp-Cell jp-MarkdownCell jp-Notebook-cell" id="cell-id=1f044a8e">
3304+
<div class="jp-Cell jp-MarkdownCell jp-Notebook-cell" id="cell-id=3c940ccf">
33053305
<div class="jp-Cell-inputWrapper" tabindex="0">
33063306
<div class="jp-Collapser jp-InputCollapser jp-Cell-inputCollapser">
33073307
</div>

how-to/demo_modules/acquisition/index.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3302,7 +3302,7 @@ <h1>Acquisition</h1>
33023302
<!-- End of mermaid configuration --><div class="jupyter-wrapper">
33033303
<div class="jp-Notebook" data-jp-theme-light="true" data-jp-theme-name="JupyterLab Light">
33043304
<div class="jp-Cell jp-CodeCell jp-Notebook-cell jp-mod-noOutputs">
3305-
<div class="jp-Cell jp-CodeCell jp-Notebook-cell jp-mod-noOutputs" id="cell-id=62e86910">
3305+
<div class="jp-Cell jp-CodeCell jp-Notebook-cell jp-mod-noOutputs" id="cell-id=5b024389">
33063306
<div class="jp-Cell-inputWrapper" tabindex="0">
33073307
<div class="jp-Collapser jp-InputCollapser jp-Cell-inputCollapser">
33083308
</div>
@@ -3341,7 +3341,7 @@ <h1>Acquisition</h1>
33413341
</div>
33423342
</div>
33433343
</div><div class="jp-Cell jp-CodeCell jp-Notebook-cell jp-mod-noOutputs">
3344-
<div class="jp-Cell jp-CodeCell jp-Notebook-cell jp-mod-noOutputs" id="cell-id=7c9acf2d">
3344+
<div class="jp-Cell jp-CodeCell jp-Notebook-cell jp-mod-noOutputs" id="cell-id=892be4fc">
33453345
<div class="jp-Cell-inputWrapper" tabindex="0">
33463346
<div class="jp-Collapser jp-InputCollapser jp-Cell-inputCollapser">
33473347
</div>
@@ -3370,7 +3370,7 @@ <h1>Acquisition</h1>
33703370
</div>
33713371
</div>
33723372
</div><div class="jp-Cell jp-CodeCell jp-Notebook-cell jp-mod-noOutputs">
3373-
<div class="jp-Cell jp-CodeCell jp-Notebook-cell jp-mod-noOutputs" id="cell-id=2888d575">
3373+
<div class="jp-Cell jp-CodeCell jp-Notebook-cell jp-mod-noOutputs" id="cell-id=de073cf8">
33743374
<div class="jp-Cell-inputWrapper" tabindex="0">
33753375
<div class="jp-Collapser jp-InputCollapser jp-Cell-inputCollapser">
33763376
</div>
@@ -3409,7 +3409,7 @@ <h1>Acquisition</h1>
34093409
</div>
34103410
</div>
34113411
</div><div class="jp-Cell jp-CodeCell jp-Notebook-cell jp-mod-noOutputs">
3412-
<div class="jp-Cell jp-CodeCell jp-Notebook-cell jp-mod-noOutputs" id="cell-id=10c4b546">
3412+
<div class="jp-Cell jp-CodeCell jp-Notebook-cell jp-mod-noOutputs" id="cell-id=eea1f2fa">
34133413
<div class="jp-Cell-inputWrapper" tabindex="0">
34143414
<div class="jp-Collapser jp-InputCollapser jp-Cell-inputCollapser">
34153415
</div>
@@ -3452,7 +3452,7 @@ <h1>Acquisition</h1>
34523452
</div>
34533453
</div>
34543454
</div><div class="jp-Cell jp-CodeCell jp-Notebook-cell jp-mod-noOutputs">
3455-
<div class="jp-Cell jp-CodeCell jp-Notebook-cell jp-mod-noOutputs" id="cell-id=c6b4ba5c">
3455+
<div class="jp-Cell jp-CodeCell jp-Notebook-cell jp-mod-noOutputs" id="cell-id=fb2fd381">
34563456
<div class="jp-Cell-inputWrapper" tabindex="0">
34573457
<div class="jp-Collapser jp-InputCollapser jp-Cell-inputCollapser">
34583458
</div>

how-to/demo_modules/analysis/index.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3302,7 +3302,7 @@ <h1>Analysis</h1>
33023302
<!-- End of mermaid configuration --><div class="jupyter-wrapper">
33033303
<div class="jp-Notebook" data-jp-theme-light="true" data-jp-theme-name="JupyterLab Light">
33043304
<div class="jp-Cell jp-CodeCell jp-Notebook-cell jp-mod-noOutputs">
3305-
<div class="jp-Cell jp-CodeCell jp-Notebook-cell jp-mod-noOutputs" id="cell-id=5a4d0fec">
3305+
<div class="jp-Cell jp-CodeCell jp-Notebook-cell jp-mod-noOutputs" id="cell-id=6181bdb5">
33063306
<div class="jp-Cell-inputWrapper" tabindex="0">
33073307
<div class="jp-Collapser jp-InputCollapser jp-Cell-inputCollapser">
33083308
</div>
@@ -3343,7 +3343,7 @@ <h1>Analysis</h1>
33433343
</div>
33443344
</div>
33453345
</div><div class="jp-Cell jp-CodeCell jp-Notebook-cell jp-mod-noOutputs">
3346-
<div class="jp-Cell jp-CodeCell jp-Notebook-cell jp-mod-noOutputs" id="cell-id=8ecfcedc">
3346+
<div class="jp-Cell jp-CodeCell jp-Notebook-cell jp-mod-noOutputs" id="cell-id=a9323894">
33473347
<div class="jp-Cell-inputWrapper" tabindex="0">
33483348
<div class="jp-Collapser jp-InputCollapser jp-Cell-inputCollapser">
33493349
</div>
@@ -3372,7 +3372,7 @@ <h1>Analysis</h1>
33723372
</div>
33733373
</div>
33743374
</div><div class="jp-Cell jp-CodeCell jp-Notebook-cell jp-mod-noOutputs">
3375-
<div class="jp-Cell jp-CodeCell jp-Notebook-cell jp-mod-noOutputs" id="cell-id=a1f9662d">
3375+
<div class="jp-Cell jp-CodeCell jp-Notebook-cell jp-mod-noOutputs" id="cell-id=8cf7c315">
33763376
<div class="jp-Cell-inputWrapper" tabindex="0">
33773377
<div class="jp-Collapser jp-InputCollapser jp-Cell-inputCollapser">
33783378
</div>
@@ -3413,7 +3413,7 @@ <h1>Analysis</h1>
34133413
</div>
34143414
</div>
34153415
</div><div class="jp-Cell jp-CodeCell jp-Notebook-cell jp-mod-noOutputs">
3416-
<div class="jp-Cell jp-CodeCell jp-Notebook-cell jp-mod-noOutputs" id="cell-id=7f62a749">
3416+
<div class="jp-Cell jp-CodeCell jp-Notebook-cell jp-mod-noOutputs" id="cell-id=9b766892">
34173417
<div class="jp-Cell-inputWrapper" tabindex="0">
34183418
<div class="jp-Collapser jp-InputCollapser jp-Cell-inputCollapser">
34193419
</div>
@@ -3462,7 +3462,7 @@ <h1>Analysis</h1>
34623462
</div>
34633463
</div>
34643464
</div><div class="jp-Cell jp-CodeCell jp-Notebook-cell jp-mod-noOutputs">
3465-
<div class="jp-Cell jp-CodeCell jp-Notebook-cell jp-mod-noOutputs" id="cell-id=a68646b3">
3465+
<div class="jp-Cell jp-CodeCell jp-Notebook-cell jp-mod-noOutputs" id="cell-id=5cbed4ee">
34663466
<div class="jp-Cell-inputWrapper" tabindex="0">
34673467
<div class="jp-Collapser jp-InputCollapser jp-Cell-inputCollapser">
34683468
</div>

0 commit comments

Comments
 (0)