crtahlin / medplot

Functions for drawing graphs in R visualizing medical information.
4 stars 2 forks source link

Lasagna plots - load them as R objects #99

Open crtahlin opened 10 years ago

crtahlin commented 10 years ago

Lasagna plots currently get saved to disk and then loaded in shiny.

This is OK for one user on a secure computer, but not otherwise.

Look into how we could load them into "memory" (into R object) and not have thme on disk. The loaded binary string would than have to be in the HTML <img> tag. See other graphs for example, nut roughly something like: <img src="data:image/png;base64,assdflkjsd tralalala" width="1015" height="700">

llaarraa commented 10 years ago

Fast and dirty solution: They could be saved with a name that is unique to the user, for example attaching to their name a string as format(Sys.time(), "%a %b %d %H:%M:%S %Y") in this way in a shared access there would be no danger of reusing the same files.

crtahlin commented 10 years ago

There is actually a function in base that generates random file names called tempfile() and guarantees their uniqueness. I have considered and tested its use but have decided we do not gain enough by its use. Because by using it, we would generate a different file set for each iteration of Lasagna plotting, which would eventualy fill up the hard drive if the files are not deleted. But when would we delete the files? If immediately after generation and showing on screen, we could run into problems if the user tries to download the files (although the browser might cache the files,I am not sure). I could not think of an appropriate time to delete them and have concluded that the option above is neccessary in the long run.

crtahlin commented 10 years ago

I have redone the plots as described in #102. I think this solution suffices security wise for now and it also covers multiple users. Will close this issue.

llaarraa commented 10 years ago

cosmetic issue - low priority: can you (easily) change the colors in the binary lasagna plots (blue=0, red=1, in general it might make more sense to have a "warning-color" for the presence of the condition, usually coded with 1) -- and would be more consistent with the color coding used for the numerical variables

llaarraa commented 10 years ago

Error: argument is of length zero is displayed at the end of the page (lasagna/binary)