Skip to content

Commit 678ce30

Browse files
add new dicom tags
Signed-off-by: Jack Schofield <[email protected]>
1 parent e69806b commit 678ce30

File tree

10 files changed

+67
-11
lines changed

10 files changed

+67
-11
lines changed

src/Contracts/Models/PatientDetails.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,11 @@ public class PatientDetails
1616

1717
[JsonProperty(PropertyName = "patient_dob")]
1818
public DateTime? PatientDob { get; set; }
19+
20+
[JsonProperty(PropertyName = "patient_age")]
21+
public string PatientAge { get; set; }
22+
23+
[JsonProperty(PropertyName = "patient_hospital_id")]
24+
public string PatientHospitalId { get; set; }
1925
}
2026
}

src/Monai.Deploy.WorkflowManager.Storage/Constants/DicomTagConstants.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,9 @@ public static class DicomTagConstants
1212
public const string PatientSexTag = "00100040";
1313

1414
public const string PatientDateOfBirthTag = "00100030";
15+
16+
public const string PatientAgeTag = "00101010";
17+
18+
public const string PatientHospitalIdTag = "00100021";
1519
}
1620
}

src/Monai.Deploy.WorkflowManager.Storage/Services/DicomService.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ public async Task<PatientDetails> GetPayloadPatientDetailsAsync(string payloadId
3434
{
3535
PatientName = await GetFirstValueAsync(items, payloadId, bucketName, DicomTagConstants.PatientNameTag),
3636
PatientId = await GetFirstValueAsync(items, payloadId, bucketName, DicomTagConstants.PatientIdTag),
37-
PatientSex = await GetFirstValueAsync(items, payloadId, bucketName, DicomTagConstants.PatientSexTag)
37+
PatientSex = await GetFirstValueAsync(items, payloadId, bucketName, DicomTagConstants.PatientSexTag),
38+
PatientAge = await GetFirstValueAsync(items, payloadId, bucketName, DicomTagConstants.PatientAgeTag),
39+
PatientHospitalId = await GetFirstValueAsync(items, payloadId, bucketName, DicomTagConstants.PatientHospitalIdTag)
3840
};
3941

4042
var dob = await GetFirstValueAsync(items, payloadId, bucketName, DicomTagConstants.PatientDateOfBirthTag);

src/Monai.Deploy.WorkflowManager.Storage/Services/IDicomService.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ public interface IDicomService
1414
/// <param name="bucketName">Name of the bucket.</param>
1515
Task<IEnumerable<string>> GetDicomPathsForTaskAsync(string outputDirectory, string bucketName);
1616

17+
/// <summary>
18+
/// Gets patient details from the dicom metadata.
19+
/// </summary>
20+
/// <param name="payloadId">Payload id.</param>
21+
/// <param name="bucketName">Name of the bucket.</param>
1722
Task<PatientDetails> GetPayloadPatientDetailsAsync(string payloadId, string bucketName);
1823

1924
/// <summary>

src/TaskManager/Plug-ins/AideClinicalReview/AideClinicalReviewPlugin.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ public class AideClinicalReviewPlugin : TaskPluginBase, IAsyncDisposable
2222
private string _patientName;
2323
private string _patientSex;
2424
private string _patientDob;
25+
private string _patientAge;
26+
private string _patientHospitalId;
2527
private string _queueName;
2628
private string _workflowName;
2729

@@ -65,6 +67,16 @@ private void Initialize()
6567
_patientDob = Event.TaskPluginArguments[Keys.PatientDob];
6668
}
6769

70+
if (Event.TaskPluginArguments.ContainsKey(Keys.PatientAge))
71+
{
72+
_patientAge = Event.TaskPluginArguments[Keys.PatientAge];
73+
}
74+
75+
if (Event.TaskPluginArguments.ContainsKey(Keys.PatientHospitalId))
76+
{
77+
_patientHospitalId = Event.TaskPluginArguments[Keys.PatientHospitalId];
78+
}
79+
6880
if (Event.TaskPluginArguments.ContainsKey(Keys.QueueName))
6981
{
7082
_queueName = Event.TaskPluginArguments[Keys.QueueName];
@@ -123,7 +135,9 @@ private JsonMessage<ClinicalReviewRequestEvent> GenerateClinicalReviewRequestEve
123135
PatientId = _patientId,
124136
PatientSex = _patientSex,
125137
PatientName = _patientName,
126-
PatientDob = _patientDob
138+
PatientDob = _patientDob,
139+
PatientAge = _patientAge,
140+
PatientHospitalId = _patientHospitalId
127141
}
128142
}, TaskManagerApplicationId, Event.CorrelationId);
129143
}

src/TaskManager/Plug-ins/AideClinicalReview/Keys.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@ public class Keys
2222
/// </summary>
2323
public static readonly string PatientDob = "patient_dob";
2424

25+
/// <summary>
26+
/// Key for the patient age.
27+
/// </summary>
28+
public static readonly string PatientAge = "patient_age";
29+
30+
/// <summary>
31+
/// Key for the patient hospital id.
32+
/// </summary>
33+
public static readonly string PatientHospitalId = "patient_hospital_id";
34+
2535
/// <summary>
2636
/// Key for the workflow name.
2737
/// </summary>
Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
1-
using System.ComponentModel.DataAnnotations;
2-
using Newtonsoft.Json;
1+
using Newtonsoft.Json;
32

43
namespace Monai.Deploy.WorkflowManager.TaskManager.AideClinicalReview.Models
54
{
65
public class PatientMetadata
76
{
87
[JsonProperty(PropertyName = "patient_name")]
9-
[Required]
108
public string PatientName { get; set; }
119

1210
[JsonProperty(PropertyName = "patient_id")]
13-
[Required]
1411
public string PatientId { get; set; }
1512

1613
[JsonProperty(PropertyName = "patient_dob")]
17-
[Required]
1814
public string PatientDob { get; set; }
1915

2016
[JsonProperty(PropertyName = "patient_sex")]
21-
[Required]
2217
public string PatientSex { get; set; }
18+
19+
[JsonProperty(PropertyName = "patient_age")]
20+
public string PatientAge { get; set; }
21+
22+
[JsonProperty(PropertyName = "patient_hospital_id")]
23+
public string PatientHospitalId { get; set; }
2324
}
2425
}

src/WorkflowExecuter/Common/ConditionalParameterParser.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,12 @@ public string ResolveParameters(string conditions, WorkflowInstance workflowInst
281281
case "dob":
282282
resultStr = patientValue.PatientDob?.ToString("dd/MM/yyyy");
283283
break;
284+
case "age":
285+
resultStr = patientValue.PatientAge;
286+
break;
287+
case "hospital_id":
288+
resultStr = patientValue.PatientHospitalId;
289+
break;
284290
default:
285291
break;
286292
}

tests/UnitTests/Storage.Tests/Services/DicomServiceTests.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,9 @@ public async Task GetPayloadPatientDetails_ValidPayloadIdAndBucket_ReturnsValues
9898
PatientName = "Jack",
9999
PatientId = "patientid",
100100
PatientSex = "Male",
101-
PatientDob = new DateTime(1996, 01, 20)
101+
PatientDob = new DateTime(1996, 01, 20),
102+
PatientAge = "25",
103+
PatientHospitalId = "hospitalid"
102104
};
103105

104106
var returnedFiles = new List<VirtualFileInfo>
@@ -112,7 +114,9 @@ public async Task GetPayloadPatientDetails_ValidPayloadIdAndBucket_ReturnsValues
112114
{ DicomTagConstants.PatientNameTag, new DicomValue{ Value = new object[] { "Jack" }, Vr = "RR" } },
113115
{ DicomTagConstants.PatientSexTag, new DicomValue{ Value = new object[] { "Male" }, Vr = "RR" } },
114116
{ DicomTagConstants.PatientIdTag, new DicomValue{ Value = new object[] { "patientid" }, Vr = "RR" } },
115-
{ DicomTagConstants.PatientDateOfBirthTag, new DicomValue{ Value = new object[] { new DateTime(1996, 01, 20).ToString() }, Vr = "RR" } }
117+
{ DicomTagConstants.PatientDateOfBirthTag, new DicomValue{ Value = new object[] { new DateTime(1996, 01, 20).ToString() }, Vr = "RR" } },
118+
{ DicomTagConstants.PatientAgeTag, new DicomValue{ Value = new object[] { "25" }, Vr = "RR" } },
119+
{ DicomTagConstants.PatientHospitalIdTag, new DicomValue{ Value = new object[] { "hospitalid" }, Vr = "RR" } }
116120
};
117121

118122
var jsonStr = JsonConvert.SerializeObject(fileContents);

tests/UnitTests/WorkflowExecuter.Tests/Services/ConditionalParameterParserTests.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ public async Task ConditionalParameterParser_WhenGivenCorrectString_ShouldEvalua
6969
[InlineData("{{ context.input.patient_details.name }}", "'patientname'")]
7070
[InlineData("{{ context.input.patient_details.sex }}", "'patientsex'")]
7171
[InlineData("{{ context.input.patient_details.dob }}", "'19/10/2000'")]
72+
[InlineData("{{ context.input.patient_details.age }}", "'32'")]
73+
[InlineData("{{ context.input.patient_details.hospital_id }}", "'patienthospitalid'")]
7274
[InlineData("{{ context.workflow.name }}", "'workflowname'")]
7375
public async Task ResolveParametersWhenGivenPatientDetailsString_ShouldReturnValue(string input, string expectedResult)
7476
{
@@ -83,7 +85,9 @@ public async Task ResolveParametersWhenGivenPatientDetailsString_ShouldReturnVal
8385
PatientDob = new DateTime(2000, 10, 19),
8486
PatientId = "patientid",
8587
PatientName = "patientname",
86-
PatientSex = "patientsex"
88+
PatientSex = "patientsex",
89+
PatientAge = "32",
90+
PatientHospitalId = "patienthospitalid"
8791
}
8892
};
8993

0 commit comments

Comments
 (0)