I am looking for some input on a method to create a web interface to insert PDFs into studies. There does not seem to be any project anywhere for what I guess would be a Plugin if it were completed to fruition. Please tell me if there is one somewhere. If not I am considering doing a hack and sharing the results with the brave amongst us. So far I have…
- I found the method to insert using command line. Although intriguing I wouldn’t expect anyone to seriously use such a method in the real world. Only the bleary-eyed programmers would even consider it and they don’t run people through doughnuts.
a) Every attempt I tried created a new separate patient entry and put the document into a study under that, which was not where I wanted it. Using Powershell…
$user = ‘admin’
$pass = ‘123456789’
$pair = “$($user):$($pass)”
$encodedCreds = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($pair))
$basicAuthValue = “Basic $encodedCreds”
$Headers = @{
Authorization = $basicAuthValue
}
create the BASE64 string data
$fileInBase64 = $([Convert]::ToBase64String((gc -Path “test.pdf” -Encoding Byte)))
create the json data
$params = @{Tags = @{SeriesDescription = “PDF report”};Content= “data:application/pdf;base64,$fileInBase64”;Parent = “9212fc89-58d0fe17-29b298af-f3bc1888-fc40881e”;}
$ProgressPreference = ‘SilentlyContinue’
$reply = Invoke-RestMethod http://192.168.1.11:8042/tools/create-dicom -Method POST -Body ($params|ConvertTo-Json) -ContentType ‘application/json’ -Headers $Headers
Write-Host “The instance can be retrieved in PDF at http://192.168.1.11:8042$($reply.Path)/pdf”
b) However I was able merge the document into the correct patient where it more or less needed to go using the following.
TARGET ID <---- PDF ID
curl --user admin:123456789 http://localhost:8042/studies/4115fdd2-18bd2765-338f7c22-c6851ef4-0d390ea4/merge -d ‘{“Resources”:[“541f9166-f8718a30-3d02a904-5d898554-d36b67d4”]}’
c) Is there a way to do this with the interface without having to do a merge also? Every attempt I tried failed and created a new patient entry.
- I want to find a method of inserting the pdf using a php interface. There are two logical methods to attempt this. Both would call a php page in Apache to either request the pdf file to be uploaded and merged and/or maybe even interface to a twain scanner. Both would call REST interface and just cram data in using php.
a) METHOD ONE: I want to either modify the interface.html page to add buttons to the patient entries which would pass parameters to call some php to cram data into REST interface. This would be the best looking. But the way the code is written makes it look almost impossible.
b) METHOD TWO: If previous does seems impossible create a simple LAMP interface that pulls from the mysql database directly, gathers up the parameters, and it call php to cram data into REST interface. It wouldn’t be as pretty but it would work. I have done this stuff before.
Any thoughts on either method? You are heavily invested in RESTful interface method which seems to have complicated the results for anyone considering modification. The fact that the web interface is compiled into the executable puts the complexity of changing the code into orbit.
- On a whim to see what I could get away with, I tried moving over the OrthancExplorer directory under Apache. It gives the superficial impression it might work but we know better. The difficulty is finding some way to redirect the javascript code to the correct ip and port so it will pull and push data to the REST interface. As far as I can tell you use the existing web page connection to create this interface to the REST. HOW CAN I REDIRECT THIS? WHAT DO I NEED TO CHANGE? Any chance I have at all of modifying the java script and html code is going depend on this. I did try throwing a few things at it but I am stumped. Otherwise I will just interface directly with mysql which is let’s face it will be rude and crude and low rent.