Thanks a lot for that all. Took awhile to setup, but I got it running using the ServeFolders Plug-in. I was able to relatively easily convert the PHP pages into a single page WebApp where I’m just making an AJAX call to get the data, and then populating a layout defined with plain JS and HTML so that it renders a list of studies pretty much like I had before. Actually pretty easy because I was using an MVC framework before, just replace:
‘. . .’ . $phpparam->name . '
. . . ’ with ‘. . .
. . . ’
The HTML layout and CSS are basically unchanged, just a different way to populate the data.
I’m just using plain JS to populate a template, but something like Vue.JS and axios might be easier and better, or React, but I don’t know that. Using jQuery for now. Looks like you can just using AJAX to make the API calls ? The thing below apparently works with my plug-in. Can you pretty much make all of the REST API calls using AJAX ?
I have a pagination Widget in PHP. Probably not wise to return HTML from the python script, but I might actually try that so that the widget can just be put on the page from the response.
function searchOrthanc() {
var query = {};
query.Level = “Study”; // only Study for /studies/page for now, otherwise tools/find
query.Query = {};
//query.Query.PatientName = “";
query.Query.PatientID = “DEV0000001”;
//query.Query.StudyDate = “”; //e.g. 20150705
//query.Query.ModalitiesInStudy = "”; //e.g. CT, MRI
//query.Query.SpecificCharacterSet = “ISO_IR 192”;
//query.Query.AccessionNumber = “";
//query.Query.StudyDescription = "”;
//query.Query.PatientBirthDate = “”;
//query.Query.PatientSex = “";
query.Expand = true;
query.MetaData = {};
query.MetaData.LastUpdate = "”;
query.pagenumber = 2;
query.itemsperpage =2;
query.sortparam = “AccessionNumber”;
query.reverse = 0;
form = $(“#searchform”);
$.ajax({
url: ‘http://localhost:8042/studies/page’, //. https://sias.dev:8443/studies/page’, works with proxy also.
type: ‘POST’,
dataType: ‘json’,
contentType: ‘application/json; charset=utf-8’,
data: JSON.stringify(query),
beforeSend: function(e) {
$(“#spinner”).css(“display”, “block”);
},
})
.done(function(data, textStatus, jqXHR) {
showStudies(data);
//$(“#studieswrapper”).html(data.paginator + data.html); // for pagination, old code
colorrows($(“#studieswrapper .worklist”));
})
.fail(function( jqXHR, textStatus, errorThrown) {
})
.always(function(jqXHR, textStatus) {
$(“#spinner”).css(“display”, “none”);
});
}
Response is, which is what I what. Might work on a pagination demo now using the ServeFolders. I actually works localhost and with my proxy.
[
{
“count”: 4
},
{
“pagenumber”: 2
},
{
“offset”: 2
},
{
“limit”: 2
},
{
“results”: 2
},
{
“IsStable”: true,
“LastUpdate”: “20200627T183247”,
“PatientMainDicomTags”: {
“PatientBirthDate”: “19571116”,
“PatientSex”: “M”,
“PatientID”: “DEV0000001”,
“PatientName”: “SCOTTI^STEPHEN^D^^”
},
“Series”: [
“e46bfef4-2b166666-468cc957-4b942aa8-3a5c6ef8”
],
“ParentPatient”: “fa21ff2d-33e9b60a-daedf6a0-64d018da-682fd0a4”,
“MainDicomTags”: {
“AccessionNumber”: “DEVACC00000006”,
“StudyDate”: “20190829”,
“StudyDescription”: “XR HIP LT 1 VW”,
“InstitutionName”: “MHealth CSC”,
“ReferringPhysicianName”: “2VASKE^SHANNON^M^^”,
“RequestingPhysician”: “2VASKE^SHANNON^M^^”,
“StudyTime”: “090425”,
“StudyID”: “UC4839619”,
“StudyInstanceUID”: “2.16.840.1.114151.1052214956401694179114379854103077382390190829”
},
“Type”: “Study”,
“ID”: “e8263ed6-56adfc56-a9951260-db8c21f3-c78d7103”,
“Metadata”: {
“LastUpdate”: “20200627T183247”
}
},
{
“IsStable”: true,
“LastUpdate”: “20200627T183258”,
“PatientMainDicomTags”: {
“PatientBirthDate”: “19571116”,
“PatientSex”: “M”,
“PatientID”: “DEV0000001”,
“PatientName”: “SCOTTI^STEPHEN^D^^”
},
“Series”: [
“724c74e6-05cc6cc4-62c9c830-1bfda76c-3a435438”,
“ab78c679-ef037b0a-c267a1cc-dac2dfe7-456d1a3c”,
“8bccacc7-d470b154-446c649d-2f08a482-b18cd25d”
],
“ParentPatient”: “fa21ff2d-33e9b60a-daedf6a0-64d018da-682fd0a4”,
“MainDicomTags”: {
“AccessionNumber”: “DEVACC00000007”,
“StudyDate”: “20190829”,
“StudyDescription”: “XR KNEE RT 3 VW”,
“InstitutionName”: “MHealth CSC”,
“ReferringPhysicianName”: “2VASKE^SHANNON^M^^”,
“RequestingPhysician”: “2VASKE^SHANNON^M^^”,
“StudyTime”: “083425”,
“StudyID”: “UC4839464”,
“StudyInstanceUID”: “2.16.840.1.114151.2411984198229487379168635092719400577270190829”
},
“Type”: “Study”,
“ID”: “86e1a292-07ffb90a-50b2d752-3074f6bd-6895e89a”,
“Metadata”: {
“LastUpdate”: “20200627T183258”
}
}
]
I might have some questions later regarding the Python script I’ve been working on, but not yet. Have something else to work on now.