Skip to content

[SQL/DICOM archive] Clean up tarchive table - #11184

Open
MaximeBICMTL wants to merge 1 commit into
aces:mainfrom
MaximeBICMTL:clean-up-tarchive
Open

MaximeBICMTL wants to merge 1 commit into
aces:mainfrom
MaximeBICMTL:clean-up-tarchive

Conversation

@MaximeBICMTL

@MaximeBICMTL MaximeBICMTL commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Description

Clean up the tarchive tables as discussed in the LORIS imaging meeting:

  • Rename DicomArchiveID to StudyInstanceUID.
  • Rename CenterName to InstitutionName.
  • Delete AcquisitionMetadata, tarTypeVersion, sumTypeVersion, neurodbCenterName, uploadAttempt, DateSent, PendingTransfer.
  • Make the Scanner fields nullable. Currently empty strings are converted to NULL in the patch as this is the original state of the DICOM header in the vast majority of cases (header is absent).
  • Make the ArchiveLocation and md5sums fields non-nullable (checked on C-BIG, HBCD, and IBIS that no NULL record exists).
  • Remove some harmful empty string defaults.

The translation updates have been AI-generated.

Revert patch

UPDATE `tarchive`
SET
  `InstitutionName` = COALESCE(`InstitutionName`, ''),
  `ScannerManufacturer` = COALESCE(`ScannerManufacturer`, ''),
  `ScannerModel` = COALESCE(`ScannerModel`, ''),
  `ScannerSerialNumber` = COALESCE(`ScannerSerialNumber`, ''),
  `ScannerSoftwareVersion` = COALESCE(`ScannerSoftwareVersion`, '');

ALTER TABLE `tarchive`
  MODIFY COLUMN `StudyInstanceUID`
    varchar(255) NOT NULL DEFAULT '',
  MODIFY COLUMN `InstitutionName`
    varchar(255) NOT NULL DEFAULT '',
  MODIFY COLUMN `md5sumDicomOnly`
    varchar(255) DEFAULT NULL,
  MODIFY COLUMN `md5sumArchive`
    varchar(255) DEFAULT NULL,
  MODIFY COLUMN `CreatingUser`
    varchar(255) NOT NULL DEFAULT '',
  MODIFY COLUMN `SourceLocation`
    varchar(255) NOT NULL DEFAULT '',
  MODIFY COLUMN `ArchiveLocation`
    varchar(255) DEFAULT NULL,
  MODIFY COLUMN `ScannerManufacturer`
    varchar(255) NOT NULL DEFAULT '',
  MODIFY COLUMN `ScannerModel`
    varchar(255) NOT NULL DEFAULT '',
  MODIFY COLUMN `ScannerSerialNumber`
    varchar(255) NOT NULL DEFAULT '',
  MODIFY COLUMN `ScannerSoftwareVersion`
    varchar(255) NOT NULL DEFAULT '';

ALTER TABLE `tarchive`
  RENAME COLUMN `StudyInstanceUID` TO `DicomArchiveID`,
  RENAME COLUMN `InstitutionName` TO `CenterName`;

ALTER TABLE `tarchive`
  ADD COLUMN `neurodbCenterName` varchar(255) DEFAULT NULL
    AFTER `PatientSex`,
  ADD COLUMN `sumTypeVersion` tinyint(4) NOT NULL DEFAULT 0
    AFTER `CreatingUser`,
  ADD COLUMN `tarTypeVersion` tinyint(4) DEFAULT NULL
    AFTER `sumTypeVersion`,
  ADD COLUMN `uploadAttempt` tinyint(4) NOT NULL DEFAULT 0
    AFTER `SessionID`,
  ADD COLUMN `DateSent` datetime DEFAULT NULL
    AFTER `TarchiveID`,
  ADD COLUMN `PendingTransfer` tinyint(1) NOT NULL DEFAULT 0
    AFTER `DateSent`,
  ADD COLUMN `AcquisitionMetadata` longtext NOT NULL DEFAULT ''
    AFTER `CreateInfo`;

@github-actions github-actions Bot added Language: SQL PR or issue that update SQL code RaisinBread PR or issue introducing/requiring improvements to the Raidinbread dataset Language: PHP PR or issue that update PHP code Module: imaging_browser PR or issue related to imaging_browser module Module: mri_violations PR or issue related to mri_violations module Module: dicom_archive PR or issue related to dicom_archive module Multilingual Any tasks related to making LORIS multilingual labels Aug 28, 2026
@MaximeBICMTL
MaximeBICMTL force-pushed the clean-up-tarchive branch 2 times, most recently from 7e0c57c to 129a59a Compare August 28, 2026 19:16
nullable and defaults
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Language: PHP PR or issue that update PHP code Language: SQL PR or issue that update SQL code Module: dicom_archive PR or issue related to dicom_archive module Module: imaging_browser PR or issue related to imaging_browser module Module: mri_violations PR or issue related to mri_violations module Multilingual Any tasks related to making LORIS multilingual RaisinBread PR or issue introducing/requiring improvements to the Raidinbread dataset

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants