Skip to content

Commit

Permalink
Merge branch 'main' into remove-date-slider
Browse files Browse the repository at this point in the history
  • Loading branch information
milanmlft authored Aug 14, 2024
2 parents fd7d713 + eaa6363 commit 1351b5d
Show file tree
Hide file tree
Showing 15 changed files with 986 additions and 35 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ $run_dev.*
^.here$
^LICENSE\.md$
^\.github$
^\.lintr$
9 changes: 5 additions & 4 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ jobs:
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check
- uses: r-lib/actions/setup-renv@v2

- name: Install rcmdcheck
run: install.packages("rcmdcheck")
shell: Rscript {0}

- uses: r-lib/actions/check-r-package@v2
with:
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]

name: lint.yaml

permissions: read-all

jobs:
lint:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-renv@v2

- name: Install lintr
run: install.packages("lintr")
shell: Rscript {0}

- name: Lint
run: lintr::lint_package()
shell: Rscript {0}
env:
LINTR_ERROR_ON_LINT: true
86 changes: 86 additions & 0 deletions .github/workflows/pr-commands.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
issue_comment:
types: [created]

name: pr-commands.yaml

permissions: read-all

jobs:
document:
if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') && startsWith(github.event.comment.body, '/document') }}
name: document
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/pr-fetch@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-renv@v2

- name: Install roxygen2
run: install.packages("roxygen2")
shell: Rscript {0}

- name: Document
run: roxygen2::roxygenise()
shell: Rscript {0}

- name: commit
run: |
git config --local user.name "$GITHUB_ACTOR"
git config --local user.email "[email protected]"
git add man/\* NAMESPACE
git commit -m 'Document'
- uses: r-lib/actions/pr-push@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

style:
if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') && startsWith(github.event.comment.body, '/style') }}
name: style
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/pr-fetch@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- uses: r-lib/actions/setup-r@v2

- name: Install dependencies
run: install.packages("styler")
shell: Rscript {0}

- name: Style
run: styler::style_pkg()
shell: Rscript {0}

- name: commit
run: |
git config --local user.name "$GITHUB_ACTOR"
git config --local user.email "[email protected]"
git add \*.R
git commit -m 'Style'
- uses: r-lib/actions/pr-push@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
5 changes: 5 additions & 0 deletions .lintr
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
linters: linters_with_defaults(
line_length_linter(120),
object_name_linter(styles = c("snake_case", "symbols", "camelCase"))
)
encoding: "UTF-8"
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ Suggests:
usethis,
styler,
testthat (>= 3.0.0),
spelling
spelling,
lintr
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.3.2
Expand Down
23 changes: 11 additions & 12 deletions R/app_config.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,17 @@ app_sys <- function(...) {
#'
#' @noRd
get_golem_config <- function(
value,
config = Sys.getenv(
"GOLEM_CONFIG_ACTIVE",
Sys.getenv(
"R_CONFIG_ACTIVE",
"default"
)
),
use_parent = TRUE,
# Modify this if your config file is somewhere else
file = app_sys("golem-config.yml")
) {
value,
config = Sys.getenv(
"GOLEM_CONFIG_ACTIVE",
Sys.getenv(
"R_CONFIG_ACTIVE",
"default"
)
),
use_parent = TRUE,
# Modify this if your config file is somewhere else
file = app_sys("golem-config.yml")) {
config::get(
value = value,
config = config,
Expand Down
3 changes: 1 addition & 2 deletions R/app_server.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
#' @import shiny
#' @noRd
app_server <- function(input, output, session) {

# TODO: to be replaced by real data, which should be reactive so it responds to filtering options
mock_data <- data.frame(
concept_id = c(2212648, 2617206, 2212406),
name = c(
"Blood count; complete (CBC), automated (Hgb, Hct, RBC, WBC and platelet count) and automated differential WBC count",
"Blood count; complete (CBC), automated (Hgb, Hct, RBC, WBC and platelet count) and automated differential WBC count", # nolint
"Prostate specific antigen test (psa)",
"Homocysteine"
),
Expand Down
2 changes: 0 additions & 2 deletions R/mod_daterange.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,5 @@ mod_date_range_ui <- function(id) {
#' @noRd
mod_date_range_server <- function(id) {
moduleServer(id, function(input, output, session) {
ns <- session$ns
})
}

4 changes: 2 additions & 2 deletions R/mod_monthly_count.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#' @noRd
#'
#' @importFrom shiny NS tagList
mod_monthly_count_ui <- function(id){
mod_monthly_count_ui <- function(id) {
ns <- NS(id)
tagList(
plotOutput(ns("monthly_count_plot"), height = 250)
Expand All @@ -23,7 +23,7 @@ mod_monthly_count_server <- function(id) {
# Need to get the input data and filter it based on the selected timeframe and selected row
# see https://stackoverflow.com/a/77039776/11801854
monthly_count <- data.frame(
date = c("2020-01","2020-02", "2020-03", "2020-04"),
date = c("2020-01", "2020-02", "2020-03", "2020-04"),
record_count = c(120, 250, 281, 220)
)
output$monthly_count_plot <- renderPlot({
Expand Down
11 changes: 5 additions & 6 deletions R/run_app.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@
#' @importFrom shiny shinyApp
#' @importFrom golem with_golem_options
run_app <- function(
onStart = NULL,
options = list(),
enableBookmarking = NULL,
uiPattern = "/",
...
) {
onStart = NULL,
options = list(),
enableBookmarking = NULL,
uiPattern = "/",
...) {
with_golem_options(
app = shinyApp(
ui = app_ui,
Expand Down
Loading

0 comments on commit 1351b5d

Please sign in to comment.