Skip to content

Commit

Permalink
test build
Browse files Browse the repository at this point in the history
  • Loading branch information
andreaczhang committed Jun 28, 2024
1 parent 98c8d86 commit 1419bb0
Show file tree
Hide file tree
Showing 191 changed files with 2,141 additions and 83 deletions.
4 changes: 3 additions & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@
^_pkgdown\.yml$
^docs$
^pkgdown$
dev/*
dev/*
data-raw/*
^\.github$
1 change: 1 addition & 0 deletions .github/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.html
52 changes: 52 additions & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# 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: R-CMD-check

permissions: read-all

jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})

strategy:
fail-fast: false
matrix:
config:
- {os: macos-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v4

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

- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true

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

- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'
61 changes: 61 additions & 0 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# 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: test-coverage

permissions: read-all

jobs:
test-coverage:
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-r-dependencies@v2
with:
extra-packages: any::covr, any::xml2
needs: coverage

- name: Test coverage
run: |
cov <- covr::package_coverage(
quiet = FALSE,
clean = FALSE,
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
)
covr::to_cobertura(cov)
shell: Rscript {0}

- uses: codecov/codecov-action@v4
with:
fail_ci_if_error: ${{ github.event_name != 'pull_request' && true || false }}
file: ./cobertura.xml
plugin: noop
disable_search: true
token: ${{ secrets.CODECOV_TOKEN }}

- name: Show testthat output
if: always()
run: |
## --------------------------------------------------------------------
find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash

- name: Upload test results
if: failure()
uses: actions/upload-artifact@v4
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ URL: https://github.com/andreaczhang/ggehr
BugReports: https://github.com/andreaczhang/ggehr/issues
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
Suggests:
knitr,
rmarkdown,
Expand Down
37 changes: 32 additions & 5 deletions R/data_documentation.R
Original file line number Diff line number Diff line change
@@ -1,11 +1,38 @@
#' Placeholder data x
# antibiotics who----

#' WHO antibiotics list
#'
#' This dataset contains one value, x
#' This dataset contains information on antibiotics from WHO. More details to follow.
#'
#' @format
#' \describe{
#' \item{x}{The placeholder data x}
#' \item{Antibiotic}{Name of the antibiotic}
#' \item{Class}{Antibiotic class}
#' \item{ATC code}{ATC code}
#' \item{Category}{Access, watch or reserve}
#' \item{Listed on EML/EMLc 2023}{Whether listed}
#' \item{color_code}{Color code according to category}
#' }
#' @examples
#' print(x)
"x"
#' head(ab_who)
"ab_who"


# antibiotics ahus ----
#' AHUS antibiotics list
#'
#' This dataset contains information on antibiotics from AHUS. More details to follow.
#'
#' @format
#' \describe{
#' \item{Antibiotic}{Name of the antibiotic}
#' \item{Category}{Access, watch or reserve}
#' \item{Norsk_AHUS}{The Norwegian name, in AHUS hospital system}
#' \item{color_code}{Color code according to category}
#' }
#' @examples
#' head(ab_ahus)
"ab_ahus"



5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@

Visualize data from Electronic Health Records in a intuitive way.

Status: early development
<!-- badges: start -->
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[![R-CMD-check](https://github.com/andreaczhang/ggehr/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/andreaczhang/ggehr/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->
60 changes: 60 additions & 0 deletions data-raw/load_data_ab.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
library(readxl)
library(data.table)


# antibiotics who ----
# this list also has data on the AHUS
# list.files(system.file('extdata', package = 'ggehr'))
#
# fs::path_package('ggehr')
# system.file("extdata", "ab_list_who.xlsx",
# package = "ggehr")
# dir(system.file("extdata", "ab_list_who.xlsx",
# package = "ggehr"))
# getwd()
ablist <- readxl::read_xlsx('./inst/extdata/ab_list_who.xlsx')

# ablist <- readxl::read_xlsx(system.file("extdata", "ab_list_who.xlsx",
# package = "ggehr"))
ablist <- setDT(ablist)
head(ablist)
colnames(ablist)

# code colors
# access: green
# watch: yellow
# reserve: red

ablist[Category == 'Access', color_code := 'green']
ablist[Category == 'Watch', color_code := 'yellow']
ablist[Category == 'Reserve', color_code := 'red']

head(ablist)

# for who, drop the one for ahus
ab_who <- copy(ablist)
ab_who[, Norsk_AHUS := NULL]

# save
save(ab_who, file = 'data/ab_who.rda', compress = 'xz')



# ahus specific ----
# keep the ahus ones
ab_ahus <- ablist[!is.na(Norsk_AHUS), .(Antibiotic, Category, Norsk_AHUS, color_code)]

ab_ahus$Category |> table()
# 21 access, 2 reserve, 16 watch


ab_ahus[Category == 'Reserve']
# Aztreonam, Linezolid (very rare)
ab_ahus[Category == 'Watch']


# save
save(ab_ahus, file = 'data/ab_ahus.rda', compress = 'xz')



Binary file added data/ab_ahus.rda
Binary file not shown.
Binary file added data/ab_who.rda
Binary file not shown.
Binary file removed data/x.rda
Binary file not shown.
2 changes: 1 addition & 1 deletion dev/ab_list_who.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ ablist_who[Category == 'Access', color_code := 'green']
ablist_who[Category == 'Watch', color_code := 'yellow']
ablist_who[Category == 'Reserve', color_code := 'red']


head(ablist_who)


# ahus specific ----
Expand Down
6 changes: 3 additions & 3 deletions docs/404.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions docs/LICENSE-text.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1419bb0

Please sign in to comment.