Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inheritance principle: Include enumeration indices in source #2

Open
wants to merge 2 commits into
base: rewrite_inheritance_principle
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions src/02-common-principles.md
Original file line number Diff line number Diff line change
Expand Up @@ -542,36 +542,38 @@ for more information.

## The Inheritance Principle

Lestropie marked this conversation as resolved.
Show resolved Hide resolved
<!--lint disable ordered-list-marker-value-->

1. Any metadata file (such as `.json`, `.bvec` or `.tsv`) MAY be defined at any directory level.

1. For a given data file, any metadata file is applicable to that data file if:
2. For a given data file, any metadata file is applicable to that data file if:
1. It is stored at the same directory level or higher;
1. The metadata and the data filenames possess the same suffix;
1. The metadata filename does not include any entity absent from the data filename.
2. The metadata and the data filenames possess the same suffix;
3. The metadata filename does not include any entity absent from the data filename.

1. A metadata file MUST NOT have a filename that would be otherwise applicable
3. A metadata file MUST NOT have a filename that would be otherwise applicable
to some data file based on rules 2.2 and 2.3 but is made inapplicable based on its
location in the directory structure as per rule 2.1.

1. There MUST NOT be multiple metadata files applicable to a data file at one level
4. There MUST NOT be multiple metadata files applicable to a data file at one level
of the directory hierarchy.

1. If multiple metadata files are applicable to a given data file:
5. If multiple metadata files are applicable to a given data file:

1. For [tabular files](#tabular-files) and other simple metadata files
(for instance, [`bvec` / `bval` files for diffusion MRI](#04-modality-specific-files/01-magnetic-resonance-imaging#required-gradient-orientation-information),
only the file lowest in the filesystem hierarchy SHALL be treated as being
associated with that data file.

1. For [JSON files](#key-value-files-dictionaries):
2. For [JSON files](#key-value-files-dictionaries):

1. Files are loaded from the top of the directory hierarchy downwards,
such that values from the top level are inherited by all data files
at lower levels to which it is applicable unless overridden
by a value for the same key present in another metadata file at a lower level
(though it is RECOMMENDED to minimise the extent of such overrides).

1. There is no notion of "unsetting" a key/value pair.
2. There is no notion of "unsetting" a key/value pair.
Lestropie marked this conversation as resolved.
Show resolved Hide resolved

Corollaries:

Expand All @@ -580,11 +582,13 @@ Corollaries:
similarly, a metadata file that is applicable to multiple participants / sessions
MUST NOT be placed within a directory corresponding to only one such participant / session.

1. It is permissible for a single metadata file to be applicable to multiple data
2. It is permissible for a single metadata file to be applicable to multiple data
files at that level of the hierarchy or below. Where such metadata content is consistent
across multiple data files, it is RECOMMENDED to store metadata in this
way, rather than duplicating that metadata content across multiple metadata files.

<!--lint enable ordered-list-marker-value-->

Example 1: Demonstration of inheritance principle

{{ MACROS___make_filetree_example(
Expand Down