-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
121 lines (86 loc) · 4.19 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
---
output: github_document
editor_options:
chunk_output_type: console
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# shinyshval
<!-- badges: start -->
[![CRAN status](https://www.r-pkg.org/badges/version/shinyshval)](https://CRAN.R-project.org/package=shinyshval)
[![R build status](https://github.com/basf/shinyshval/workflows/R-CMD-check/badge.svg)](https://github.com/basf/shinyshval/actions)
[![Codecov test coverage](https://codecov.io/gh/basf/shinyshval/branch/master/graph/badge.svg)](https://codecov.io/gh/basf/shinyshval?branch=master)
<!-- badges: end -->
The goal of `shinyshval` is to provide a user-friendly shiny-application as interface to [SHVAL tool](https://www.efsa.europa.eu/en/supporting/pub/en-623) developed by EFSA.
It computes shortcut values (SV) as an estimate for the expected oral uptake of plant protection products residues by bees.
`shinyshval`
* wraps original scripts `SHVAL_NoT_v1.1.R` and `SHVAL_TWA_v1.1.R` into functions & a package
* provides sensible default parameters
* adds a significant amount of tests to check for valid results
* provides a user-friendly shiny application as interface.
## Demo
You can fire-up a demo application on binder:
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/basf/shinyshval/binder?urlpath=shiny/inst/app/)
## Installation
You can install the app-package from github via
```{r install, eval = FALSE}
install.packages("remotes")
remotes::install_github("basf/shinyshval")
```
## Starting the app locally
Simply run
```{r run, eval=FALSE}
shinyshval::run_app()
```
## Using the backend
`shinyshval` tries to provide sensible default parameters for the
different scenarious. These have been extracted from the guideline as
good as possible (see `?default_estimates`). Especially for `RUD` values
users are welcome to adapt their needs.
We can compute shval values for default parameters of Honey Bee foragers.
First we retrieve the defaults
```{r defaults}
# retrieve defaults
defaults <- shinyshval::default_estimates(species = "Honey Bee",
stadium = "larvae")
```
Than we estimate the parameters for the default inputs
```{r param}
param <- shinyshval::get_param(raw = NULL, est = defaults)
```
And finally we can simulate the SHVAL values
```{r sim}
shvals <- shinyshval::sim(param)
```
These can than be summarized in different ways
```{r hist}
hist(shvals)
```
```{r summary}
# Mean
mean(shvals)
# 95% CI
quantile(shvals, c(0.025, 0.975))
```
## Quality assurance
In order to ensure consistent results between the `shinyshval` and original EFSA SHVAL tool,
the package is under version control and an extensive set of tests have been implemented using `testthat`.
In short, a total number of 234 continuously integrated tests are run on each code change.
These tests that cover 100% of back-end functionality.
* 156 for the internal functioning of function for the app
* 42 tests comprise of 7 scenarios (6 each) specifically aimed at comparison of results with the original EFSA script
* 45 tests reproducing tables J4-J8 of the guideline
Because of the non-deterministic nature of the computations, comparisons are made with a precision of $1x10^{-1}$ to $1x10^{-2}$.
Reference results form the original script can be found in the `inst/test_reference`for each scenario.
# Disclaimer
`shinyshval` is released with agreement of EFSA under [EUPL-1.2](https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12) open source license.
According to articles 7 and 8 of the [EUPL-1.2](https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12) license EFSA is not responsible for errors, omissions or deficiencies regarding `shinyshval`;
`shinyshval` is being made available as such without any warranty either expressed or implied, including, but not limited to, warranties of performance, merchantability, and fitness for a particular purpose;
In no event shall EFSA be liable for direct, indirect, special, incidental, or consequential damages resulting from the use, misuse, or inability to use `shinyshval`.