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

fix: Update datetime definition/regex to match specification #2002

Merged
merged 3 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
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
15 changes: 12 additions & 3 deletions src/schema/objects/formats.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,18 @@ datetime:
display_name: Datetime
description: |
A datetime in the form `"YYYY-MM-DDThh:mm:ss[.000000][Z]"`,
where [.000000] is an optional subsecond resolution between 1 and 6 decimal points,
and [Z] is an optional, valid timezone code.
pattern: '[0-9]{4}-[0-9]{2}-[0-9]{2}T(?:2[0-3]|[01][0-9]):[0-5][0-9]:[0-5][0-9](\.[0-9]{1,6})?([A-Z]{2,4})?'
where `[.000000]` is an optional subsecond resolution between 1 and 6 decimal points,
and `[Z]` is an optional literal character `Z` that indicates
Coordinated Universal Time (UTC).
pattern: "\
[0-9]{4}\
-(?:0[1-9]|1[0-2])\
-(?:0[1-9]|[12][0-9]|3[01])\
T(?:2[0-3]|[01][0-9])\
:[0-5][0-9]\
:(?:[0-5][0-9]|60)\
(?:\\.[0-9]{1,6})?\
Z?"
file_relative:
display_name: Path relative to the parent file
description: |
Expand Down
6 changes: 3 additions & 3 deletions src/schema/objects/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2899,10 +2899,10 @@ RepetitionTime:
and the beginning of acquisition of the volume following it (TR).
When used in the context of functional acquisitions this parameter best
corresponds to
[DICOM Tag 0020, 0110](http://dicomlookup.com/dicomtags/(0020,0110)):
[DICOM Tag 0020, 0110](https://dicomlookup.com/dicomtags/(0020,0110)):
the "time delta between images in a
dynamic of functional set of images" but may also be found in
[DICOM Tag 0018, 0080](http://dicomlookup.com/dicomtags/(0018,0080)):
[DICOM Tag 0018, 0080](https://dicomlookup.com/dicomtags/(0018,0080)):
"the period of time in msec between the beginning
of a pulse sequence and the beginning of the succeeding
(essentially identical) pulse sequence".
Expand All @@ -2919,7 +2919,7 @@ RepetitionTimeExcitation:
display_name: Repetition Time Excitation
description: |
The interval, in seconds, between two successive excitations.
[DICOM Tag 0018, 0080](http://dicomlookup.com/dicomtags/(0018,0080))
[DICOM Tag 0018, 0080](https://dicomlookup.com/dicomtags/(0018,0080))
best refers to this parameter.
This field may be used together with the `"RepetitionTimePreparation"` for
certain use cases, such as
Expand Down
6 changes: 3 additions & 3 deletions tools/schemacode/src/bidsschematools/tests/test_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ def test_formats(schema_obj):
"2022-01-05T13:16:30",
"2022-01-05T13:16:30.5", # subsecond resolution is allowed
"2022-01-05T13:16:30.000005", # up to 6 decimal points
"2022-01-05T13:16:30UTC", # timezones are allowed
"2022-01-05T13:16:30.05UTC",
"2022-01-05T13:16:30Z", # UTC indicator is allowed
"2022-01-05T13:16:30.05Z",
],
"time": [
"13:16:30",
Expand Down Expand Up @@ -133,7 +133,7 @@ def test_formats(schema_obj):
],
"datetime": [
"2022-01-05T13:16:30.1000005", # too many decimal points
"2022-01-05T13:16:30U", # time zone too short
"2022-01-05T13:16:30U", # Only Z is permitted
"2022-01-05T13:16:30UTCUTC", # time zone too long
"2022-01-05T34:10:10", # invalid time
],
Expand Down
Loading