-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into milanmlft/styling-and-linting
- Loading branch information
Showing
5 changed files
with
2,894 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,4 +18,65 @@ pak::pak("UCLH-Foundry/calypso") | |
|
||
## Development | ||
|
||
* Using the [`{golem}`](https://engineering-shiny.org/golem.html) framework | ||
### Set up | ||
|
||
Make sure you have a [recent version of R](https://cloud.r-project.org/) (>= 4.0.0) installed. | ||
Though not required, [RStudio](https://www.rstudio.com/products/rstudio/download/) is recommended as an IDE, | ||
as it has good support for R package development and Shiny. | ||
|
||
1. Clone this repository | ||
|
||
- Either with `git clone [email protected]:UCLH-Foundry/omop-data-catalogue.git` | ||
- Or by creating [a new project in RStudio from version control](https://docs.posit.co/ide/user/ide/guide/tools/version-control.html#creating-a-new-project-based-on-a-remote-git-or-subversion-repository) | ||
|
||
2. Install [`{renv}`](https://rstudio.github.io/renv/index.html) and restore the project library by running the following from an R console in the project directory: | ||
|
||
```r | ||
install.packages("renv") | ||
renv::restore() | ||
``` | ||
|
||
3. To preview the app locally, run the following from an R console within the project directory: | ||
|
||
```r | ||
golem::run_dev() | ||
``` | ||
|
||
The `dev/02_dev.R` script contains a few helper functions to get you started. | ||
|
||
### Design | ||
|
||
The Shiny app is developed using the [`{golem}`](https://engineering-shiny.org/golem.html) framework. | ||
Among other things, this means that we make heavy use of [Shiny modules](https://mastering-shiny.org/scaling-modules.html). | ||
In brief, a Shiny module is a self-contained, encapsulated piece of Shiny UI and server logic. | ||
In practice, this will often be a particular component of the dashboard. | ||
Note that it is possible to nest modules within other modules, leading to a hierarchical structure. | ||
|
||
The filenames in `R/` follow the [`{golem}` conventions](https://engineering-shiny.org/golem.html#understanding-golem-app-structure): | ||
|
||
* The `app_*.R` files define the UI and server logic for the app itself. | ||
* The `mod_*.R` files define the UI and server logic for the modules. | ||
* Any business logic functions, which are independent from the app's application logic, are defined in the `fct_*.R` files. | ||
An overview of the app's design is given in the diagram below (note that this is subject to change): | ||
|
||
![](./dev/design/omop-data-catalogue-design.png) | ||
|
||
### Coding style | ||
|
||
We'll mainly follow the [tidyverse style guide](https://style.tidyverse.org/). | ||
The [`{styler}`](https://styler.r-lib.org/index.html) package can be used to automatically format R code to this style, | ||
by regularly running | ||
```r | ||
styler::style_pkg() | ||
``` | ||
within the project directory. | ||
It's also recommended to install [`{lintr}`](https://github.com/r-lib/lintr) and regularly run | ||
|
||
```r | ||
lintr::lint_package() | ||
``` | ||
|
||
(or have it [run automatically in your IDE](https://lintr.r-lib.org/articles/editors.html)). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.