jtextor / dagitty

Graphical analysis of structural causal models / graphical causal models.
GNU General Public License v2.0
286 stars 46 forks source link

Read a DAG from a URL parameter #17

Open seannyD opened 6 years ago

seannyD commented 6 years ago

I'm developing a database of causal hypotheses. I'd like the user to be able to export some of the DAGs in my database into dagitty. I couldn't find an easy way to import a file, without creating a DAG on your server first. If there's already a way to do this, that's great! If not, I've suggested adding some code to allow a user to pass data from a URL parameter into the adj_matrix text box, then reload the DAG. This will allow me to add a link on my website for the user to open the DAG in dagitty, e.g.:

http://www.dagitty.net/dags.html?adjmatrix=B%201%20@1.400,-1.460%0AD%20O%20@1.400,1.621%0A%0AB%20D

I'm not a security expert, so if this is a bad idea because it will allow arbitrary injection, please ignore this suggestion.

I've tested the addition to main.js, and it seems to work. I guessed where the call should go in the dags.html, but have not tested this. Note that the function loadDagFromUrlParameter() does nothing if it doesn't find a URL parameter named adjmatrix.

seannyD commented 6 years ago

Gentle bump on this. My database is now live http://chield.excd.org/. I'm presenting it at a workshop soon, and it would be great if this functionality could be added!