Migration plan: PR #211 + element #65 + reorg PR
Coordinates merging three PRs into production via one combined database migration:
Approach. PR #211 + element #65 merge code-only (no DB changes). Workers pause for affected tables until the reorg PR lands. The reorg PR ships the schema reorganization plus all remaining fixes. One maintenance window then runs the full DB migration.
Pipeline visualizations
Current (production main)
Final (post-reorg)
Phase overview
§1 — Pre-merge schema-shape fixes (PR #211 + element #65) — @judewerth
These fixes change table shapes; they must land before the reorg PR is opened (preferred) or be carried into the reorg PR (fallback).
.make() body changes only (no schema impact). Required before populating high-firing-rate sessions; otherwise out-of-memory.
Gate: do not populate STTC on any session with max firing rate > ~100 Hz until §3.1 and §3.2 land.
Active from PR #211 merge until the reorg PR merges.
§5 — Combined DB migration — @MilagrosMarin
Single maintenance window after the reorg PR merges. Detailed commands kept in internal notes (not inlined here).
5a — Backup
5b — Drop tables with shape changes (cascade handles downstreams)
5c — Create new schemas
DataJoint creates these automatically when the reorg PR code is imported, but creating them up-front simplifies FK handling during the rename block:
5d — Move tables (rename or drop+repopulate per §2.3)
Disable FK checks for this block; re-enable in §5h.
Rename (preserves data):
- All remaining
analysis tables → lfp_analysis (incl. LFPSpectrogram ~241k, ~log, ~external if present)
- Coupling tables:
analysis → coupling (STTFA, CouplingSession, PhaseAmplitudeCoupling + part, etc. — see §2.3 for the final list)
mua.BurstDetectionParamset → burst.BurstDetectionParamset
mua.TraceSession → selection.TraceSession
frame.TimeFrameParamset → selection.FrameParamset
Drop and let repopulate (per §2.3 decision): small or empty tables — recreated empty when the reorg PR code activates, then repopulated by workers.
5e — Clean up orphans
5f — Deploy the reorg PR code
DataJoint recreates dropped tables with their new shapes in the new locations:
culture.OrganoidImplantationImage (new parent + column)
lfp_analysis.FOOOFAnalysis (new PK)
selection.FrameSession (FK to FrameParamset; ActiveTimeFrames part recreated empty on first populate())
burst.BurstSession (parent = selection.FrameAnalysis.ActiveTimeFrames)
5g — Re-insert OrganoidImplantationImage rows
5h — Re-enable FK checks and verify (see §7)
§6 — Code/config notes (ship with PR merges)
- New deps:
bottleneck, neo, quantities, elephant, specparam (git: fooof-tools), tensorpac (git: EtienneCmb)
- DataJoint pin:
datajoint>=0.14,<2.0
- Lookup seed rows auto-populate via
contents=[...] on schema activation
- ⚠️
num_electrodes_inside must be set on OrganoidImplantationImage for every organoid before FrameAnalysis or PopulationBursts can populate (both raise ValueError if missing)
§7 — Verification
§8 — Downstream updates
Dashboard — @MilagrosMarin
Notebooks — @judewerth
Migration plan: PR #211 + element #65 + reorg PR
Coordinates merging three PRs into production via one combined database migration:
refactor/pipeline-reorganizationafter PR Integrate tools for final analysis #211 mergesApproach. PR #211 + element #65 merge code-only (no DB changes). Workers pause for affected tables until the reorg PR lands. The reorg PR ships the schema reorganization plus all remaining fixes. One maintenance window then runs the full DB migration.
Pipeline visualizations
Current (production
main)Final (post-reorg)
Phase overview
§1 — Pre-merge schema-shape fixes (PR #211 + element #65) — @judewerth
These fixes change table shapes; they must land before the reorg PR is opened (preferred) or be carried into the reorg PR (fallback).
judewerth:main(lazy imports, probe-type-restrictedmap_channel_to_electrode, LFP single-file boundary fix,ImpedanceMeasurementslogic order)ephys.prefix onImpedanceFile(-> EphysRawFile) andSTTC(-> CuratedClustering) FKs inephys_no_curation.pyFrameSession.frame_param_idx: int→-> TimeFrameParamsetinsrc/workflow/pipeline/frame.pyBurstSessionparent fromEphysSession→FrameAnalysis.ActiveTimeFramesinsrc/workflow/pipeline/mua.pyintegrateontomain(currently 7 commits behind)§2 — Reorg PR preparation — @MilagrosMarin
TimeFrameParamset→FrameParamsetrename (table-level rename; FK onFrameSessionupdated)EventBasedCoupling0,BurstDetectionParamset1,TensorpacParamset1,PhaseAmplitudeBands4,TraceSession5) are simpler to drop and repopulate than to rename. Tables with significant data (e.g.LFPSpectrogram~241k,STTFA~363,CouplingSession~512) must be renamed to preserve data. Output: a partition of §5d's table list.refactor/pipeline-reorganizationontomainafter PR Integrate tools for final analysis #211 mergesframeschema's 33 legacy dev-artifact tables (archive or drop)~externalstorage → migrate corresponding~externalentriesFrameParamsetFK target update — confirm DataJoint re-targets automatically, or update the FK manually§3 — Pre-populate
STTCfixes — @judewerth or @MilagrosMarin.make()body changes only (no schema impact). Required before populating high-firing-rate sessions; otherwise out-of-memory.np.subtract.outerinSTTC.make()withnp.searchsorted-based binary search (drafted in element Add a notebook for exploring spike sorting results #65 inline comment)neo.SpikeTraininput (drop the.astype(int)cast)Gate: do not populate
STTCon any session with max firing rate > ~100 Hz until §3.1 and §3.2 land.§4 — Worker freeze — @MilagrosMarin
Active from PR #211 merge until the reorg PR merges.
§5 — Combined DB migration — @MilagrosMarin
Single maintenance window after the reorg PR merges. Detailed commands kept in internal notes (not inlined here).
5a — Backup
OrganoidImplantationImagerows (image attachments +num_electrodes_insidevalues, pulled from the existingNumElectrodesInsidelookup if it has data)FOOOFAnalysisrows (if any)analysis,mua,frame,culture5b — Drop tables with shape changes (cascade handles downstreams)
culture.OrganoidImplantationImage— parent + new columnanalysis.FOOOFAnalysis(+.FBOSCAnalysispart) — PK changeframe.FrameSession— FK constraint added (cascadesFrameAnalysis+.ActiveTimeFrames)mua.BurstSession— parent change (cascadesPopulationBursts)5c — Create new schemas
DataJoint creates these automatically when the reorg PR code is imported, but creating them up-front simplifies FK handling during the rename block:
{DB_PREFIX}lfp_analysis{DB_PREFIX}coupling{DB_PREFIX}burst{DB_PREFIX}selection5d — Move tables (rename or drop+repopulate per §2.3)
Disable FK checks for this block; re-enable in §5h.
Rename (preserves data):
analysistables →lfp_analysis(incl.LFPSpectrogram~241k,~log,~externalif present)analysis→coupling(STTFA,CouplingSession,PhaseAmplitudeCoupling+ part, etc. — see §2.3 for the final list)mua.BurstDetectionParamset→burst.BurstDetectionParamsetmua.TraceSession→selection.TraceSessionframe.TimeFrameParamset→selection.FrameParamsetDrop and let repopulate (per §2.3 decision): small or empty tables — recreated empty when the reorg PR code activates, then repopulated by workers.
5e — Clean up orphans
culture.NumElectrodesInside(absorbed intoOrganoidImplantationImage.num_electrodes_inside)frameschema's 33 legacy dev-artifact tables per §2.6 decision5f — Deploy the reorg PR code
DataJoint recreates dropped tables with their new shapes in the new locations:
culture.OrganoidImplantationImage(new parent + column)lfp_analysis.FOOOFAnalysis(new PK)selection.FrameSession(FK toFrameParamset;ActiveTimeFramespart recreated empty on firstpopulate())burst.BurstSession(parent =selection.FrameAnalysis.ActiveTimeFrames)5g — Re-insert
OrganoidImplantationImagerowsOrganoidCultureparent → corresponding ControlExperiment, restore image attachment, fillnum_electrodes_insidefrom the §5a backup5h — Re-enable FK checks and verify (see §7)
§6 — Code/config notes (ship with PR merges)
bottleneck,neo,quantities,elephant,specparam(git: fooof-tools),tensorpac(git: EtienneCmb)datajoint>=0.14,<2.0contents=[...]on schema activationnum_electrodes_insidemust be set onOrganoidImplantationImagefor every organoid beforeFrameAnalysisorPopulationBurstscan populate (both raiseValueErrorif missing)§7 — Verification
{DB_PREFIX}analysisis emptylfp_analysis.LFPSpectrogram~241k,coupling.STTFA~363,coupling.CouplingSession~512,coupling.PhaseAmplitudeCoupling~512)burst.BurstSession,selection.FrameSession,lfp_analysis.Coherenceselection.FrameAnalysis.populate()succeeds on one organoid (withnum_electrodes_insideset)burst.PopulationBursts.populate()succeeds on one active frameSTTC.populate()succeeds on one low-firing session (skip high-firing until §3 lands)images_implantationpage renders for all organoids~jobserror entries in the 24 hours after migration§8 — Downstream updates
Dashboard — @MilagrosMarin
from workflow.pipeline import analysis→from workflow.pipeline import lfp_analysis, coupling, burst, selectionpages/images_implantation.pyrenders correctly post-migration (page already updated for the newOrganoidImplantationImageparent in commite99732e)Notebooks — @judewerth
EXPLORE_frame_analysis,CREATE_new_culture_session,CREATE_new_frame_session,ANALYZE_single_sessionCREATE_*andEXPLORE_*notebooks for new schema locationsANALYZE_single_organoid.ipynb(78k lines) for schema compatibility