view Sphinx/source/plugins/python/set-stable-status.py @ 1193:67813246f03e

added java samples for key-value stores and queues
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 21 Aug 2025 15:48:18 +0200
parents 801707730af7
children
line wrap: on
line source

import orthanc
import json

def OnChange(changeType, level, resource):
    if changeType == orthanc.ChangeType.NEW_INSTANCE:
        parentSeries = json.loads(orthanc.RestApiGet('/instances/%s/series' % resource))
        
        if parentSeries["MainDicomTags"]["Modality"] == "CR":
            orthanc.LogInfo('Stabilizing CR series directly: %s' % resource)
            ret, hasStableStatusChanged = orthanc.SetStableStatus(parentSeries["ID"], orthanc.StableStatus.STABLE)

orthanc.RegisterOnChangeCallback(OnChange)