Skip to content

Typed physiological archives (PR 3)#1393

Open
MaximeBICMTL wants to merge 6 commits intoaces:bids_staging_branchfrom
MaximeBICMTL:typed-physio-archives
Open

Typed physiological archives (PR 3)#1393
MaximeBICMTL wants to merge 6 commits intoaces:bids_staging_branchfrom
MaximeBICMTL:typed-physio-archives

Conversation

@MaximeBICMTL
Copy link
Contributor

@MaximeBICMTL MaximeBICMTL commented Mar 16, 2026

Builds on #1389 (diff)

Description

Move the "create physiological file archive" and "create physiological event archive" from the untyped Eeg class to a new lib.import_bids_dataset.archive typed module.

Bug fix

The old code contained this function, which returns a tuple with the relative and full path of the archive:

def get_archive_paths(self, archive_rel_name):
        package_path = get_eeg_pre_package_download_dir_path_config(self.env)
        if package_path:
            raw_package_dir = os.path.join(package_path, 'raw')
            os.makedirs(raw_package_dir, exist_ok=True)
            archive_rel_name = os.path.basename(archive_rel_name)
            archive_full_path = os.path.join(raw_package_dir, archive_rel_name)
        else:
            archive_full_path = os.path.join(self.data_dir, archive_rel_name)

        return (archive_rel_name, archive_full_path)

As can be seen, the relative path is relative to the ${package_path}/raw directory if the package_raw configuration is defined, and relative to the LORIS data directory otherwise. This is a bug, it means that the path of an archive cannot be interpreted without reading the LORIS configuration (although I am rather confident that only one of these two paths works in practice), and that changing setting/unsetting that configuration breaks all archive paths in the database.

This PR makes all paths relative to the LORIS data directory, which fixes this issue and is a common practice in the LORIS database but may be a breaking change for some projects.

Details

  • Shorten DbPhysioFileArchive.file_path and DbPhysioEventArchive.file_path to DbPhysioFileArchive.path and DbPhysioEventArchive.path.
  • Add a new typed loris_utils.archive module.
  • Add a new lib.import_bids_dataset.physio_archive module.
  • Adopt the aforementioned module in the BIDS EEG import pipeline.
  • Fix the aforementioned bug.
  • Improve the BIDS EEG import integration test with archive checking.
  • Remove or deprecate the old code.
  • Raise an exception if the archive file already exists instead of ignoring it.
  • Remove a check to know if the file already has an archive. The file sent argument has just been created by the import pipeline, it cannot already have an archive.

@github-actions github-actions bot added Language: Python Issue or PR related to the Python codebase Package: Utilities PR or issue related to the LORIS-agnostic utilities Package: BIDS reader PR or issue related to the BIDS reader labels Mar 16, 2026
@MaximeBICMTL MaximeBICMTL changed the title Typed physiological archives (PR $) Typed physiological archives (PR 4) Mar 16, 2026
@MaximeBICMTL MaximeBICMTL changed the base branch from main to bids_staging_branch March 16, 2026 10:42
@MaximeBICMTL MaximeBICMTL force-pushed the typed-physio-archives branch from c87115b to a16f98b Compare March 16, 2026 10:48
@MaximeBICMTL MaximeBICMTL added Complexity: Medium Issue or PR that requires a moderate effort or expertise to implement, review, or test Pipeline: BIDS importer PR or issue related to the BIDS importer Category: Refactor Issue or PR that aims to improve the existing code Category: Bug Issue or PR that aims to report or fix a bug Caveat for Existing Projects Issue or PR that introduces or may introduce breaking changes for existing projects labels Mar 16, 2026
@MaximeBICMTL MaximeBICMTL force-pushed the typed-physio-archives branch 4 times, most recently from 321349c to 1a3a50a Compare March 16, 2026 13:03
@MaximeBICMTL MaximeBICMTL changed the title Typed physiological archives (PR 4) Typed physiological archives (PR 3-bis) Mar 16, 2026
@MaximeBICMTL MaximeBICMTL force-pushed the typed-physio-archives branch from 1a3a50a to 64687e3 Compare March 19, 2026 07:48
@MaximeBICMTL MaximeBICMTL force-pushed the typed-physio-archives branch from 64687e3 to 9bc9202 Compare March 21, 2026 09:19
@MaximeBICMTL MaximeBICMTL force-pushed the typed-physio-archives branch from 9bc9202 to 87c29f7 Compare March 22, 2026 10:34
@MaximeBICMTL MaximeBICMTL changed the title Typed physiological archives (PR 3-bis) Typed physiological archives (PR 3) Mar 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Category: Bug Issue or PR that aims to report or fix a bug Category: Refactor Issue or PR that aims to improve the existing code Caveat for Existing Projects Issue or PR that introduces or may introduce breaking changes for existing projects Complexity: Medium Issue or PR that requires a moderate effort or expertise to implement, review, or test Language: Python Issue or PR related to the Python codebase Package: BIDS reader PR or issue related to the BIDS reader Package: Utilities PR or issue related to the LORIS-agnostic utilities Pipeline: BIDS importer PR or issue related to the BIDS importer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant