7

I have a running shiny app that displays some output-metrics on screen in response to purely on-screen UI inputs (no files to be read etc.) I can host it on shinyapps.io to make it accessible remotely 24x7.

A programmer working on another application (non-R, residing on a remote server) wants to access my shiny app to get my output-metrics into his code. What's a good way to do this?

On the input side, with bookmark-able state via the calling url it looks like I can get all inputs from the calling app.

What I haven't figured out is any way to send back outputs to the calling app with the current shiny framework. What I currently show on screen I want to be able to send back to the calling app.

Any ideas?

PS. There's rumors that some native functionality to provide this use-case is coming to shiny but there's nothing yet and I'm impatient to finish this project.

curious_cat
  • 805
  • 2
  • 9
  • 24
  • 1) I had a similar request from a customer a while back, where we just decided to save the output in a text file, which is updated on every input change. The path to the file you could save in an input variable. So he could read the path from your URL which can then be used to read the text file. 2) I am not really sure I get how you plan to access the shiny app from another application and read the "bookmark-url", but it looks like you figured that out already :) – Tonio Liebrand Jan 31 '17 at 08:30
  • @TonioLiebrand Thanks! No, I'd love any tips on the input aspect too. My idea was this: I have hosted the app online on shinyapps.io and I can access it using a link & prepopulate inputs via the url like so: https://foo.shinyapps.io/appname/?_inputs_&anaes_charges=0&comorbidity=%7B%7D&dias_BP=333 I was assuming I could ask the calling app to craft a suitable url and thence call my app. – curious_cat Jan 31 '17 at 11:38
  • @TonioLiebrand Would it work, you think? – curious_cat Jan 31 '17 at 11:39
  • @TonioLiebrand I love your remote file write idea! I will try that out. – curious_cat Jan 31 '17 at 11:41
  • If you're making a large scale application(s) why not connect to the database where all your apps can have CRUD operations and talk to one another? There is a lot of support for `MySQL` – Pork Chop Jan 31 '17 at 16:01
  • @PorkChop No actually there's only one other app (so far) that's asking to use the results of this app. Lightweight would be better. Not a huge project. So don't want to use a cannon to kill a mouse. :) – curious_cat Jan 31 '17 at 16:22
  • ok, then assign the result of this app with a global assignment operator? using `<<-` – Pork Chop Jan 31 '17 at 16:23
  • @PorkChop Thanks. But the calling app is non-R & on a remote server. So the passing mechanism would have to involve the internet somehow. – curious_cat Jan 31 '17 at 16:34
  • 1
    Have a look at this example http://stackoverflow.com/questions/25297489/accept-http-request-in-r-shiny-application – Pork Chop Jan 31 '17 at 16:37

0 Answers0