From dc159f9e9dc03e03b57219e05617dbdbd7030f6e Mon Sep 17 00:00:00 2001 From: Jack Schofield Date: Wed, 17 Aug 2022 14:23:19 +0100 Subject: [PATCH] make patient details nullable Signed-off-by: Jack Schofield --- .../Contracts/Models/PatientDetails.cs | 10 +++++----- .../Storage/Services/DicomService.cs | 6 +++--- .../TestData/PatientTestData.cs | 16 ++++++++-------- .../TestData/PayloadTestData.cs | 6 +++--- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/WorkflowManager/Contracts/Models/PatientDetails.cs b/src/WorkflowManager/Contracts/Models/PatientDetails.cs index 4985cdf9f..0db18f08b 100644 --- a/src/WorkflowManager/Contracts/Models/PatientDetails.cs +++ b/src/WorkflowManager/Contracts/Models/PatientDetails.cs @@ -22,21 +22,21 @@ namespace Monai.Deploy.WorkflowManager.Contracts.Models public class PatientDetails { [JsonProperty(PropertyName = "patient_id")] - public string PatientId { get; set; } = string.Empty; + public string? PatientId { get; set; } [JsonProperty(PropertyName = "patient_name")] - public string PatientName { get; set; } = string.Empty; + public string? PatientName { get; set; } [JsonProperty(PropertyName = "patient_sex")] - public string PatientSex { get; set; } = string.Empty; + public string? PatientSex { get; set; } [JsonProperty(PropertyName = "patient_dob")] public DateTime? PatientDob { get; set; } [JsonProperty(PropertyName = "patient_age")] - public string PatientAge { get; set; } = string.Empty; + public string? PatientAge { get; set; } [JsonProperty(PropertyName = "patient_hospital_id")] - public string PatientHospitalId { get; set; } = string.Empty; + public string? PatientHospitalId { get; set; } } } diff --git a/src/WorkflowManager/Storage/Services/DicomService.cs b/src/WorkflowManager/Storage/Services/DicomService.cs index 3849fb2c2..975984cf0 100644 --- a/src/WorkflowManager/Storage/Services/DicomService.cs +++ b/src/WorkflowManager/Storage/Services/DicomService.cs @@ -63,7 +63,7 @@ public async Task GetPayloadPatientDetailsAsync(string payloadId return patientDetails; } - public async Task GetFirstValueAsync(IList items, string payloadId, string bucketId, string keyId) + public async Task GetFirstValueAsync(IList items, string payloadId, string bucketId, string keyId) { Guard.Against.NullOrWhiteSpace(bucketId); Guard.Against.NullOrWhiteSpace(payloadId); @@ -73,7 +73,7 @@ public async Task GetFirstValueAsync(IList items, strin { if (items is null || items.Count == 0) { - return string.Empty; + return null; } foreach (var item in items) @@ -109,7 +109,7 @@ public async Task GetFirstValueAsync(IList items, strin _logger.FailedToGetDicomTag(payloadId, keyId, bucketId, e); } - return string.Empty; + return null; } public async Task> GetDicomPathsForTaskAsync(string outputDirectory, string bucketName) diff --git a/tests/IntegrationTests/WorkflowExecutor.IntegrationTests/TestData/PatientTestData.cs b/tests/IntegrationTests/WorkflowExecutor.IntegrationTests/TestData/PatientTestData.cs index 14cac65b4..2039525cd 100644 --- a/tests/IntegrationTests/WorkflowExecutor.IntegrationTests/TestData/PatientTestData.cs +++ b/tests/IntegrationTests/WorkflowExecutor.IntegrationTests/TestData/PatientTestData.cs @@ -49,11 +49,11 @@ public static class PatientsTestData Patient = new PatientDetails() { PatientId = "2", - PatientName = "", + PatientName = null, PatientSex = "female", PatientDob = null, - PatientAge = "", - PatientHospitalId = "" + PatientAge = null, + PatientHospitalId = null } }, new PatientTestData() @@ -61,12 +61,12 @@ public static class PatientsTestData Name = "Null_Patient", Patient = new PatientDetails() { - PatientId = "", - PatientName = "", - PatientSex = "", + PatientId = null, + PatientName = null, + PatientSex = null, PatientDob = null, - PatientAge = "", - PatientHospitalId = "" + PatientAge = null, + PatientHospitalId = null } }, }; diff --git a/tests/IntegrationTests/WorkflowExecutor.IntegrationTests/TestData/PayloadTestData.cs b/tests/IntegrationTests/WorkflowExecutor.IntegrationTests/TestData/PayloadTestData.cs index f5a4da373..cb545661c 100644 --- a/tests/IntegrationTests/WorkflowExecutor.IntegrationTests/TestData/PayloadTestData.cs +++ b/tests/IntegrationTests/WorkflowExecutor.IntegrationTests/TestData/PayloadTestData.cs @@ -92,9 +92,9 @@ public static class PayloadsTestData PatientDetails = new PatientDetails() { PatientDob = null, - PatientId = String.Empty, - PatientName = String.Empty, - PatientSex = String.Empty + PatientId = null, + PatientName = null, + PatientSex = null } } },