view Resources/Samples/Lua/Autorouting.lua @ 1010:160dfe770618 lua-scripting

refactoring
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 09 Jul 2014 17:05:00 +0200
parents 187ed107a59f
children 23590917e83e
line wrap: on
line source

function OnStoredInstance(instanceId, tags, metadata)
   --PrintRecursive(tags)
   --PrintRecursive(metadata)
   --print(metadata['RemoteAET'])

   if (metadata['ModifiedFrom'] == nil and
       metadata['AnonymizedFrom'] == nil) then
      local patientName = string.lower(tags['PatientName'])
      if string.find(patientName, 'david') ~= nil then
         --Delete(SendToModality(instanceId, 'sample'))
         --Delete(SendToPeer(instanceId, 'peer'))
         local replace = {}
         replace['StationName'] = 'My Medical Device'

         local remove = { 'MilitaryRank' }

         Delete(SendToModality(ModifyInstance(instanceId, replace, remove, true), 'sample'))
         Delete(instanceId)
      else
         Delete(instanceId)
      end
   end
end