Hi
I am trying to extract following patient information for the received studies and forward it to another PACS.
- Patient Name
- Institution
- Modality
- Study Date
- Study Time
I am currently using OnstoredInstance Lua script which works fine to extract the tags and post to external DB. But it is creating HTTP API POST calls for every instance which is not desirable for me as it overloads the DB receiving many other query from other sources as well. I want to extract this information only when the study is stable (to reduce the number of queries to my DB), for this i tried to use the following nested Lua script but it only sends the Institution, Study Date and Time. It doesnot send the Patient Name and Modality.
Any suggestions??
Lua Script is below:
JSON = (load(HttpGet(‘http://regex.info/code/JSON.lua’))) ()
function OnStableStudy(studyId, tags, metadata)
local headers = { [“content-type”] = “application/json; charset=utf-8” }
function OnStoredInstance(instanceId, tags, metadata)
local info = {}
info[‘InstitutionName’] = tags[‘InstitutionName’]
info[‘PatientName’] = tags[‘PatientName’]
info[‘Modality’] = tags[‘Modality’]
info[‘StudyInstanceUID’] = tags[‘StudyInstanceUID’]
info[‘StudyDate’] = tags[‘StudyDate’]
info[‘StudyTime’] = tags[‘StudyTime’]
return info
end
local test = OnStoredInstance(instanceId, tags, metadata)
– Send the POST request
local answer = HttpPost(‘http://localhost:3000/api/dataFromPacsRouter’, JSON:encode(test), headers)
– The answer equals “ERROR” in case of an error
print('Web service called, answer received: ’ … answer)
local moveBody = {}
moveBody[“Synchronous”] = false
moveBody[“Resources”] = {}
table.insert(moveBody[“Resources”], studyId)
local moveJobId = ParseJson(RestApiPost(‘/modalities/ORTHANCLOCAL/store’, DumpJson(moveBody)))[“ID”]
print('moving current study to workstation in job ’ … moveJobId)
end
function OnJobSuccess(jobId)
local job = ParseJson(RestApiGet(‘/jobs/’ … jobId))
if job[“Type”] == “DicomModalityStore” then
– delete the study once it has been forwarded
RestApiDelete(‘/studies/’ … job[“Content”][“ParentResources”][1])
end
end