Skip to content

Commit

Permalink
Merge pull request #1007 from Project-MONAI/nds-addAccessionId
Browse files Browse the repository at this point in the history
fix up for migrations and accessionId
  • Loading branch information
neildsouth authored Jul 3, 2024
2 parents 12573b1 + 3e544e9 commit 746fad5
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,15 @@ public M003_WorkflowRevision_addDataRetension() : base("1.0.3") { }

public override void Up(BsonDocument document)
{
var workflow = document["Workflow"].AsBsonDocument;
workflow.Add("DataRetentionDays", -1, true);
try
{
var workflow = document["Workflow"].AsBsonDocument;
workflow.Add("DataRetentionDays", -1, true);
}
catch
{// can ignore we dont want failures stopping startup !
}

}

public override void Down(BsonDocument document)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,23 @@ public M004_WorkflowRevision_addConditions() : base("1.0.4") { }

public override void Up(BsonDocument document)
{
var workflow = document["Workflow"].AsBsonDocument;
workflow.Add("Conditions", new BsonArray { });
try
{
var workflow = document["Workflow"].AsBsonDocument;
workflow.Add("Predicate", new BsonArray { });
}
catch
{ // can ignore we dont want failures stopping startup !
}

}

public override void Down(BsonDocument document)
{
try
{
var workflow = document["Workflow"].AsBsonDocument;
workflow.Remove("Conditions");
workflow.Remove("Predicate");
}
catch
{ // can ignore we dont want failures stopping startup !
Expand Down
4 changes: 3 additions & 1 deletion src/WorkflowManager/Storage/Services/DicomService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,9 @@ public string GetValue(Dictionary<string, DicomValue> dict, string keyId)

if (dict.TryGetValue(DicomTagConstants.AccessionNumberTag, out var value))
{
return JsonConvert.SerializeObject(value.Value);
var accession = JsonConvert.SerializeObject(value.Value);
accession = accession.Replace("[\"", "").Replace("\"]", "");
return accession;
}
return null;
}
Expand Down

0 comments on commit 746fad5

Please sign in to comment.