# HG changeset patch # User Sebastien Jodogne # Date 1608200857 -3600 # Node ID b002f9abe802b3e93d789ddcc08cbbd331d019b1 # Parent 208029732d510473cdf7921ec90544b7a06f6697 review of changeset 4375:208029732d51 diff -r 208029732d51 -r b002f9abe802 NEWS --- a/NEWS Tue Dec 15 13:59:01 2020 -0500 +++ b/NEWS Thu Dec 17 11:27:37 2020 +0100 @@ -8,6 +8,9 @@ * New config option "MallocArenaMax" to control memory usage on GNU/Linux * Explicit error log if trying to load a 32bit (resp. 64bit) plugin into a 64bit (resp. 32bit) version of Orthanc +* New configuration options (contributions by Varian): + - "DeidentifyLogs" to remove patient identification from the logs (C-GET, C-MOVE, C-FIND) + - "DeidentifyLogsDicomVersion" to specify the deidentification rules for the logs REST API -------- diff -r 208029732d51 -r b002f9abe802 OrthancFramework/Sources/Enumerations.cpp --- a/OrthancFramework/Sources/Enumerations.cpp Tue Dec 15 13:59:01 2020 -0500 +++ b/OrthancFramework/Sources/Enumerations.cpp Thu Dec 17 11:27:37 2020 +0100 @@ -1608,7 +1608,8 @@ } else { - throw OrthancException(ErrorCode_ParameterOutOfRange); + throw OrthancException(ErrorCode_ParameterOutOfRange, + "Unknown specific version of the DICOM standard: " + version); } } diff -r 208029732d51 -r b002f9abe802 OrthancServer/Resources/Configuration.json --- a/OrthancServer/Resources/Configuration.json Tue Dec 15 13:59:01 2020 -0500 +++ b/OrthancServer/Resources/Configuration.json Thu Dec 17 11:27:37 2020 +0100 @@ -629,16 +629,16 @@ // threads share "N" memory pools (known as "arenas"). Setting this // option to "0" doesn't call mallopt()", which was the behavior of // Orthanc <= 1.8.1. - "MallocArenaMax" : 5 + "MallocArenaMax" : 5, - // Deidentify/anonymize the contents of C-Find, C-Get, and C-Move - // queries submitted to Orthanc according to Table E.1-1 of the - // DICOM standard - "DeidentifyDimseQueryLogs": true, + // Deidentify/anonymize the contents of the logs (notably C-Find, + // C-Get, and C-Move queries submitted to Orthanc) according to + // Table E.1-1 of the DICOM standard (new in Orthanc 1.8.2) + "DeidentifyLogs" : true, - // If DeidentifyDimseQueryLogs is true, this sets the DICOM standard - // to follow for the deintification/anonymization of the query + // If "DeidentifyLogs" is true, this sets the DICOM standard + // to follow for the deidentification/anonymization of the query // contents. Possible values are those that are specified in the - // definition of Orthanc::StringToDicomVersion - "DeidentifyDimseQueryLogsDicomVersion": "2017c", + // definition of Orthanc::StringToDicomVersion (new in Orthanc 1.8.2) + "DeidentifyLogsDicomVersion" : "2017c" } diff -r 208029732d51 -r b002f9abe802 OrthancServer/Sources/OrthancFindRequestHandler.cpp --- a/OrthancServer/Sources/OrthancFindRequestHandler.cpp Tue Dec 15 13:59:01 2020 -0500 +++ b/OrthancServer/Sources/OrthancFindRequestHandler.cpp Thu Dec 17 11:27:37 2020 +0100 @@ -639,7 +639,7 @@ { CLOG(INFO, DICOM) << " (" << query.GetElement(i).GetTag().Format() << ") " << FromDcmtkBridge::GetTagName(query.GetElement(i)) - << " = " << context_.GetDeidentifiedQueryContent(query.GetElement(i)); + << " = " << context_.GetDeidentifiedContent(query.GetElement(i)); } } diff -r 208029732d51 -r b002f9abe802 OrthancServer/Sources/OrthancGetRequestHandler.cpp --- a/OrthancServer/Sources/OrthancGetRequestHandler.cpp Tue Dec 15 13:59:01 2020 -0500 +++ b/OrthancServer/Sources/OrthancGetRequestHandler.cpp Thu Dec 17 11:27:37 2020 +0100 @@ -507,7 +507,7 @@ { CLOG(INFO, DICOM) << " (" << query.GetElement(i).GetTag().Format() << ") " << FromDcmtkBridge::GetTagName(query.GetElement(i)) - << " = " << context_.GetDeidentifiedQueryContent(query.GetElement(i)); + << " = " << context_.GetDeidentifiedContent(query.GetElement(i)); } } } @@ -517,8 +517,14 @@ **/ const DicomValue* levelTmp = input.TestAndGetValue(DICOM_TAG_QUERY_RETRIEVE_LEVEL); + if (levelTmp == NULL || + levelTmp->IsNull() || + levelTmp->IsBinary()) + { + throw OrthancException(ErrorCode_BadRequest, + "C-GET request without the tag 0008,0052 (QueryRetrieveLevel)"); + } - assert(levelTmp != NULL); ResourceType level = StringToResourceType(levelTmp->GetContent().c_str()); diff -r 208029732d51 -r b002f9abe802 OrthancServer/Sources/OrthancMoveRequestHandler.cpp --- a/OrthancServer/Sources/OrthancMoveRequestHandler.cpp Tue Dec 15 13:59:01 2020 -0500 +++ b/OrthancServer/Sources/OrthancMoveRequestHandler.cpp Thu Dec 17 11:27:37 2020 +0100 @@ -344,7 +344,7 @@ { CLOG(INFO, DICOM) << " (" << query.GetElement(i).GetTag().Format() << ") " << FromDcmtkBridge::GetTagName(query.GetElement(i)) - << " = " << context_.GetDeidentifiedQueryContent(query.GetElement(i)); + << " = " << context_.GetDeidentifiedContent(query.GetElement(i)); } } } diff -r 208029732d51 -r b002f9abe802 OrthancServer/Sources/ServerContext.cpp --- a/OrthancServer/Sources/ServerContext.cpp Tue Dec 15 13:59:01 2020 -0500 +++ b/OrthancServer/Sources/ServerContext.cpp Thu Dec 17 11:27:37 2020 +0100 @@ -270,8 +270,7 @@ overwriteInstances_(false), dcmtkTranscoder_(new DcmtkTranscoder), isIngestTranscoding_(false), - deidentifyDimseQueryLogs_(false), - deidentifyDimseQueryLogsDicomVersion_(DicomVersion_2017c) + deidentifyLogs_(false) { try { @@ -323,20 +322,22 @@ LOG(INFO) << "Automated transcoding of incoming DICOM instances is disabled"; } - if (lock.GetConfiguration().GetBooleanParameter("DeidentifyDimseQueryLogs", false)) + if (lock.GetConfiguration().GetBooleanParameter("DeidentifyLogs", true)) { - deidentifyDimseQueryLogs_ = true; - CLOG(INFO, DICOM) << "Deidentification of DIMSE query log contents is enabled"; + deidentifyLogs_ = true; + CLOG(INFO, DICOM) << "Deidentification of log contents (notably for DIMSE queries) is enabled"; - deidentifyDimseQueryLogsDicomVersion_ = StringToDicomVersion( - lock.GetConfiguration().GetStringParameter("DeidentifyDimseQueryLogsDicomVersion", "2017c")); + DicomVersion version = StringToDicomVersion( + lock.GetConfiguration().GetStringParameter("DeidentifyLogsDicomVersion", "2017c")); CLOG(INFO, DICOM) << "Version of DICOM standard used for deidentification is " - << EnumerationToString(deidentifyDimseQueryLogsDicomVersion_); + << EnumerationToString(version); + + logsDeidentifierRules_.SetupAnonymization(version); } else { - deidentifyDimseQueryLogs_ = false; - CLOG(INFO, DICOM) << "Deidentification of DIMSE query log contents is disabled"; + deidentifyLogs_ = false; + CLOG(INFO, DICOM) << "Deidentification of log contents (notably for DIMSE queries) is disabled"; } } @@ -346,11 +347,6 @@ changeThread_ = boost::thread(ChangeThread, this, (unitTesting ? 20 : 100)); dynamic_cast(*dcmtkTranscoder_).SetLossyQuality(lossyQuality); - - if (deidentifyDimseQueryLogs_) - { - logsDeidentifierRules_.SetupAnonymization(deidentifyDimseQueryLogsDicomVersion_); - } } catch (OrthancException&) { @@ -1653,15 +1649,15 @@ } } - const std::string& ServerContext::GetDeidentifiedQueryContent(const DicomElement &element) const + const std::string& ServerContext::GetDeidentifiedContent(const DicomElement &element) const { static const std::string redactedContent = "*** POTENTIAL PHI ***"; const DicomTag& tag = element.GetTag(); - if (deidentifyDimseQueryLogs_ && ( - logsDeidentifierRules_.IsCleared(tag) || - logsDeidentifierRules_.IsRemoved(tag) || - logsDeidentifierRules_.IsReplaced(tag))) + if (deidentifyLogs_ && ( + logsDeidentifierRules_.IsCleared(tag) || + logsDeidentifierRules_.IsRemoved(tag) || + logsDeidentifierRules_.IsReplaced(tag))) { return redactedContent; } diff -r 208029732d51 -r b002f9abe802 OrthancServer/Sources/ServerContext.h --- a/OrthancServer/Sources/ServerContext.h Tue Dec 15 13:59:01 2020 -0500 +++ b/OrthancServer/Sources/ServerContext.h Thu Dec 17 11:27:37 2020 +0100 @@ -247,11 +247,11 @@ size_t since, size_t limit); - // This DicomModification object is intended to be used as a "rules engine" - // when de-identifying logs for C-Find, C-Get, and C-Move queries + // This DicomModification object is intended to be used as a + // "rules engine" when de-identifying logs for C-Find, C-Get, and + // C-Move queries (new in Orthanc 1.8.2) DicomModification logsDeidentifierRules_; - bool deidentifyDimseQueryLogs_; - DicomVersion deidentifyDimseQueryLogsDicomVersion_; + bool deidentifyLogs_; public: class DicomCacheLocker : public boost::noncopyable @@ -509,6 +509,6 @@ return transcodeDicomProtocol_; } - const std::string& GetDeidentifiedQueryContent(const DicomElement& element) const; + const std::string& GetDeidentifiedContent(const DicomElement& element) const; }; }