Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add flow diagram #9

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 22 additions & 0 deletions analysis/csv/Sex differences survey OLD_November 4, 2019_15.32.csv

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions protocol/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.qualtrics.yml
28 changes: 28 additions & 0 deletions protocol/master-protocol.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,34 @@ The process of scheduling participants involves the following steps:

# Data processing

The following diagram depicts the post-study data processing workflow.

```{r}
library(DiagrammeR)

DiagrammeR::grViz("digraph {
graph [layout = dot, rankdir = LR]

# define the global styles of the nodes. We can override these in box if we wish
node [shape = rectangle, style = filled, fillcolor = Linen]

murray [label = 'Murray', shape = folder, fillcolor = Beige]
abramov [label = 'Abramov', shape = folder, fillcolor = Beige]
survey [label = 'Qualtrics']
test_computer [label = 'Task\ncomputer']
survey_computer [label ='Survey\ncomputer']
other_computer [label = 'Unspecified\ncomputer']
flash_drive [label='Flash\ndrive']
unspecified_process [label='TBD']
box [label = 'Box.com' fillcolor = White]
qualtrics_server [label = 'Qualtrics\nServer' fillcolor = White]

# edge definitions with the node IDs
{murray abramov} -> test_computer -> flash_drive -> other_computer -> box
survey -> survey_computer -> qualtrics_server -> unspecified_process -> box
}")
```

## Gathering

### Retrieve Behavioral Data
Expand Down
33 changes: 32 additions & 1 deletion protocol/master-protocol.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
<script src="master-protocol_files/navigation-1.1/codefolding.js"></script>
<link href="master-protocol_files/highlightjs-9.12.0/default.css" rel="stylesheet" />
<script src="master-protocol_files/highlightjs-9.12.0/highlight.js"></script>
<script src="master-protocol_files/htmlwidgets-1.3/htmlwidgets.js"></script>
<script src="master-protocol_files/viz-0.3/viz.js"></script>
<link href="master-protocol_files/DiagrammeR-styles-0.2/styles.css" rel="stylesheet" />
<script src="master-protocol_files/grViz-binding-1.0.1/grViz.js"></script>

<style type="text/css">code{white-space: pre;}</style>
<style type="text/css">
Expand Down Expand Up @@ -261,7 +265,8 @@

<h1 class="title toc-ignore">Individual differences in visual perception in adults</h1>
<h4 class="author">Rick Gilmore, Yiming Qian, &amp; Andrea Seisler</h4>
<h4 class="date">2019-11-06 08:29:56</h4>
<h4 class="date">2019-11-06 10:06:04</h4>


</div>

Expand Down Expand Up @@ -938,6 +943,32 @@ <h3>Clean-up</h3>
</div>
<div id="data-processing" class="section level1">
<h1>Data processing</h1>
<p>The following diagram depicts the post-study data processing workflow.</p>
<pre class="r"><code>library(DiagrammeR)

DiagrammeR::grViz(&quot;digraph {
graph [layout = dot, rankdir = LR]

# define the global styles of the nodes. We can override these in box if we wish
node [shape = rectangle, style = filled, fillcolor = Linen]

murray [label = &#39;Murray&#39;, shape = folder, fillcolor = Beige]
abramov [label = &#39;Abramov&#39;, shape = folder, fillcolor = Beige]
survey [label = &#39;Qualtrics&#39;]
test_computer [label = &#39;Task\ncomputer&#39;]
survey_computer [label =&#39;Survey\ncomputer&#39;]
other_computer [label = &#39;Unspecified\ncomputer&#39;]
flash_drive [label=&#39;Flash\ndrive&#39;]
unspecified_process [label=&#39;TBD&#39;]
box [label = &#39;Box.com&#39; fillcolor = White]
qualtrics_server [label = &#39;Qualtrics\nServer&#39; fillcolor = White]

# edge definitions with the node IDs
{murray abramov} -&gt; test_computer -&gt; flash_drive -&gt; other_computer -&gt; box
survey -&gt; survey_computer -&gt; qualtrics_server -&gt; unspecified_process -&gt; box
}&quot;)</code></pre>
<div id="htmlwidget-46a250b15bbc3050180a" style="width:672px;height:480px;" class="grViz html-widget"></div>
<script type="application/json" data-for="htmlwidget-46a250b15bbc3050180a">{"x":{"diagram":"digraph {\ngraph [layout = dot, rankdir = LR]\n\n# define the global styles of the nodes. We can override these in box if we wish\nnode [shape = rectangle, style = filled, fillcolor = Linen]\n\nmurray [label = \"Murray\", shape = folder, fillcolor = Beige]\nabramov [label = \"Abramov\", shape = folder, fillcolor = Beige]\nsurvey [label = \"Qualtrics\"]\ntest_computer [label = \"Task\ncomputer\"]\nsurvey_computer [label =\"Survey\ncomputer\"]\nother_computer [label = \"Unspecified\ncomputer\"]\nflash_drive [label=\"Flash\ndrive\"]\nunspecified_process [label=\"TBD\"]\nbox [label = \"Box.com\" fillcolor = White]\nqualtrics_server [label = \"Qualtrics\nServer\" fillcolor = White]\n\n# edge definitions with the node IDs\n{murray abramov} -> test_computer -> flash_drive -> other_computer -> box\nsurvey -> survey_computer -> qualtrics_server -> unspecified_process -> box\n}","config":{"engine":"dot","options":null}},"evals":[],"jsHooks":[]}</script>
<div id="gathering" class="section level2">
<h2>Gathering</h2>
<div id="retrieve-behavioral-data" class="section level3">
Expand Down
14 changes: 14 additions & 0 deletions protocol/master-protocol_files/DiagrammeR-styles-0.2/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.DiagrammeR,.grViz pre {
white-space: pre-wrap; /* CSS 3 */
white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
word-wrap: break-word; /* Internet Explorer 5.5+ */
}

.DiagrammeR g .label {
font-family: Helvetica;
font-size: 14px;
color: #333333;
}

71 changes: 71 additions & 0 deletions protocol/master-protocol_files/grViz-binding-1.0.1/grViz.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
HTMLWidgets.widget({

name: 'grViz',

type: 'output',

initialize: function(el, width, height) {

return {
// TODO: add instance fields as required
}

},

renderValue: function(el, x, instance) {
// use this to sort of make our diagram responsive
// or at a minimum fit within the bounds set by htmlwidgets
// for the parent container
function makeResponsive(el){
var svg = el.getElementsByTagName("svg")[0];
if(svg){
if(svg.width) {svg.removeAttribute("width")};
if(svg.height) {svg.removeAttribute("height")};
svg.style.width = "100%";
svg.style.height = "100%";
}
};

if ( x.diagram != "" ) {

if ( typeof x.config === "undefined" ){
x.config = {};
x.config.engine = "dot";
x.config.options = {};
}

try {
el.innerHTML = Viz( x.diagram, format="svg", engine=x.config.engine, options=x.config.options );

makeResponsive(el);

// set up a container for tasks to perform after completion
// one example would be add callbacks for event handling
// styling
if (!(typeof x.tasks === "undefined") ){
if ( (typeof x.tasks.length === "undefined") ||
(typeof x.tasks === "function" ) ) {
// handle a function not enclosed in array
// should be able to remove once using jsonlite
x.tasks = [x.tasks];
}
x.tasks.map(function(t){
// for each tasks add it to the mermaid.tasks with el
t.call(el);
})
}
} catch(e){
var p = document.createElement("pre")
p.innerText = e;
el.appendChild(p);
}
}

},

resize: function(el, width, height, instance) {

}


});