# HG changeset patch # User Alain Mazy # Date 1761207820 -7200 # Node ID 20c1a564e44d28952776fdcae2fd14a6e10d8be6 # Parent 9c1f13e9b344ca38df5191faae26538bc94202b2 worklist api: force + modality + startdate diff -r 9c1f13e9b344 -r 20c1a564e44d OrthancFramework/Sources/DicomFormat/DicomTag.h --- a/OrthancFramework/Sources/DicomFormat/DicomTag.h Wed Oct 22 13:30:48 2025 +0200 +++ b/OrthancFramework/Sources/DicomFormat/DicomTag.h Thu Oct 23 10:23:40 2025 +0200 @@ -238,9 +238,10 @@ static const DicomTag DICOM_TAG_REFERENCED_FILE_ID(0x0004, 0x1500); // Tags for DicomWeb - static const Orthanc::DicomTag DICOM_TAG_RETRIEVE_URL(0x0008, 0x1190); + static const DicomTag DICOM_TAG_RETRIEVE_URL(0x0008, 0x1190); // Tags for Worklists - static const Orthanc::DicomTag DICOM_TAG_SCHEDULED_PROCEDURE_STEP_SEQUENCE(0x0040, 0x0100); - static const Orthanc::DicomTag DICOM_TAG_SCHEDULED_STATION_AETITLE(0x0040, 0x0001); + static const DicomTag DICOM_TAG_SCHEDULED_PROCEDURE_STEP_SEQUENCE(0x0040, 0x0100); + static const DicomTag DICOM_TAG_SCHEDULED_STATION_AETITLE(0x0040, 0x0001); + static const DicomTag DICOM_TAG_SCHEDULED_PROCEDURE_STEP_START_DATE(0x0040, 0x0002); } diff -r 9c1f13e9b344 -r 20c1a564e44d OrthancServer/Plugins/Samples/ModalityWorklists/Plugin.cpp --- a/OrthancServer/Plugins/Samples/ModalityWorklists/Plugin.cpp Wed Oct 22 13:30:48 2025 +0200 +++ b/OrthancServer/Plugins/Samples/ModalityWorklists/Plugin.cpp Thu Oct 23 10:23:40 2025 +0200 @@ -29,6 +29,7 @@ #include "../../../../OrthancFramework/Sources/Toolbox.h" #include "../../../../OrthancFramework/Sources/SystemToolbox.h" #include "../../../../OrthancFramework/Sources/DicomParsing/ParsedDicomFile.h" +#include "../../../../OrthancFramework/Sources/DicomFormat/DicomPath.h" #include "../../../../OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.h" #include "../../../../OrthancFramework/Sources/DicomFormat/DicomInstanceHasher.h" #include "../Common/OrthancPluginCppWrapper.h" @@ -578,13 +579,27 @@ throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat, "'Tags' field is missing or not a JSON object"); } + bool force = body.isMember("Force") && body["Force"].asBool(); + Json::Value& jsonWorklist = body["Tags"]; std::unique_ptr dicom(Orthanc::ParsedDicomFile::CreateFromJson(jsonWorklist, Orthanc::DicomFromJsonFlags_None, "")); - if (!dicom->HasTag(Orthanc::DICOM_TAG_SCHEDULED_PROCEDURE_STEP_SEQUENCE)) + if (!force) { - throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat, "'Tags' is missing a ScheduledProcedureStepSequence"); + if (!dicom->HasTag(Orthanc::DICOM_TAG_SCHEDULED_PROCEDURE_STEP_SEQUENCE)) + { + throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat, "'Tags' is missing a 'ScheduledProcedureStepSequence'. Use 'Force': true to bypass this check."); + } + Orthanc::DicomMap step; + if (!dicom->LookupSequenceItem(step, Orthanc::DicomPath::Parse("ScheduledProcedureStepSequence"), 0) || !step.HasTag(Orthanc::DICOM_TAG_MODALITY)) + { + throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat, "'ScheduledProcedureStepSequence' is missing a 'Modality' Use 'Force': true to bypass this check."); + } + if (!dicom->LookupSequenceItem(step, Orthanc::DicomPath::Parse("ScheduledProcedureStepSequence"), 0) || !step.HasTag(Orthanc::DICOM_TAG_SCHEDULED_PROCEDURE_STEP_START_DATE)) + { + throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat, "'ScheduledProcedureStepSequence' is missing a 'ScheduledProcedureStepStartDate' Use 'Force': true to bypass this check."); + } } dicom->SetIfAbsent(Orthanc::DICOM_TAG_MEDIA_STORAGE_SOP_CLASS_UID, "1.2.276.0.7230010.3.1.0.1");