-
Notifications
You must be signed in to change notification settings - Fork 100
3. ChRIS plugin PACS query workflow
This page describes interacting with the ChRIS Ultron Back End (CUBE) using pfurl
and running an FS
type plugin called pl-pacsquery
. Essentially, pl-pacsquery
searches a PACS for some meta information based on a pattern of command line terms, and returns results of this query in several small text/JSON files. These result files can be consumed by downstream processing for other purposes (such as instantiating a pl-pacsretrieve
plugin.
Covered in this page are:
- Formulating a client-side request to run an instance of the plugin
- Checking on the result/status
- Checking on registered files
- Pulling a generated file to the client
You should set an environment variable, HOST_IP
to the IP of the actual host you are using. In Linux, this is
export HOST_IP=$(ip route | grep -v docker | awk '{if(NF==11) print $9}')
At least one user with name/password combination as
-
chris
/chris1234
pfcon
pfioh
pman
Start CUBE from the repository source directory, running
*make*
A PACS server should be accessible via IP:port to this plugin, i.e. a network path must exist between the plugin (and the host/container where it runs) and a PACS server.
In the CUBE system, we use an Orthanc container to simulate a PACS. Starting this server is out of scope of this document. See elsewhere for more information.
pfurl --auth chris:chris1234 --http ${HOST_IP}:8000/api/v1/plugins/ \
--quiet --jsonpprintindent 4
Look through the list for pl-pacsquery
. For example, let's say that this is located at
http://10.17.24.163:8000/api/v1/plugins/3/
we can call
pfurl --auth chris:chris1234 --http ${HOST_IP}:8000/api/v1/plugins/3/ \
--quiet --jsonpprintindent 4
{
"collection": {
"href": "http://192.168.1.189:8000/api/v1/plugins/3/",
"items": [
{
"href": "http://192.168.1.189:8000/api/v1/plugins/3/",
"data": [
{
"name": "name",
"value": "pacsquery"
},
{
"name": "dock_image",
"value": "fnndsc/pl-pacsquery"
},
{
"name": "type",
"value": "fs"
}
],
"links": [
{
"href": "http://192.168.1.189:8000/api/v1/plugins/3/parameters/",
"rel": "parameters"
},
{
"href": "http://192.168.1.189:8000/api/v1/plugins/3/instances/",
"rel": "instances"
}
]
}
],
"links": [],
"version": "1.0"
}
}
Follow the links provided to get information on the parameters for the plugin
pfurl --auth chris:chris1234 --http ${HOST_IP}:8000/api/v1/plugins/3/parameters/ \
--quiet --jsonpprintindent 4
{
"collection": {
"links": [
{
"rel": "plugin",
"href": "http://192.168.1.189:8000/api/v1/plugins/3/"
},
{
"rel": "next",
"href": "http://192.168.1.189:8000/api/v1/plugins/3/parameters/?limit=10&offset=10"
}
],
"items": [
{
"links": [
{
"rel": "plugin",
"href": "http://192.168.1.189:8000/api/v1/plugins/3/"
}
],
"data": [
{
"name": "name",
"value": "str_pfdcm"
},
{
"name": "type",
"value": "string"
},
{
"name": "optional",
"value": true
},
{
"name": "default",
"value": ""
},
{
"name": "help",
"value": "The PACS Q/R intermediary service IP:port."
}
],
"href": "http://192.168.1.189:8000/api/v1/plugins/parameters/4/"
},
{
"links": [
{
"rel": "plugin",
"href": "http://192.168.1.189:8000/api/v1/plugins/3/"
}
],
"data": [
{
"name": "name",
"value": "str_msg"
},
{
"name": "type",
"value": "string"
},
{
"name": "optional",
"value": true
},
{
"name": "default",
"value": ""
},
{
"name": "help",
"value": "The actual complete JSON message to send to the Q/R intermediary service."
}
],
"href": "http://192.168.1.189:8000/api/v1/plugins/parameters/5/"
},
{
"links": [
{
"rel": "plugin",
"href": "http://192.168.1.189:8000/api/v1/plugins/3/"
}
],
"data": [
{
"name": "name",
"value": "str_patientID"
},
{
"name": "type",
"value": "string"
},
{
"name": "optional",
"value": true
},
{
"name": "default",
"value": ""
},
{
"name": "help",
"value": "The PatientID to query."
}
],
"href": "http://192.168.1.189:8000/api/v1/plugins/parameters/6/"
},
{
"links": [
{
"rel": "plugin",
"href": "http://192.168.1.189:8000/api/v1/plugins/3/"
}
],
"data": [
{
"name": "name",
"value": "str_PACSservice"
},
{
"name": "type",
"value": "string"
},
{
"name": "optional",
"value": true
},
{
"name": "default",
"value": "orthanc"
},
{
"name": "help",
"value": "The PACS service to use. Note this a key to a lookup in \"pfdcm\"."
}
],
"href": "http://192.168.1.189:8000/api/v1/plugins/parameters/7/"
},
{
"links": [
{
"rel": "plugin",
"href": "http://192.168.1.189:8000/api/v1/plugins/3/"
}
],
"data": [
{
"name": "name",
"value": "str_summaryKeys"
},
{
"name": "type",
"value": "string"
},
{
"name": "optional",
"value": true
},
{
"name": "default",
"value": ""
},
{
"name": "help",
"value": "If specified, generate a summary report based on a comma separated key list."
}
],
"href": "http://192.168.1.189:8000/api/v1/plugins/parameters/8/"
},
{
"links": [
{
"rel": "plugin",
"href": "http://192.168.1.189:8000/api/v1/plugins/3/"
}
],
"data": [
{
"name": "name",
"value": "str_summaryFile"
},
{
"name": "type",
"value": "string"
},
{
"name": "optional",
"value": true
},
{
"name": "default",
"value": ""
},
{
"name": "help",
"value": "If specified, save (overwrite) a summary report to passed file (in outputdir)."
}
],
"href": "http://192.168.1.189:8000/api/v1/plugins/parameters/9/"
},
{
"links": [
{
"rel": "plugin",
"href": "http://192.168.1.189:8000/api/v1/plugins/3/"
}
],
"data": [
{
"name": "name",
"value": "str_numberOfHitsFile"
},
{
"name": "type",
"value": "string"
},
{
"name": "optional",
"value": true
},
{
"name": "default",
"value": ""
},
{
"name": "help",
"value": "If specified, save (overwrite) the number of hits (in outputdir)."
}
],
"href": "http://192.168.1.189:8000/api/v1/plugins/parameters/10/"
},
{
"links": [
{
"rel": "plugin",
"href": "http://192.168.1.189:8000/api/v1/plugins/3/"
}
],
"data": [
{
"name": "name",
"value": "str_resultFile"
},
{
"name": "type",
"value": "string"
},
{
"name": "optional",
"value": true
},
{
"name": "default",
"value": ""
},
{
"name": "help",
"value": "If specified, save (overwrite) all the hits to the passed file (in outputdir)."
}
],
"href": "http://192.168.1.189:8000/api/v1/plugins/parameters/11/"
},
{
"links": [
{
"rel": "plugin",
"href": "http://192.168.1.189:8000/api/v1/plugins/3/"
}
],
"data": [
{
"name": "name",
"value": "str_man"
},
{
"name": "type",
"value": "string"
},
{
"name": "optional",
"value": true
},
{
"name": "default",
"value": ""
},
{
"name": "help",
"value": "If specified, print help on the passed key entry. Use \"entries\" for all key list"
}
],
"href": "http://192.168.1.189:8000/api/v1/plugins/parameters/12/"
},
{
"links": [
{
"rel": "plugin",
"href": "http://192.168.1.189:8000/api/v1/plugins/3/"
}
],
"data": [
{
"name": "name",
"value": "b_pfurlQuiet"
},
{
"name": "type",
"value": "boolean"
},
{
"name": "optional",
"value": true
},
{
"name": "default",
"value": "False"
},
{
"name": "help",
"value": "Silence pfurl noise."
}
],
"href": "http://192.168.1.189:8000/api/v1/plugins/parameters/13/"
}
],
"href": "http://192.168.1.189:8000/api/v1/plugins/3/parameters/",
"version": "1.0"
}
}
NB: MAKE SURE THE str_pfdcm IP is correct below!
pfurl --auth chris:chris1234 --verb POST \
--http ${HOST_IP}:8000/api/v1/plugins/3/instances/ \
--content-type application/vnd.collection+json \
--jsonwrapper 'template' --msg '
{"data":
[{"name": "str_pfdcm", "value": "10.17.24.163:5015"},
{"name": "str_patientID", "value": "LILLA-9731"},
{"name": "str_PACSservice", "value": "orthanc"},
{"name": "b_pfurlQuiet", "value": true},
{"name": "str_summaryKeys", "value":"PatientID,PatientAge,StudyDescription,StudyInstanceUID,SeriesDescription,SeriesInstanceUID,NumberOfSeriesRelatedInstances"},
{"name": "str_summaryFile", "value": "summary.txt"},
{"name": "str_resultFile", "value": "results.json"},
{"name": "str_numberOfHitsFile", "value": "hits.txt"}
]
}' --quiet --jsonpprintindent 4
{
"stdout": {
"collection": {
"href": "http://192.168.1.189:8000/api/v1/plugins/3/instances/",
"items": [
{
"href": "http://192.168.1.189:8000/api/v1/plugins/instances/1/",
"data": [
{
"name": "id",
"value": 1
},
{
"name": "previous_id",
"value": null
},
{
"name": "plugin_name",
"value": "pacsquery"
},
{
"name": "start_date",
"value": "2017-10-25T03:43:26.156506Z"
},
{
"name": "end_date",
"value": "2017-10-25T03:43:26.156555Z"
},
{
"name": "status",
"value": "started"
},
{
"name": "owner",
"value": "chris"
}
],
"links": [
{
"href": "http://192.168.1.189:8000/api/v1/1/",
"rel": "feed"
},
{
"href": "http://192.168.1.189:8000/api/v1/plugins/3/",
"rel": "plugin"
},
{
"href": "http://192.168.1.189:8000/api/v1/plugins/string-parameter/1/",
"rel": "string_param"
},
{
"href": "http://192.168.1.189:8000/api/v1/plugins/string-parameter/2/",
"rel": "string_param"
},
{
"href": "http://192.168.1.189:8000/api/v1/plugins/string-parameter/3/",
"rel": "string_param"
},
{
"href": "http://192.168.1.189:8000/api/v1/plugins/string-parameter/4/",
"rel": "string_param"
},
{
"href": "http://192.168.1.189:8000/api/v1/plugins/string-parameter/5/",
"rel": "string_param"
},
{
"href": "http://192.168.1.189:8000/api/v1/plugins/string-parameter/6/",
"rel": "string_param"
},
{
"href": "http://192.168.1.189:8000/api/v1/plugins/string-parameter/7/",
"rel": "string_param"
},
{
"href": "http://192.168.1.189:8000/api/v1/plugins/bool-parameter/1/",
"rel": "bool_param"
}
]
}
],
"links": [],
"version": "1.0"
}
},
"msg": "push OK."
}
Examine the return JSON for the instance ID returned. In the above, we note that this is
"stdout": {
"collection": {
"href": "http://192.168.1.189:8000/api/v1/plugins/3/instances/",
"items": [
{
"href": "http://192.168.1.189:8000/api/v1/plugins/instances/1/",
In other words, instance 1.
pfurl --auth chris:chris1234 \
--verb GET \
--http ${HOST_IP}:8000/api/v1/plugins/instances/1/ \
--content-type application/vnd.collection+json \
--quiet --jsonpprintindent 4
{
"collection": {
"href": "http://192.168.1.189:8000/api/v1/plugins/instances/1/",
"items": [
{
"href": "http://192.168.1.189:8000/api/v1/plugins/instances/1/",
"data": [
{
"name": "id",
"value": 1
},
{
"name": "previous_id",
"value": null
},
{
"name": "plugin_name",
"value": "pacsquery"
},
{
"name": "start_date",
"value": "2017-10-25T03:43:26.156506Z"
},
{
"name": "end_date",
"value": "2017-10-25T03:46:11.205590Z"
},
{
"name": "status",
"value": "finishedSuccessfully"
},
{
"name": "owner",
"value": "chris"
}
],
"links": [
{
"href": "http://192.168.1.189:8000/api/v1/1/",
"rel": "feed"
},
{
"href": "http://192.168.1.189:8000/api/v1/plugins/3/",
"rel": "plugin"
},
{
"href": "http://192.168.1.189:8000/api/v1/plugins/string-parameter/1/",
"rel": "string_param"
},
{
"href": "http://192.168.1.189:8000/api/v1/plugins/string-parameter/2/",
"rel": "string_param"
},
{
"href": "http://192.168.1.189:8000/api/v1/plugins/string-parameter/3/",
"rel": "string_param"
},
{
"href": "http://192.168.1.189:8000/api/v1/plugins/string-parameter/4/",
"rel": "string_param"
},
{
"href": "http://192.168.1.189:8000/api/v1/plugins/string-parameter/5/",
"rel": "string_param"
},
{
"href": "http://192.168.1.189:8000/api/v1/plugins/string-parameter/6/",
"rel": "string_param"
},
{
"href": "http://192.168.1.189:8000/api/v1/plugins/string-parameter/7/",
"rel": "string_param"
},
{
"href": "http://192.168.1.189:8000/api/v1/plugins/bool-parameter/1/",
"rel": "bool_param"
}
]
}
],
"links": [],
"version": "1.0"
}
}
In which we see that the status is finishedSuccessfully.
Finally, we can check the CUBE container space for the files returned from the query
dke chris_dev_backend
root@00bb9aaa4659:/usr/src/chris_backend# cd /usr/users/chris/feed_1/pacsquery_1/data/
root@00bb9aaa4659:/usr/users/chris/feed_1/pacsquery_1/data# ls
hits.txt input.meta.json output.meta.json results.json summary.txt
root@00bb9aaa4659:/usr/users/chris/feed_1/pacsquery_1/data#
where
dke ()
{
NAME=$1;
ID=$(dkl | grep $NAME | head -n 1 | awk '{print $1}');
docker exec -ti $ID /bin/bash
}
To access files from a client, determine the feed ID by performing a GET on the instance as above. Note in the links return
{
"rel": "feed",
"href": "http://10.17.24.163:8000/api/v1/1/"
}
which denotes the feed ID as 1.
Access the references to registered files by calling http://10.17.24.163:8000/api/v1/1/, ie
pfurl --auth chris:chris1234 \
--verb GET \
--http ${HOST_IP}:8000/api/v1/1/files/ \
--content-type application/vnd.collection+json \
--quiet --jsonpprintindent 4
which should return
"collection": {
"items": [
{
"data": [
{
"value": "/summary.txt",
"name": "path"
},
{
"value": 1,
"name": "feed_id"
},
{
"value": 1,
"name": "plugin_inst_id"
}
],
"href": "http://10.17.24.163:8000/api/v1/files/1/",
"links": [
{
"href": "http://10.17.24.163:8000/api/v1/files/1/summary.txt",
"rel": "file_resource"
},
{
"href": "http://10.17.24.163:8000/api/v1/1/",
"rel": "feed"
},
{
"href": "http://10.17.24.163:8000/api/v1/plugins/instances/1/",
"rel": "plugin_inst"
}
]
},
{
"data": [
{
"value": "/output.meta.json",
"name": "path"
},
{
"value": 1,
"name": "feed_id"
},
{
"value": 1,
"name": "plugin_inst_id"
}
],
"href": "http://10.17.24.163:8000/api/v1/files/2/",
"links": [
{
"href": "http://10.17.24.163:8000/api/v1/files/2/output.meta.json",
"rel": "file_resource"
},
{
"href": "http://10.17.24.163:8000/api/v1/1/",
"rel": "feed"
},
{
"href": "http://10.17.24.163:8000/api/v1/plugins/instances/1/",
"rel": "plugin_inst"
}
]
},
{
"data": [
{
"value": "/results.json",
"name": "path"
},
{
"value": 1,
"name": "feed_id"
},
{
"value": 1,
"name": "plugin_inst_id"
}
],
"href": "http://10.17.24.163:8000/api/v1/files/3/",
"links": [
{
"href": "http://10.17.24.163:8000/api/v1/files/3/results.json",
"rel": "file_resource"
},
{
"href": "http://10.17.24.163:8000/api/v1/1/",
"rel": "feed"
},
{
"href": "http://10.17.24.163:8000/api/v1/plugins/instances/1/",
"rel": "plugin_inst"
}
]
},
{
"data": [
{
"value": "/hits.txt",
"name": "path"
},
{
"value": 1,
"name": "feed_id"
},
{
"value": 1,
"name": "plugin_inst_id"
}
],
"href": "http://10.17.24.163:8000/api/v1/files/4/",
"links": [
{
"href": "http://10.17.24.163:8000/api/v1/files/4/hits.txt",
"rel": "file_resource"
},
{
"href": "http://10.17.24.163:8000/api/v1/1/",
"rel": "feed"
},
{
"href": "http://10.17.24.163:8000/api/v1/plugins/instances/1/",
"rel": "plugin_inst"
}
]
},
{
"data": [
{
"value": "/input.meta.json",
"name": "path"
},
{
"value": 1,
"name": "feed_id"
},
{
"value": 1,
"name": "plugin_inst_id"
}
],
"href": "http://10.17.24.163:8000/api/v1/files/5/",
"links": [
{
"href": "http://10.17.24.163:8000/api/v1/files/5/input.meta.json",
"rel": "file_resource"
},
{
"href": "http://10.17.24.163:8000/api/v1/1/",
"rel": "feed"
},
{
"href": "http://10.17.24.163:8000/api/v1/plugins/instances/1/",
"rel": "plugin_inst"
}
]
}
],
"href": "http://10.17.24.163:8000/api/v1/1/files/",
"version": "1.0",
"links": [
{
"href": "http://10.17.24.163:8000/api/v1/1/",
"rel": "feed"
}
]
}
}
Use httpie to pull an actual file, using an href from the above return:
http -a chris:chris1234 --download http://10.17.24.163:8000/api/v1/files/4/hits.txt
--30--