Mercurial > hg > orthanc
comparison OrthancServer/Sources/ServerContext.cpp @ 4375:208029732d51 varian
New config option "DeidentifyDimseQueryLogs"
author | Mark Poscablo <Mark.Poscablo@varian.com> |
---|---|
date | Tue, 15 Dec 2020 13:59:01 -0500 |
parents | 09ed936fd381 |
children | b002f9abe802 |
comparison
equal
deleted
inserted
replaced
4374:79ef2b6d8e76 | 4375:208029732d51 |
---|---|
33 | 33 |
34 #include "PrecompiledHeadersServer.h" | 34 #include "PrecompiledHeadersServer.h" |
35 #include "ServerContext.h" | 35 #include "ServerContext.h" |
36 | 36 |
37 #include "../../OrthancFramework/Sources/Cache/SharedArchive.h" | 37 #include "../../OrthancFramework/Sources/Cache/SharedArchive.h" |
38 #include "../../OrthancFramework/Sources/DicomFormat/DicomElement.h" | |
38 #include "../../OrthancFramework/Sources/DicomParsing/DcmtkTranscoder.h" | 39 #include "../../OrthancFramework/Sources/DicomParsing/DcmtkTranscoder.h" |
40 #include "../../OrthancFramework/Sources/DicomParsing/DicomModification.h" | |
39 #include "../../OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.h" | 41 #include "../../OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.h" |
40 #include "../../OrthancFramework/Sources/DicomParsing/Internals/DicomImageDecoder.h" | 42 #include "../../OrthancFramework/Sources/DicomParsing/Internals/DicomImageDecoder.h" |
41 #include "../../OrthancFramework/Sources/FileStorage/StorageAccessor.h" | 43 #include "../../OrthancFramework/Sources/FileStorage/StorageAccessor.h" |
42 #include "../../OrthancFramework/Sources/HttpServer/FilesystemHttpSender.h" | 44 #include "../../OrthancFramework/Sources/HttpServer/FilesystemHttpSender.h" |
43 #include "../../OrthancFramework/Sources/HttpServer/HttpStreamTranscoder.h" | 45 #include "../../OrthancFramework/Sources/HttpServer/HttpStreamTranscoder.h" |
265 metricsRegistry_(new MetricsRegistry), | 267 metricsRegistry_(new MetricsRegistry), |
266 isHttpServerSecure_(true), | 268 isHttpServerSecure_(true), |
267 isExecuteLuaEnabled_(false), | 269 isExecuteLuaEnabled_(false), |
268 overwriteInstances_(false), | 270 overwriteInstances_(false), |
269 dcmtkTranscoder_(new DcmtkTranscoder), | 271 dcmtkTranscoder_(new DcmtkTranscoder), |
270 isIngestTranscoding_(false) | 272 isIngestTranscoding_(false), |
273 deidentifyDimseQueryLogs_(false), | |
274 deidentifyDimseQueryLogsDicomVersion_(DicomVersion_2017c) | |
271 { | 275 { |
272 try | 276 try |
273 { | 277 { |
274 unsigned int lossyQuality; | 278 unsigned int lossyQuality; |
275 | 279 |
316 else | 320 else |
317 { | 321 { |
318 isIngestTranscoding_ = false; | 322 isIngestTranscoding_ = false; |
319 LOG(INFO) << "Automated transcoding of incoming DICOM instances is disabled"; | 323 LOG(INFO) << "Automated transcoding of incoming DICOM instances is disabled"; |
320 } | 324 } |
325 | |
326 if (lock.GetConfiguration().GetBooleanParameter("DeidentifyDimseQueryLogs", false)) | |
327 { | |
328 deidentifyDimseQueryLogs_ = true; | |
329 CLOG(INFO, DICOM) << "Deidentification of DIMSE query log contents is enabled"; | |
330 | |
331 deidentifyDimseQueryLogsDicomVersion_ = StringToDicomVersion( | |
332 lock.GetConfiguration().GetStringParameter("DeidentifyDimseQueryLogsDicomVersion", "2017c")); | |
333 CLOG(INFO, DICOM) << "Version of DICOM standard used for deidentification is " | |
334 << EnumerationToString(deidentifyDimseQueryLogsDicomVersion_); | |
335 } | |
336 else | |
337 { | |
338 deidentifyDimseQueryLogs_ = false; | |
339 CLOG(INFO, DICOM) << "Deidentification of DIMSE query log contents is disabled"; | |
340 } | |
321 } | 341 } |
322 | 342 |
323 jobsEngine_.SetThreadSleep(unitTesting ? 20 : 200); | 343 jobsEngine_.SetThreadSleep(unitTesting ? 20 : 200); |
324 | 344 |
325 listeners_.push_back(ServerListener(luaListener_, "Lua")); | 345 listeners_.push_back(ServerListener(luaListener_, "Lua")); |
326 changeThread_ = boost::thread(ChangeThread, this, (unitTesting ? 20 : 100)); | 346 changeThread_ = boost::thread(ChangeThread, this, (unitTesting ? 20 : 100)); |
327 | 347 |
328 dynamic_cast<DcmtkTranscoder&>(*dcmtkTranscoder_).SetLossyQuality(lossyQuality); | 348 dynamic_cast<DcmtkTranscoder&>(*dcmtkTranscoder_).SetLossyQuality(lossyQuality); |
349 | |
350 if (deidentifyDimseQueryLogs_) | |
351 { | |
352 logsDeidentifierRules_.SetupAnonymization(deidentifyDimseQueryLogsDicomVersion_); | |
353 } | |
329 } | 354 } |
330 catch (OrthancException&) | 355 catch (OrthancException&) |
331 { | 356 { |
332 Stop(); | 357 Stop(); |
333 throw; | 358 throw; |
1625 else | 1650 else |
1626 { | 1651 { |
1627 return false; | 1652 return false; |
1628 } | 1653 } |
1629 } | 1654 } |
1655 | |
1656 const std::string& ServerContext::GetDeidentifiedQueryContent(const DicomElement &element) const | |
1657 { | |
1658 static const std::string redactedContent = "*** POTENTIAL PHI ***"; | |
1659 | |
1660 const DicomTag& tag = element.GetTag(); | |
1661 if (deidentifyDimseQueryLogs_ && ( | |
1662 logsDeidentifierRules_.IsCleared(tag) || | |
1663 logsDeidentifierRules_.IsRemoved(tag) || | |
1664 logsDeidentifierRules_.IsReplaced(tag))) | |
1665 { | |
1666 return redactedContent; | |
1667 } | |
1668 else | |
1669 { | |
1670 return element.GetValue().GetContent(); | |
1671 } | |
1672 } | |
1630 } | 1673 } |