view Sphinx/source/plugins/python/set-stable-status.py @ 1192:211d3cf87e6d

really fixed auto routing bug (DW) in Python page
author Benoit Crickboom <bc@orthanc.team>
date Sat, 16 Aug 2025 13:19:02 +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)