Mercurial > hg > orthanc-databases
annotate Framework/Plugins/OptimizedRoutes.cpp @ 161:2ccde9c7311b optimized-routes
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
author | Alain Mazy <alain@mazy.be> |
---|---|
date | Fri, 10 Jul 2020 13:26:47 +0200 |
parents | |
children | 6f83b74373d3 |
rev | line source |
---|---|
161
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
1 /** |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
2 * Orthanc - A Lightweight, RESTful DICOM Store |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
6 * |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
7 * This program is free software: you can redistribute it and/or |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
8 * modify it under the terms of the GNU Affero General Public License |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
9 * as published by the Free Software Foundation, either version 3 of |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
10 * the License, or (at your option) any later version. |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
11 * |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
12 * This program is distributed in the hope that it will be useful, but |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
13 * WITHOUT ANY WARRANTY; without even the implied warranty of |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
15 * Affero General Public License for more details. |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
16 * |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
17 * You should have received a copy of the GNU Affero General Public License |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
19 **/ |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
20 |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
21 |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
22 #include "OptimizedRoutes.h" |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
23 #include "../../Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h" |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
24 |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
25 #include <string> |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
26 #include <map> |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
27 #include <list> |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
28 #include <json/writer.h> |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
29 #include <json/value.h> |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
30 #include <boost/algorithm/string.hpp> // for boost::algorithm::split & boost::starts_with |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
31 |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
32 static OrthancDatabases::IndexBackend* backend_; |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
33 static OrthancPluginContext* context_; |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
34 |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
35 extern "C" |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
36 { |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
37 |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
38 // handles url like /optimized-routes/studies/{id)/instances-metadata?types=1,10 |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
39 OrthancPluginErrorCode RestGetStudiesInstancesMetadata(OrthancPluginRestOutput* output, |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
40 const char* /* url */, |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
41 const OrthancPluginHttpRequest* request) |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
42 { |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
43 std::list<int32_t> metadataTypes; |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
44 for (uint32_t i = 0; i < request->getCount; i++) |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
45 { |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
46 if (strcmp(request->getKeys[i], "types") == 0) |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
47 { |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
48 std::string getValue(request->getValues[i]); |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
49 std::vector<std::string> typesString; |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
50 boost::algorithm::split(typesString, getValue, boost::is_any_of(",")); |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
51 |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
52 for (size_t t = 0; t < typesString.size(); t++) |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
53 { |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
54 int32_t metadataType = boost::lexical_cast<int32_t>(typesString[t]); |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
55 metadataTypes.push_back(metadataType); |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
56 } |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
57 } |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
58 } |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
59 |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
60 std::map<std::string, std::map<int32_t, std::string>> result; |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
61 std::string orthancId = std::string(request->groups[0]); |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
62 backend_->GetStudyInstancesMetadata(result, |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
63 orthancId, |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
64 metadataTypes); |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
65 |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
66 Json::Value response(Json::objectValue); |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
67 for (std::map<std::string, std::map<int32_t, std::string>>::const_iterator itInstance = result.begin(); itInstance != result.end(); itInstance++) |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
68 { |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
69 Json::Value instanceMetadatas; |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
70 for (std::map<int32_t, std::string>::const_iterator itMetadata = itInstance->second.begin(); itMetadata != itInstance->second.end(); itMetadata++) |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
71 { |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
72 std::string id = boost::lexical_cast<std::string>(itMetadata->first); |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
73 instanceMetadatas[id] = itMetadata->second; |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
74 } |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
75 |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
76 response[itInstance->first] = instanceMetadatas; |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
77 } |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
78 |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
79 Json::StyledWriter writer; |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
80 std::string outputStr = writer.write(response); |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
81 OrthancPluginAnswerBuffer(context_, output, outputStr.c_str(), outputStr.size(), "application/json"); |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
82 |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
83 return OrthancPluginErrorCode_Success; |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
84 } |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
85 |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
86 // handles url like /optimized-routes/studies/{id)/instances-ids |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
87 OrthancPluginErrorCode RestGetStudiesInstancesIds(OrthancPluginRestOutput* output, |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
88 const char* /*url*/, |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
89 const OrthancPluginHttpRequest* request) |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
90 { |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
91 std::list<std::string> result; |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
92 std::string orthancId = std::string(request->groups[0]); |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
93 backend_->GetStudyInstancesIds(result, |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
94 orthancId); |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
95 |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
96 Json::Value response(Json::arrayValue); |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
97 for (std::list<std::string>::const_iterator itInstance = result.begin(); itInstance != result.end(); itInstance++) |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
98 { |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
99 response.append(*itInstance); |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
100 } |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
101 |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
102 Json::StyledWriter writer; |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
103 std::string outputStr = writer.write(response); |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
104 OrthancPluginAnswerBuffer(context_, output, outputStr.c_str(), outputStr.size(), "application/json"); |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
105 |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
106 return OrthancPluginErrorCode_Success; |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
107 } |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
108 } |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
109 |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
110 namespace OrthancDatabases { |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
111 |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
112 void OptimizedRoutes::EnableOptimizedRoutes(IndexBackend *backend, OrthancPluginContext *context) |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
113 { |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
114 backend_ = backend; |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
115 context_ = context; |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
116 // Register optimized rest routes (temporary) |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
117 OrthancPluginRegisterRestCallbackNoLock(context_, "/optimized-routes/studies/(.*)/instances-metadata", RestGetStudiesInstancesMetadata); |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
118 OrthancPluginRegisterRestCallbackNoLock(context_, "/optimized-routes/studies/(.*)/instances-ids", RestGetStudiesInstancesIds); |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
119 } |
2ccde9c7311b
added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
120 } |