Skip to content

[ENH][BEP028] Specification update for BEP028 BIDS-Prov - #2099

Draft
bclenet wants to merge 315 commits into
bids-standard:masterfrom
bclenet:BEP028_spec
Draft

[ENH][BEP028] Specification update for BEP028 BIDS-Prov#2099
bclenet wants to merge 315 commits into
bids-standard:masterfrom
bclenet:BEP028_spec

Conversation

@bclenet

@bclenet bclenet commented Apr 10, 2025

Copy link
Copy Markdown
Contributor

BEP 028: Under review

This BEP is currently under review: #2405

Please post significant discussion to that thread. Minor issues, such as typos or clarifications, may be posted as suggestions to this PR. These suggestions may be accepted or rejected without discussion, so do not make substantial proposals in this way.

Original post

This is a work in progress PR proposing a specification update for BEP028 BIDS-Prov.

Todo lists

Blocking points

Associated BIDS examples

Shortcuts

@bclenet

bclenet commented May 23, 2025

Copy link
Copy Markdown
Contributor Author

Hi @yarikoptic,

As part of this PR (integration of BEP028 in the BIDS specification), I'm adding the BIDS-Prov context into the repo. For now it's under : src/modality-agnostic-files/provenance-context.json but do you see a better place where to add it ? Thanks !

@effigies effigies added this to the 1.11.0 milestone Aug 27, 2025
Comment thread src/schema/rules/files/common/tables.yaml Outdated

@yarikoptic yarikoptic left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some initial notes

Comment thread src/modality-agnostic-files/provenance.md Outdated
Comment thread src/modality-agnostic-files/provenance.md Outdated
Comment thread src/modality-agnostic-files/provenance.md Outdated
Comment thread src/modality-agnostic-files/provenance.md Outdated
Comment thread src/modality-agnostic-files/provenance.md Outdated
Comment thread src/modality-agnostic-files/provenance.md Outdated
Comment thread src/modality-agnostic-files/provenance.md Outdated
Comment thread src/modality-agnostic-files/provenance.md Outdated
Comment thread src/modality-agnostic-files/provenance.md Outdated

@satra satra left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks very nice @bclenet - left some comments which should be very lightweight to address.

Comment thread src/modality-agnostic-files/dataset-description.md Outdated
Comment thread src/modality-agnostic-files/provenance.md Outdated
Comment thread src/modality-agnostic-files/provenance.md Outdated
Comment thread src/modality-agnostic-files/provenance.md Outdated
{
"Id": "bids::sub-01/func/sub-01_task-tonecounting_bold.nii",
"Label": "sub-01_task-tonecounting_bold.nii",
"AtLocation": "sub-01/func/sub-01_task-tonecounting_bold.nii",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason not to use the same uri as Id here?

@bclenet bclenet Sep 3, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the Label, I guess we want to use the name of the file (without directory path) so that is more human readable.
About AtLocation, we describe this metadata as:

For input files, this is the relative path to the file on disk.

Should we be more specific for this definition ?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i meant to use the bids uri here as well.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed w/ Boris today. We could use uri and change the spec to say "this is the path to the file on disk." (instead of "relative path").

But... Now that the id is in fact the path to the file in bids -- maybe we should consider removing AtLocation from BIDS-Prov as this only creates duplication of information. What do you think?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the unfortunate bit here is that the bids uri is not persistent. we do need to add something to the id for uniqueness. otherwise two datasets loaded into a graph could have the same id for a same named file (e.g. sub-01/fmri/sub-01_task-rest_bold.nii.gz could be in many datasets). i don't think their id's should be the same. so i would suggest keeping the bids uri for atlocation and then consider how to get uniqueness to the ids here and elsewhere.

for a different project we have been constructing the id using a function of the checksum of the metadata associated with the node. this allows us to generate a graph without creating new nodes each time we run the process. and if the metadata changes (whether in keys and/or their values) a new node id is generated.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@satra - could we get uniqueness using the dataset name in the BIDS URI? e.g. bids:ds109:sub-01/fmri/sub-01_task-rest_bold.nii.gz is unique). I think this may be a BIDS issue more than BIDS-Prov.

Note: we might need another online meeting to discuss those remaining bits? Let me know how you'd like to proceed.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unfortunately, the dataset name is technically a key from the dataset_description (see: https://bids-specification.readthedocs.io/en/stable/common-principles.html#examples_1), so not guaranteed to be unique across datasets. bids intentionally decoupled uniqueness or persistence from the key name and in that section on bids uri notes that while certain aspects of a scheme uri are not being used, it could be used in the future (see: https://bids-specification.readthedocs.io/en/stable/common-principles.html#future-statement).

my suggestion would be to perhaps do what is being done for uniqueness of other ids.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@satra I am sorry I don't we understand well what is the proposed update. Would it be feasible to share a small example, maybe describing how you would change lines 293-296 above? Thank you!

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a potential example:

"Id": "bids::prov#entity-acea8093",
"Label": "sub-01_task-tonecounting_bold.nii",
"AtLocation": "bids::sub-01/func/sub-01_task-tonecounting_bold.nii",

the hash acea8093 would be computed based on the other keys of this object.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Satra, Camille,

There is indeed an issue with the lines 293-296 above. It is the provenance record for an entity inside a provenance file (prov/[<subdir>/]prov-<label>_env.json) and therefore it can not describe a BIDS file that is inside the dataset (provenance metadata for such files are in sidecar JSONs).

So in this specific case, we can use the Id you propose (or an Id of the form urn:<uid>) as we do not require the Id to be a BIDS URI.

But this is a bit more complicated for other ways of describing entities in BIDS Prov. So I suggest we discuss this issue during a future meeting.

Concerning AtLocation, using a BIDS URI is fine for me.

Comment thread src/modality-agnostic-files/provenance.md Outdated
Comment thread src/modality-agnostic-files/provenance.md Outdated
Comment thread src/modality-agnostic-files/provenance.md Outdated
Comment thread src/modality-agnostic-files/provenance.md Outdated
Comment thread src/modality-agnostic-files/provenance.md Outdated

@yarikoptic yarikoptic left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Next batch of comments and recommendations

Comment thread src/common-principles.md Outdated
Comment thread src/modality-agnostic-files/dataset-description.md
Comment thread src/modality-agnostic-files/provenance.md Outdated
Comment thread src/modality-agnostic-files/provenance.md Outdated
Comment thread src/modality-agnostic-files/provenance.md Outdated
Comment thread src/modality-agnostic-files/provenance.md Outdated
Comment thread src/modality-agnostic-files/provenance.md Outdated
Comment thread src/modality-agnostic-files/provenance.md Outdated
Comment thread src/modality-agnostic-files/provenance.md Outdated
Comment thread src/modality-agnostic-files/provenance.md Outdated
Comment thread src/schema/objects/metadata.yaml
Comment thread src/schema/objects/metadata.yaml Outdated
description: |
Command (or commands) performed by the activity, including all parameters.

Set to `null` to describe that the activity was performed manually.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love present alignments to rdfs: ... is there any property within LD PROV ecosystem which could relate here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could not find a relevant term for that, but any suggestion is welcome.

description: |
Name for the activity.

Corresponds to [RDF Schema `rdfs:label`](https://www.w3.org/TR/rdf-schema/#ch_label).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this and other definitions (Id etc) are used multiple times across different metadata "array" properties. Looking through here is an example of how to define each once on top level and then reuse in specific constructs -- @effigies tell me if I am misguiding here:

DeidentificationMethodCodeSequence:
  name: DeidentificationMethodCodeSequence
  display_name: Deidentification Method Code Sequence
  description: |
    A sequence of code objects describing the mechanism or method use to remove the Patient's identity.
    Corresponds to [DICOM Tag 0012, 0064](https://dicomlookup.com/dicomtags/(0012,0064))
    `De-identification Method Code Sequence`.
  type: array
  items:
    type: object
    recommended:
      - CodeValue
      - CodeMeaning
      - CodingSchemeDesignator
      - CodingSchemeVersion
    properties:
      CodeValue:
        $ref: objects.metadata.CodeValue
      CodeMeaning:
        $ref: objects.metadata.CodeMeaning
      CodingSchemeDesignator:
        $ref: objects.metadata.CodingSchemeDesignator
      CodingSchemeVersion:
...

it should be quite doable by claude-code to achieve quickly, let me know if I should push such RF

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could do that, but for it to work we need unified description fields, e.g.:

Id:
    name: Id
    description: |
        [Identifier](SPEC_ROOT/modality-agnostic-files/provenance.md#provenance-identifiers) for the object.

        Corresponds to [JSON-LD `@id`](https://www.w3.org/TR/json-ld11/#syntax-tokens-and-keywords).
    type: string
    format: uri
Label:
    name: Label
    description: |
        Name for the object.

        Corresponds to [RDF Schema `rdfs:label`](https://www.w3.org/TR/rdf-schema/#ch_label).

which feels more confusing to me.

@effigies

Copy link
Copy Markdown
Collaborator

This BEP is currently under review: #2405

Please post significant discussion to that thread. Minor issues, such as typos or clarifications, may be posted as suggestions to this PR. These suggestions may be accepted or rejected without discussion, so do not make substantial proposals in this way.

Comment thread src/schema/objects/suffixes.yaml Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants