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 for GetSeriesInstanceUID in payload table #983

Merged
merged 2 commits into from
May 23, 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
2 changes: 1 addition & 1 deletion src/WorkflowManager/Common/Services/PayloadService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ public async Task<bool> DeletePayloadFromStorageAsync(string payloadId)

public Task<bool> UpdateAsyncWorkflowIds(Payload payload)
{
ArgumentNullException.ThrowIfNull(payload, nameof(payload));
ArgumentNullException.ThrowIfNull(payload);

return _payloadRepository.UpdateAsyncWorkflowIds(payload);
}
Expand Down
4 changes: 2 additions & 2 deletions src/WorkflowManager/Contracts/Models/Payload.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ public class Payload : IDocument
[JsonProperty(PropertyName = "workflows")]
public IEnumerable<string> Workflows { get; set; } = [];

[JsonProperty(PropertyName = "workflow_names")]
public List<string> TriggeredWorkflowNames { get; set; } = [];
[JsonProperty(PropertyName = "triggered_workflow_names")]
public IEnumerable<string> TriggeredWorkflowNames { get; set; } = [];

[JsonProperty(PropertyName = "workflow_instance_ids")]
public IEnumerable<string> WorkflowInstanceIds { get; set; } = [];
Expand Down
1 change: 1 addition & 0 deletions src/WorkflowManager/Contracts/Models/PayloadDto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public PayloadDto(Payload payload)
PatientDetails = payload.PatientDetails;
PayloadDeleted = payload.PayloadDeleted;
SeriesInstanceUid = payload.SeriesInstanceUid;
TriggeredWorkflowNames = payload.TriggeredWorkflowNames;
}

[JsonProperty(PropertyName = "payload_status")]
Expand Down
2 changes: 1 addition & 1 deletion src/WorkflowManager/Storage/Services/DicomService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@

public async Task<PatientDetails> GetPayloadPatientDetailsAsync(string payloadId, string bucketName)
{
ArgumentNullException.ThrowIfNullOrWhiteSpace(bucketName, nameof(bucketName));

Check warning on line 68 in src/WorkflowManager/Storage/Services/DicomService.cs

View workflow job for this annotation

GitHub Actions / sonarscanner

Remove this argument from the method call; it hides the caller information. (https://rules.sonarsource.com/csharp/RSPEC-3236)
ArgumentNullException.ThrowIfNullOrWhiteSpace(payloadId, nameof(payloadId));

Check warning on line 69 in src/WorkflowManager/Storage/Services/DicomService.cs

View workflow job for this annotation

GitHub Actions / sonarscanner

Remove this argument from the method call; it hides the caller information. (https://rules.sonarsource.com/csharp/RSPEC-3236)

var dict = await GetMetaData(payloadId, bucketName);

Expand All @@ -91,7 +91,7 @@

private string? GetFirstValueAsync(Dictionary<string, DicomValue>? dict, string keyId)
{
ArgumentNullException.ThrowIfNullOrWhiteSpace(keyId, nameof(keyId));

Check warning on line 94 in src/WorkflowManager/Storage/Services/DicomService.cs

View workflow job for this annotation

GitHub Actions / sonarscanner

Remove this argument from the method call; it hides the caller information. (https://rules.sonarsource.com/csharp/RSPEC-3236)
if (dict is null)
{
return null;
Expand All @@ -117,7 +117,7 @@

public async Task<Dictionary<string, DicomValue>?> GetMetaData(string payloadId, string bucketId)
{
ArgumentNullException.ThrowIfNullOrWhiteSpace(bucketId, nameof(bucketId));

Check warning on line 120 in src/WorkflowManager/Storage/Services/DicomService.cs

View workflow job for this annotation

GitHub Actions / sonarscanner

Remove this argument from the method call; it hides the caller information. (https://rules.sonarsource.com/csharp/RSPEC-3236)
ArgumentNullException.ThrowIfNullOrWhiteSpace(payloadId, nameof(payloadId));
var items = await _storageService.ListObjectsAsync(bucketId, $"{payloadId}/dcm", true);
var dict = new Dictionary<string, DicomValue>(StringComparer.OrdinalIgnoreCase);
Expand Down Expand Up @@ -291,7 +291,7 @@

if (dict.TryGetValue(DicomTagConstants.SeriesInstanceUIDTag, out var value))
{
return value.Value.ToString();
return JsonConvert.SerializeObject(value.Value);
}
return null;
}
Expand Down
4 changes: 4 additions & 0 deletions tests/UnitTests/Common.Tests/Services/PayloadServiceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -492,11 +492,15 @@
[Fact]
public async Task UpdateAsync_NullPayload_ThrowsArgumentNullException()
{

#pragma warning disable CS8604 // Possible null reference argument.
// Arrange
Payload payload = null;

Check warning on line 498 in tests/UnitTests/Common.Tests/Services/PayloadServiceTests.cs

View workflow job for this annotation

GitHub Actions / task-manager-integration-tests

Converting null literal or possible null value to non-nullable type.

Check warning on line 498 in tests/UnitTests/Common.Tests/Services/PayloadServiceTests.cs

View workflow job for this annotation

GitHub Actions / task-manager-integration-tests

Converting null literal or possible null value to non-nullable type.

Check warning on line 498 in tests/UnitTests/Common.Tests/Services/PayloadServiceTests.cs

View workflow job for this annotation

GitHub Actions / analyze

Converting null literal or possible null value to non-nullable type.

Check warning on line 498 in tests/UnitTests/Common.Tests/Services/PayloadServiceTests.cs

View workflow job for this annotation

GitHub Actions / analyze

Converting null literal or possible null value to non-nullable type.

Check warning on line 498 in tests/UnitTests/Common.Tests/Services/PayloadServiceTests.cs

View workflow job for this annotation

GitHub Actions / scan

Converting null literal or possible null value to non-nullable type.

Check warning on line 498 in tests/UnitTests/Common.Tests/Services/PayloadServiceTests.cs

View workflow job for this annotation

GitHub Actions / scan

Converting null literal or possible null value to non-nullable type.

Check warning on line 498 in tests/UnitTests/Common.Tests/Services/PayloadServiceTests.cs

View workflow job for this annotation

GitHub Actions / workflow-executor-integration-tests

Converting null literal or possible null value to non-nullable type.

Check warning on line 498 in tests/UnitTests/Common.Tests/Services/PayloadServiceTests.cs

View workflow job for this annotation

GitHub Actions / workflow-executor-integration-tests

Converting null literal or possible null value to non-nullable type.

Check warning on line 498 in tests/UnitTests/Common.Tests/Services/PayloadServiceTests.cs

View workflow job for this annotation

GitHub Actions / unit-tests-and-codecov

Converting null literal or possible null value to non-nullable type.

Check warning on line 498 in tests/UnitTests/Common.Tests/Services/PayloadServiceTests.cs

View workflow job for this annotation

GitHub Actions / unit-tests-and-codecov

Converting null literal or possible null value to non-nullable type.

Check warning on line 498 in tests/UnitTests/Common.Tests/Services/PayloadServiceTests.cs

View workflow job for this annotation

GitHub Actions / unit-tests-and-codecov

Converting null literal or possible null value to non-nullable type.

Check warning on line 498 in tests/UnitTests/Common.Tests/Services/PayloadServiceTests.cs

View workflow job for this annotation

GitHub Actions / docs

Converting null literal or possible null value to non-nullable type.

Check warning on line 498 in tests/UnitTests/Common.Tests/Services/PayloadServiceTests.cs

View workflow job for this annotation

GitHub Actions / docs

Converting null literal or possible null value to non-nullable type.

Check warning on line 498 in tests/UnitTests/Common.Tests/Services/PayloadServiceTests.cs

View workflow job for this annotation

GitHub Actions / docs

Converting null literal or possible null value to non-nullable type.

Check warning on line 498 in tests/UnitTests/Common.Tests/Services/PayloadServiceTests.cs

View workflow job for this annotation

GitHub Actions / docs

Converting null literal or possible null value to non-nullable type.

// Act & Assert

await Assert.ThrowsAsync<ArgumentNullException>(() => PayloadService.UpdateAsyncWorkflowIds(payload));
#pragma warning restore CS8604 // Possible null reference argument.
}

}
Expand Down
Loading