Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
^.*\.Rproj$
^\.Rproj\.user$
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ vignettes/*.pdf

# Shiny token, see https://shiny.rstudio.com/articles/shinyapps.html
rsconnect/
.Rproj.user
13 changes: 13 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Package: ReDish
Title: Create an interactive graphic for the Evaluation of Drug-Induced Serious Hepatotoxicity (eDISH).
Version: 0.0.1
Authors@R: c(
person("Becca", "Krouse", email = "rebecca_krouse@rhoworld.com", role = c("cre","aut")),
person("Jeremy", "Wildfire", role = "aut"),
person("Rho Inc.", role = "cph"))
Description: Description: An R interface for the 'safety-eDISH' 'JavaScript' charting library, which provides an interactive framework for evaluating drug-induced serious hepatotoxicity.
Depends: R (>= 3.4.0)
License: MIT + File LICENSE
Encoding: UTF-8
LazyData: true
RoxygenNote: 6.1.0
23 changes: 2 additions & 21 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,21 +1,2 @@
MIT License

Copyright (c) 2018 ASA-DIA-InteractiveSafetyGraphics

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
YEAR: 2018
COPYRIGHT HOLDER: Rho Inc.
6 changes: 6 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Generated by roxygen2: do not edit by hand

export(eDISH)
export(eDISHOutput)
export(renderEDISH)
import(htmlwidgets)
54 changes: 54 additions & 0 deletions R/eDISH.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#' Create an eDISH widget
#'
#' This function creates an interactive graphic for the Evaluation of Drug-Induced Serious Hepatotoxicity (eDISH)
#'
#' @param data A data frame containing the labs data. Data must be structured as one record per study participant per time point per lab measure.
#'
#' @import htmlwidgets
#'
#' @export
eDISH <- function(data) {

# forward options using x
rSettings = list(
data = data
)

# create widget
htmlwidgets::createWidget(
name = 'eDISH',
rSettings,
# width = width,
# height = height,
package = 'ReDish' #,
# sizingPolicy = htmlwidgets::sizingPolicy(viewer.fill=FALSE)
)
}

#' Shiny bindings for eDISH
#'
#' Output and render functions for using eDISH within Shiny
#' applications and interactive Rmd documents.
#'
#' @param outputId output variable to read from
#' @param width,height Must be a valid CSS unit (like \code{'100\%'},
#' \code{'400px'}, \code{'auto'}) or a number, which will be coerced to a
#' string and have \code{'px'} appended.
#' @param expr An expression that generates a eDISH
#' @param env The environment in which to evaluate \code{expr}.
#' @param quoted Is \code{expr} a quoted expression (with \code{quote()})? This
#' is useful if you want to save an expression in a variable.
#'
#' @name eDISH-shiny
#'
#' @export
eDISHOutput <- function(outputId, width = '100%', height = '400px'){
htmlwidgets::shinyWidgetOutput(outputId, 'eDISH', width, height, package = 'ReDish')
}

#' @rdname eDISH-shiny
#' @export
renderEDISH <- function(expr, env = parent.frame(), quoted = FALSE) {
if (!quoted) { expr <- substitute(expr) } # force quoted
htmlwidgets::shinyRenderWidget(expr, eDISHOutput, env, quoted = TRUE)
}
17 changes: 17 additions & 0 deletions ReDish.Rproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Version: 1.0

RestoreWorkspace: Default
SaveWorkspace: Default
AlwaysSaveHistory: Default

EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
Encoding: UTF-8

RnwWeave: knitr
LaTeX: pdfLaTeX

BuildType: Package
PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source
10,289 changes: 10,289 additions & 0 deletions data-raw/adlbc.csv

Large diffs are not rendered by default.

Binary file added data/adlbc.rda
Binary file not shown.
72 changes: 72 additions & 0 deletions inst/htmlwidgets/eDISH.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
HTMLWidgets.widget({

name: 'eDISH',

type: 'output',

factory: function(el, width, height) {

// TODO: define shared variables for this instance

return {

renderValue: function(rSettings) {


el.innerHTML = "<div class='edish'></div>";

let settings = {
max_width: 600,
value_col: 'AVAL',
measure_col: 'PARAM',
visitn_col: 'VISITNUM',
studyday_col: 'ADY',
normal_col_low: 'A1LO',
normal_col_high: 'A1HI',
id_col: 'USUBJID',
group_cols: ['TRTA','RACE','AGEGR1'],
filters: [
{
value_col: 'TRTA',
label: 'Treatment'
},
{
value_col: 'SEX',
label: 'Sex'
},
{
value_col: 'RACE',
label: 'Race'
},
{
value_col: 'AGEGR1',
label: 'Age group'
},
],
measure_values:{
'ALT':'Alanine Aminotransferase (U/L)',
'AST':'Aspartate Aminotransferase (U/L)',
'TB':'Bilirubin (umol/L)',
'ALP':'Alkaline Phosphatase (U/L)'
}
};

rSettings.data = HTMLWidgets.dataframeToD3(rSettings.data);


console.log(settings);
console.log(rSettings);

safetyedish('.edish', settings).init(rSettings.data);

},

resize: function(width, height) {

// TODO: code to re-render the widget with a new size

}

};
}
});
15 changes: 15 additions & 0 deletions inst/htmlwidgets/eDISH.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
dependencies:
- name: d3
version: 3.5.17
src: htmlwidgets/lib/d3-3.5.17
script: d3.v3.min.js
- name: webcharts
version: 1.10.0
src: htmlwidgets/lib/webcharts-1.10.0
script: webcharts.js
stylesheet: webcharts.css
- name: safety-eDish
version: 0.12.1
src: htmlwidgets/lib/safety-eDISH-0.12.1
script: safetyedish.js

26 changes: 26 additions & 0 deletions inst/htmlwidgets/lib/d3-3.5.17/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Copyright (c) 2010-2016, Michael Bostock
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

* The name Michael Bostock may not be used to endorse or promote products
derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL MICHAEL BOSTOCK BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5 changes: 5 additions & 0 deletions inst/htmlwidgets/lib/d3-3.5.17/d3.v3.min.js

Large diffs are not rendered by default.

Loading