LUA and Private Tag issues

Hi,

I am looking at auto-routing across multiple sites, leveraging the ‘OnStableStudy’ LUA function.
To enable me to keep track, I am trying to set a value to a private tag that will let me know the originating server of any given instance/study.

I have declared the test private tag in the dictionary in orthanc.json:

`

“Dictionary” : {
“0013,1001” : [ “LO”, “Originating Server”, 1, 1, “Test tag” ]
}

`

But whenever I set this tag in my script, it displays the following on the instance:

`
0013,1001 (Unknown Tag & Data): Null

`

I have tested the LUA script modifying a public tag, and this works as expected:

Annotation 2020-05-15 214544.png

The LUA script as it stands is:

`

function OnStableStudy(studyId, tags, metadata)
if (metadata[‘ModifiedFrom’] == nil and
metadata[‘AnonymizedFrom’] == nil) then

print('This study is now stable: ’ … studyId)

– The tags to be replaced
local replace = {}
replace[‘StationName’] = ‘OriginJVVMRTC00’
replace[‘0013-1001’] = ‘OriginJVVMRTC00’

local command = {}
command[‘Replace’] = replace

local modifiedFile = RestApiPost(‘/studies/’ … studyId … ‘/modify’, DumpJson(command, true))
print('Modified study: ’ … modifiedFile)
end
end

`

Any help in the right direction would be greatly appreciated, I’m sure it’s something simple!

Reuben

Hello,

You have simply not set the configuration option “DefaultPrivateCreator”. Here is a sample, minimalist configuration file:

{
“LuaScripts” : [ “script.lua” ],
“StableAge” : 1,
“Dictionary” : {
“0013,1001” : [ “LO”, “Originating Server”, 1, 1, “Test tag” ]
},
“DefaultPrivateCreator” : “Test tag”
}

And here is the result:

$ curl http://localhost:8042/instances/8240da4c-e53f0738-519fff70-10c092fa-1783eafa/tags
{

“0013,1001” : {
“Name” : “Originating Server”,
“PrivateCreator” : “Test tag”,
“Type” : “String”,
“Value” : “OriginJVVMRTC00”
},

}

Note that you’ll need Orthanc >= 1.6.0 for this to succeed.

HTH,
Sébastien-

Brilliant, thanks this has worked with the additional option.

278945 instances and counting.

Kind regards,
Reuben