Skip to content

Commit

Permalink
Merge pull request #420 from BristolMyersSquibb/419-update-links
Browse files Browse the repository at this point in the history
Update doc
  • Loading branch information
DivadNojnarg authored Sep 18, 2024
2 parents f08f106 + 0b586c1 commit e6549b2
Show file tree
Hide file tree
Showing 36 changed files with 1,263 additions and 789 deletions.
3 changes: 2 additions & 1 deletion .lintr
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ linters: linters_with_defaults(
)
exclusions: list(
"inst/examples/cdisc-plot/example.R",
"inst/sandbox"
"inst/sandbox",
"inst/shinylive"
)
12 changes: 7 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Authors@R:
)
Description: A framework for data manipulation and visualization using a
web-based point and click user interface.
URL: https://blockr-org.github.io/blockr, https://blockr-org.github.io/blockr/
URL: https://bristolmyerssquibb.github.io/blockr
License: GPL (>= 3)
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
Expand All @@ -32,7 +32,6 @@ Imports:
bslib,
methods,
DT,
blockr.data,
htmltools,
shinyAce,
jsonlite,
Expand All @@ -42,8 +41,8 @@ Imports:
rlang,
shinyWidgets
Remotes:
blockr-org/blockr.data,
DivadNojnarg/DiagrammeR
DivadNojnarg/DiagrammeR,
BristolMyersSquibb/blockr.data
Suggests:
knitr,
rmarkdown,
Expand All @@ -55,6 +54,9 @@ Suggests:
withr,
ggplot2,
vdiffr,
palmerpenguins
palmerpenguins,
blockr.data
Config/testthat/edition: 3
VignetteBuilder: knitr
Depends:
R (>= 2.10)
2 changes: 0 additions & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ export(cat_logger)
export(clear_workspace)
export(cnd_logger)
export(construct_block)
export(create_app_link)
export(create_block)
export(data_info)
export(download_ui)
Expand Down Expand Up @@ -266,7 +265,6 @@ export(validation_failure)
export(value)
export(values)
export(write_log)
import(blockr.data)
import(dplyr)
import(shiny)
importFrom(htmltools,htmlDependency)
Expand Down
1 change: 0 additions & 1 deletion R/block-core.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#' @param class Block subclass
#'
#' @export
#' @import blockr.data
#' @import dplyr
#' @importFrom stats setNames
new_block <- function(fields, expr, name = rand_names(), ...,
Expand Down
Binary file added R/sysdata.rda
Binary file not shown.
32 changes: 21 additions & 11 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -322,28 +322,25 @@ has_method <- function(x, generic) {

#' Create shinylive iframe
#'
#' @param app_code base64 app code. You can create it from https://shinylive.io/r
#' by writing code and click on share and copy the link. The code is located at
#' the end of the url.
#' Useful for pkgdown website
#'
#' @param url app url. A shinylive link.
#' @param mode How to display the shinylive app. Default to app mode.
#' @param header Whether to display the shinylive header. Default to TRUE.
#'
#' @export
create_app_link <- function(app_code, mode = c("app", "editor"), header = TRUE) {
#' @keywords internal
create_app_link <- function(url, mode = c("app", "editor"), header = TRUE) {
mode <- match.arg(mode)

app_url <- sprintf(
"https://shinylive.io/r/%s/#code=%s", mode, app_code
)
if (mode != "editor") url <- gsub("editor", mode, url)

if (!header) {
app_url <- paste0(app_url, "&h=0")
url <- paste0(url, "&h=0")
}

tags$iframe(
# To allow the content to fill the full screen card
class = "html-fill-item",
src = app_url,
src = url,
height = "700",
width = "100%",
style = "border: 1px solid rgba(0,0,0,0.175); border-radius: .375rem;",
Expand All @@ -353,6 +350,19 @@ create_app_link <- function(app_code, mode = c("app", "editor"), header = TRUE)
)
}

code_chunk <- function(output, language = "r") {
cat(paste0("```", language))
cat(output)
cat("\n```\n")
}

print_shinylive_r_code <- function(name) {
path <- system.file(sprintf("shinylive/apps/%s/app.R", name), package = "blockr")
lines <- readLines(path)
to_remove <- grep("webr::", lines)
code_chunk(cat(paste(lines[-to_remove], collapse = "\n")))
}

get_block_title <- function(x) {
registry <- available_blocks()
block <- registry[sapply(registry, \(blk) {
Expand Down
124 changes: 27 additions & 97 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -28,48 +28,35 @@ library(DiagrammeR)
## Why blockr?

`{blockr}` is an R package designed to democratize data analysis by providing a flexible, intuitive, and __code-free__ approach to building data pipelines. It allows users to create __powerful__ data workflows using pre-built __blocks__ that can be easily __connected__, all without writing a single line of code.

```{r, echo=FALSE, eval=TRUE, message=FALSE}
mermaid("
flowchart TD
subgraph LR workspace[Workspace]
subgraph stack1[Stack]
direction LR
subgraph input_block[Block 1]
input(Data: dataset, browser, ...)
end
subgraph transform_block[Block 2]
transform(Transform block: filter, select ...)
end
subgraph output_block[Block 3]
output(Result/transform: plot, filter, ...)
end
input_block --> |data| transform_block --> |data| output_block
end
subgraph stack2[Stack 2]
stack1_data[Stack 1 data] --> |data| transform2[Transform]
end
stack1 --> |data| stack2
subgraph stackn[Stack n]
stacki_data[Stack i data] --> |data| transformn[Transform] --> |data| Visualize
end
stack2 ---> |... data| stackn
end
",
width = "100%"
) |>
htmlwidgets::onRender(
"function(el, x) {
el.classList.add('text-center')
}
"
)
`{blockr}` is an R package designed to democratize data analysis by providing a flexible, intuitive, and __code-free__ approach to building data pipelines.

## Who is it for?

`{blockr}` has 2 main user targets:

1. On the one hand, it empowers __non technical__ users to create insightful data workflows using pre-built blocks that can be __easily__ connected, all without writing a single line of code.

Below is a simple pre-built case study involving `{blockr}`. We use the palmerpenguins dataset to find out which femal species has the largest flippers. This tiny dashboard is composed of 4 steps: import the data, filter, create the plot and chose the geometry (points). Within each step (block), the user can change inputs and see the changes propagate in real time. Notice that the filter step requires to press a submit button before moving forward, which prevents the plot from appearing first. This is to prevent long running task from being run unecessarily. You can find more in other vignettes.

```{r blockr-penguins-stack, echo=FALSE, fig.cap='Penguins app demo', fig.align = 'center', out.width='100%'}
knitr::include_graphics("vignettes/figures/blockr-penguins-stack.png")
```

You can of course start with a totally empty dashboard and create your own analysis from scratch.

2. On the other hand, it provides __developers__ with a set of tools to seamlessly create new blocks, thereby enhancing the entire framework and fostering __collaboration__ within organizations teams. For instance, regarding the previous example, below is what it takes to create such dashboard.

```{r, results="asis", echo=FALSE, warning=FALSE, comment = ""}
blockr:::print_shinylive_r_code("palmer-penguins")
```

To get started, we invite you to read this [vignette](https://blockr-org.github.io/blockr/articles/blockr.html).
Note that the `{blockr.ggplot2}` [package](https://github.com/BristolMyersSquibb/blockr.ggplot2) exposes some ready to use blocks as shown above.

## How to get started?

To get a better idea of `{blockr}` capabilities in various data context, you can look at this [vignette](https://blockr-org.github.io/blockr/articles/blockr_examples.html).
To get started, we invite you to read this [vignette](https://bristolmyerssquibb.github.io/blockr/articles/blockr.html).

To get a better idea of `{blockr}` capabilities in various data context, you can look at this [vignette](https://bristolmyerssquibb.github.io/blockr/articles/blockr_examples.html).

## Key features

Expand All @@ -84,64 +71,7 @@ To get a better idea of `{blockr}` capabilities in various data context, you can
You can install the development version of blockr from [GitHub](https://github.com/) with:

```r
pak::pak("blockr-org/blockr")
```

## Example: palmer penguins case study

Below is a simple case study involving `{blockr}`. We use the palmerpenguins dataset to find out which
femal species has the largest flippers. We create 2 custom blocks allowing to create our plot block (see the plot vignette for more details). Note that the `{blockr.ggplot2}` package exposes some ready to use blocks.

```{r, eval=FALSE}
library(blockr)
library(palmerpenguins)
library(ggplot2)
new_ggplot_block <- function(col_x = character(), col_y = character(), ...) {
data_cols <- function(data) colnames(data)
new_block(
fields = list(
x = new_select_field(col_x, data_cols, type = "name"),
y = new_select_field(col_y, data_cols, type = "name")
),
expr = quote(
ggplot(mapping = aes(x = .(x), y = .(y)))
),
class = c("ggplot_block", "plot_block"),
...
)
}
new_geompoint_block <- function(color = character(), shape = character(), ...) {
data_cols <- function(data) colnames(data$data)
new_block(
fields = list(
color = new_select_field(color, data_cols, type = "name"),
shape = new_select_field(shape, data_cols, type = "name")
),
expr = quote(
geom_point(aes(color = .(color), shape = .(shape)), size = 2)
),
class = c("plot_layer_block", "plot_block"),
...
)
}
stack <- new_stack(
data_block = new_dataset_block("penguins", "palmerpenguins"),
filter_block = new_filter_block("sex", "female"),
plot_block = new_ggplot_block("flipper_length_mm", "body_mass_g"),
layer_block = new_geompoint_block("species", "species")
)
serve_stack(stack)
```

```{r blockr-penguins-stack, echo=FALSE, fig.cap='Penguins app demo', fig.align = 'center', out.width='100%'}
knitr::include_graphics("vignettes/figures/blockr-penguins-stack.png")
pak::pak("BristolMyersSquibb/blockr")
```

## Contribute
Expand Down
99 changes: 60 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,48 +15,43 @@

`{blockr}` is an R package designed to democratize data analysis by
providing a flexible, intuitive, and **code-free** approach to building
data pipelines. It allows users to create **powerful** data workflows
using pre-built **blocks** that can be easily **connected**, all without
writing a single line of code.
data pipelines.

![](man/figures/README-unnamed-chunk-2-1.png)<!-- -->
## Who is it for?

To get started, we invite you to read this
[vignette](https://blockr-org.github.io/blockr/articles/blockr.html).

To get a better idea of `{blockr}` capabilities in various data context,
you can look at this
[vignette](https://blockr-org.github.io/blockr/articles/blockr_examples.html).
`{blockr}` has 2 main user targets:

## Key features
1. On the one hand, it empowers **non technical** users to create
insightful data workflows using pre-built blocks that can be
**easily** connected, all without writing a single line of code.

1. **User-Friendly Interface**: Build data pipelines with intuitive
interface.
2. **Flexibility**: Easily add, remove, or rearrange blocks in your
pipeline.
3. **Extensibility**: Developers can create custom blocks to extend
functionality.
4. **Reproducibility**: Pipelines created with `blockr` are easily
shareable and reproducible, with exportable code.
5. **Interactivity**: Real-time feedback as you build and modify your
pipeline.
Below is a simple pre-built case study involving `{blockr}`. We use the
palmerpenguins dataset to find out which femal species has the largest
flippers. This tiny dashboard is composed of 4 steps: import the data,
filter, create the plot and chose the geometry (points). Within each
step (block), the user can change inputs and see the changes propagate
in real time. Notice that the filter step requires to press a submit
button before moving forward, which prevents the plot from appearing
first. This is to prevent long running task from being run unecessarily.
You can find more in other vignettes.

## Installation
<div class="figure" style="text-align: center">

You can install the development version of blockr from
[GitHub](https://github.com/) with:
<img src="vignettes/figures/blockr-penguins-stack.png" alt="Penguins app demo" width="100%" />
<p class="caption">
Penguins app demo
</p>

``` r
pak::pak("blockr-org/blockr")
```
</div>

## Example: palmer penguins case study
You can of course start with a totally empty dashboard and create your
own analysis from scratch.

Below is a simple case study involving `{blockr}`. We use the
palmerpenguins dataset to find out which femal species has the largest
flippers. We create 2 custom blocks allowing to create our plot block
(see the plot vignette for more details). Note that the
`{blockr.ggplot2}` package exposes some ready to use blocks.
2. On the other hand, it provides **developers** with a set of tools to
seamlessly create new blocks, thereby enhancing the entire framework
and fostering **collaboration** within organizations teams. For
instance, regarding the previous example, below is what it takes to
create such dashboard.

``` r
library(blockr)
Expand Down Expand Up @@ -106,14 +101,40 @@ stack <- new_stack(
serve_stack(stack)
```

<div class="figure" style="text-align: center">
Note that the `{blockr.ggplot2}`
[package](https://github.com/BristolMyersSquibb/blockr.ggplot2) exposes
some ready to use blocks as shown above.

<img src="vignettes/figures/blockr-penguins-stack.png" alt="Penguins app demo" width="100%" />
<p class="caption">
Penguins app demo
</p>
## How to get started?

</div>
To get started, we invite you to read this
[vignette](https://bristolmyerssquibb.github.io/blockr/articles/blockr.html).

To get a better idea of `{blockr}` capabilities in various data context,
you can look at this
[vignette](https://bristolmyerssquibb.github.io/blockr/articles/blockr_examples.html).

## Key features

1. **User-Friendly Interface**: Build data pipelines with intuitive
interface.
2. **Flexibility**: Easily add, remove, or rearrange blocks in your
pipeline.
3. **Extensibility**: Developers can create custom blocks to extend
functionality.
4. **Reproducibility**: Pipelines created with `blockr` are easily
shareable and reproducible, with exportable code.
5. **Interactivity**: Real-time feedback as you build and modify your
pipeline.

## Installation

You can install the development version of blockr from
[GitHub](https://github.com/) with:

``` r
pak::pak("BristolMyersSquibb/blockr")
```

## Contribute

Expand Down
Loading

0 comments on commit e6549b2

Please sign in to comment.