Skip to content

import rule-set create

Usage

Rule-set sample

The rule-set sample (loaded into the editor when creating a new one from scratch) contains all fields and their descriptions which also serves as documentation.

# Rules describe which files to process and how.
# Files will be imported using the first matching rule.
# If none of the rules match, the file will be skipped.
rules:

  # Flywheel container level to import files to
  # Impacts which metadata field mappings are required. For example, when importing
  # to an acquisition, then 'subject.label', 'session.label', and 'acquisition.label'
  # must be mapped from folder names or file-type specific headers (e.g.: DICOM tags).
  # Example: project
  # Default: acquisition
- level: acquisition

  # Include filter list
  # When given, only import files that match at least one include filter.
  # Files not matching any of the filters will be skipped by this rule.
  # Fields: path, dir, name, ext, depth, ctime, mtime
  # Operators: =, =~, <, >, <=, >=, !=
  # The =~ operator uses a syntax similar to shell/glob wildcard patterns.
  # Example: ["path=~**/*.dcm", "mtime>2022-05-17"]
  # Default: null
  include: null

  # Exclude filter list
  # When given, skip files that match one or more exclude filters.
  # Exclude filters take precedence over include filters.
  # Example: ["name=.DS_Store"]
  # Default: null
  exclude: null

  # Type to process the file as
  # When set to 'dicom', files will be parsed, de-identified, grouped, zipped,
  # and uploaded as file.type=dicom with rich metadata mapped from DICOM headers.
  # Example: dicom
  # Default: null
  type: null

  # Metadata mapping pattern list
  # Map source meta (e.g.: path) to Flywheel meta fields (e.g.: 'subject.label').
  # When using type=dicom, DICOM tags can be referenced in addition to path.
  # Mappings follow a '<TEMPLATE>=<PATTERN>' format, where

  # Templates join one or more source meta fields (e.g.: path, PatientID) into a string
  # - single field: {field} (or simply: field)
  # - multiple fields: {field1}_concat_literal_{field2}
  # - regex substitution: {field/regex/substitution}
  # Patterns split a string into one or more Flywheel meta fields (e.g.: 'subject.label')
  # - single field: {field} (or simply: field)
  # - multiple fields: {sub}_{ses}
  # - optional parts: [{sub}_]{ses}
  # - regex constraints: {sub:[a-z]+}_{ses}
  # - shell/glob wildcards: **/{acq}/*.dcm
  # - regex modifier: .*/{acq}/.*\.dcm!r
  # Flywheel meta fields
  # - subject.label, .sex, .tags, .info.*
  # - session.label, .age, .weight, .timestamp, .tags, .info.*
  # - acuisition.label, .timestamp, .tags, .info.*
  # - file.name, .type, .modality, .classification.*, .tags, .info.*

  # Example: ["{path}={subject.label}/{session.label}/{acquisition.label}/{file.name}"]
  # Default: null
  mappings: null

  # Metadata defaults
  # Set default values for Flywheel meta fields if not otherwise mapped.
  # Useful for providing required or desired metadata (e.g.: 'subject.label')
  # which is not available in the path/DICOM headers and thus can't be mapped.
  # Example: ["subject.label=ex1205"]
  # Default: null
  defaults: null

  # Metadata overrides
  # Set manual override values for Flywheel meta fields, replacing any mappings.
  # Useful for enforcing specific values instead of that extracted from the path
  # or DICOM headers.
  # Example: ["acquisition.label=T1"]
  # Default: null
  overrides: null

# Scope of session/acquisition UID uniqueness (project|group|site|none)
# Default: null
uid_scope: null

# Conflict strategy for existing files (review|update|skip)
# Action to take when encountering files that would replace (create new versions of)
# files already existing in Flywheel, or would cause DICOM UID tree inconsistencies.
# - review: store the file and the conflict reason for review and resolution later
# - update: create a new file version by default
# - skip: skip the file if importing would lead to a replacement or a UID conflict
# Default: null
conflict_strategy: null

# Storage kind to use the rule set with (blob|dicom)
# Set this to dicom when it's intended for use with an AHI storage.
# The main difference is that 'dicom' storages cannot reference path
# in include/exclude filters or mappings.
# Default: blob
storage_kind: blob

# Storage scan parameters
# For 'blob' storages, allows passing one or more prefixes to effectively limit
# the scope of files scanned during the import. Useful when importing  a small
# subset of files from large buckets with millions of blobs.
# For 'dicom' storages, allows passing one or more DICOM queries (which will be
# OR-ed together) to effectively limit the scope DICOMs scanned during import.
# Examples:
#   prefixes: ["/study1", "/study2"]       # blob
#   queries: [{"AccessionNumber": "123"}]  # dicom
# Default: null
scan_params: null

# Stop and fail the import after reaching a failure threshold
# Example: 1000  # stop when encountering the 1000th file that couldn't be processed
# Default: null
fail_fast: null