-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support DT TM types in Extended Query Tags (#1072)
* SQL level changes for supporting DT and TM in Extended Query Tags. * Updated code such that immutable user types are not updated. All the previous SqlIndexDataStore versions call the previous user type whereas the latest version uses the new user table type. * Addressed comments. * Removed TagValueUTC from IXC_ExtendedQueryTagDateTime index as we are not using this column yet for QIDO. Once offsets are supported in QIDO, we can add this back. * Undid changes from EndAddInstancec stored procedure as Will is working on removing this stored procedure. * Introduced a new schema version constant, SupportDTAndTMInExtendedQueryTagSchemaVersion, that indicates if DT and TM VR types are supported for extended query tag in the specified version. Following this, this constant has been used to check and use respective fields in the builder eliminating the need for multiple versions of ExtendedQueryTagDataRows and ExtendedQueryTagDataRowsBuilder. Tests have also been updated, and all the tests are passing. * Addressed comments. * Fixed casing for Utc. * Supporting DT and TM as Extended Query Tags. - DT and TM are now accepted as Extended Query Tags. - On STOW, newly created tags are indexed properly. - Single Value Match working for DT and TM. - Range Value Match working for DT and TM. - Deletion: when an instance is deleted, it's respective entries are deleted from respective extended query tags tables. - Deletion: when DT or TM extended query tag is deleted, respective entries are also deleted from extended query tags tables. - Added unit tests for DT and TM, and range query matching. * Merged with latest main. Fixed reindexing for DT and TM in cases where studies already existed and then extended query tags were created. * Addressed comments. If offset is provided in the query string for QIDO, user gets a specific message that offset is not supported in QIDO. * Addressed comments. Fixed UTC and local date time calculations. Using fo-dicom validation for DT and TM. Updated unit tests for DT. * Updated query parser to use DateTime instead of DateTimeOffset. * Addressed comments. Using fo-dicom parser to parse DT and TM. Consolidated local and utc date time parsers into one. * Utilizing GetSingleValueOrDefault for TM type. * Addressed comments. Fixed the DT logic. Now there can be two cases: 1. Offset is provided either in the date time value, or in the TimezoneOffsetFromUTC field in the dicom dataset. 2. Offset is not provided. In the first case, the base date time is considered as the literal date time and stored in TagValue. Offset field is applied to this literal date time to convert to UTC and is stored in TagValueUTC. In the second case where offset information is not present, null is stored in TagValueUTC. * Updated extended query tags documentation. * Added tests to test the scenario where offset is not present in the DT value but is present in TimezoneOffsetFromUTC value. This test caught an issue with the code. TimeSpan.TryParseExact method does not support negative offsets by default. This is tackled by checking the sign in the offset and then applying TimeSpanStyles.AssumeNegative. * Updating documentation adding information about offsets not being supported when querying on DT type.
- Loading branch information
1 parent
529c300
commit dada9b7
Showing
30 changed files
with
989 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/Microsoft.Health.Dicom.Core.UnitTests/Extensions/DateTimeValidTestData.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// ------------------------------------------------------------------------------------------------- | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. | ||
// ------------------------------------------------------------------------------------------------- | ||
|
||
using System.Collections; | ||
using System.Collections.Generic; | ||
|
||
namespace Microsoft.Health.Dicom.Core.UnitTests.Extensions | ||
{ | ||
public class DateTimeValidTestData : IEnumerable<object[]> | ||
{ | ||
public IEnumerator<object[]> GetEnumerator() | ||
{ | ||
yield return new object[] { "20200301010203.123+0500", 2020, 03, 01, 01, 02, 03, 123 }; | ||
yield return new object[] { "20200301010203.123-0500", 2020, 03, 01, 01, 02, 03, 123 }; | ||
yield return new object[] { "20200301010203-0500", 2020, 03, 01, 01, 02, 03, 0 }; | ||
yield return new object[] { "202003010102-0500", 2020, 03, 01, 01, 02, 0, 0 }; | ||
yield return new object[] { "2020030101-0500", 2020, 03, 01, 01, 0, 0, 0 }; | ||
yield return new object[] { "20200301-0500", 2020, 03, 01, 0, 0, 0, 0 }; | ||
yield return new object[] { "202003-0500", 2020, 03, 01, 00, 0, 0, 0 }; | ||
yield return new object[] { "2020-0500", 2020, 01, 01, 00, 0, 0, 0 }; | ||
yield return new object[] { "20200301010203.123", 2020, 03, 01, 01, 02, 03, 123 }; | ||
yield return new object[] { "20200301010203", 2020, 03, 01, 01, 02, 03, 0 }; | ||
yield return new object[] { "202003010102", 2020, 03, 01, 01, 02, 0, 0 }; | ||
yield return new object[] { "2020030101", 2020, 03, 01, 01, 0, 0, 0 }; | ||
yield return new object[] { "20200301", 2020, 03, 01, 0, 0, 0, 0 }; | ||
yield return new object[] { "202003", 2020, 03, 01, 0, 0, 0, 0 }; | ||
yield return new object[] { "2020", 2020, 01, 01, 0, 0, 0, 0 }; | ||
} | ||
|
||
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/Microsoft.Health.Dicom.Core.UnitTests/Extensions/DateTimeValidUtcTestData.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// ------------------------------------------------------------------------------------------------- | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. | ||
// ------------------------------------------------------------------------------------------------- | ||
|
||
using System.Collections; | ||
using System.Collections.Generic; | ||
|
||
namespace Microsoft.Health.Dicom.Core.UnitTests.Extensions | ||
{ | ||
public class DateTimeValidUtcTestData : IEnumerable<object[]> | ||
{ | ||
public IEnumerator<object[]> GetEnumerator() | ||
{ | ||
yield return new object[] { "20200301010203.123+0500", 2020, 02, 29, 20, 02, 03, 123 }; | ||
yield return new object[] { "20200301010203.123-0500", 2020, 03, 01, 06, 02, 03, 123 }; | ||
yield return new object[] { "20200301010203-0500", 2020, 03, 01, 06, 02, 03, 0 }; | ||
yield return new object[] { "202003010102-0500", 2020, 03, 01, 06, 02, 0, 0 }; | ||
yield return new object[] { "2020030101-0500", 2020, 03, 01, 06, 0, 0, 0 }; | ||
yield return new object[] { "20200301-0500", 2020, 03, 01, 05, 0, 0, 0 }; | ||
yield return new object[] { "202003-0500", 2020, 03, 01, 05, 0, 0, 0 }; | ||
yield return new object[] { "2020-0500", 2020, 01, 01, 05, 0, 0, 0 }; | ||
} | ||
|
||
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
....Health.Dicom.Core.UnitTests/Extensions/DateTimeWithTimezoneOffsetFromUtcValidTestData.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// ------------------------------------------------------------------------------------------------- | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. | ||
// ------------------------------------------------------------------------------------------------- | ||
|
||
using System.Collections; | ||
using System.Collections.Generic; | ||
|
||
namespace Microsoft.Health.Dicom.Core.UnitTests.Extensions | ||
{ | ||
public class DateTimeWithTimezoneOffsetFromUtcValidTestData : IEnumerable<object[]> | ||
{ | ||
public IEnumerator<object[]> GetEnumerator() | ||
{ | ||
yield return new object[] { "20200301010203.123", "+0500", 2020, 03, 01, 06, 02, 03, 123 }; | ||
yield return new object[] { "20200301010203.123", "-0500", 2020, 02, 29, 20, 02, 03, 123 }; | ||
yield return new object[] { "20200301010203", "-0500", 2020, 02, 29, 20, 02, 03, 0 }; | ||
yield return new object[] { "202003010102", "-0500", 2020, 02, 29, 20, 02, 0, 0 }; | ||
yield return new object[] { "2020030101", "-0500", 2020, 02, 29, 20, 0, 0, 0 }; | ||
yield return new object[] { "20200301", "-0500", 2020, 02, 29, 19, 0, 0, 0 }; | ||
yield return new object[] { "202003", "-0500", 2020, 02, 29, 19, 0, 0, 0 }; | ||
yield return new object[] { "2020", "-0500", 2019, 12, 31, 19, 0, 0, 0 }; | ||
} | ||
|
||
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.