Skip to content

Commit

Permalink
Work on fixing CI
Browse files Browse the repository at this point in the history
  • Loading branch information
stefpiatek committed Aug 28, 2024
1 parent a522ace commit 877162c
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 21 deletions.
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"
6 changes: 4 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Package: omopbundles
Type: Package
Title: Bundles of OMOP Concepts for Ease of Data Selection
Version: 0.1.0
Author: person('Stef', 'Piatek', email = '[email protected]', role = c('cre', 'aut'))
Authors@R: person('Stef', 'Piatek', email = '[email protected]', role = c('cre', 'aut'))
Description: Bundles of OMOP Concepts for Ease of Data Selection
License: Apache License (>= 2)
Encoding: UTF-8
Expand All @@ -14,5 +14,7 @@ Imports:
Suggests:
usethis,
testthat (>= 3.0.0),
lintr
lintr,
pkgload
Config/testthat/edition: 3
RoxygenNote: 7.3.2
9 changes: 8 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
exportPattern("^[[:alpha:]]+")
# Generated by roxygen2: do not edit by hand

export(available_bundles)
export(concept_by_bundle)
importFrom(dplyr,mutate)
importFrom(dplyr,tibble)
importFrom(purrr,map_dfr)
importFrom(readr,read_csv)
7 changes: 4 additions & 3 deletions R/bundles.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,19 @@
#' @export
available_bundles <- function(version = "latest") {
raw_dir <- .get_raw_dir()
directories <- list.dirs(raw_dir, full.names=TRUE)
directories <- list.dirs(raw_dir, full.names = TRUE)
domain_directories <- directories[directories != raw_dir]

purrr::map_dfr(domain_directories, .build_concepts_from_directory)
}

.get_raw_dir <- function(...) {
system.file("data", "raw", ..., package = "omopbundles", mustWork=TRUE)
system.file("data", "raw", ..., package = "omopbundles", mustWork = TRUE)
}

.build_concepts_from_directory <- function(directory) {
concept_files <- list.files(directory)
concept_name <- NULL

dplyr::tibble(
id = concept_files,
Expand All @@ -39,7 +40,7 @@ available_bundles <- function(version = "latest") {
#' @param bundle_row Single row of a dataframe with a domain and id
#' @return Dataframe with a concept_id and domain column
#' @export
concept_by_bundle <- function(bundle_row){
concept_by_bundle <- function(bundle_row) {
stopifnot(is.data.frame(bundle_row))
stopifnot(nrow(bundle_row) == 1)

Expand Down
17 changes: 17 additions & 0 deletions man/concept_by_bundle.Rd

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

12 changes: 0 additions & 12 deletions man/hello.Rd

This file was deleted.

15 changes: 15 additions & 0 deletions renv.lock
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,11 @@
],
"Hash": "b8552d117e1b808b09a832f589b79035"
},
"lintr": {
"Package": "lintr",
"Version": "3.1.2",
"Source": "Repository"
},
"magrittr": {
"Package": "magrittr",
"Version": "2.0.3",
Expand Down Expand Up @@ -207,6 +212,11 @@
],
"Hash": "01f28d4278f15c76cddbea05899c5d6f"
},
"pkgload": {
"Package": "pkgload",
"Version": "1.4.0",
"Source": "Repository"
},
"prettyunits": {
"Package": "prettyunits",
"Version": "1.2.0",
Expand Down Expand Up @@ -290,6 +300,11 @@
],
"Hash": "3eec01f8b1dee337674b2e34ab1f9bc1"
},
"roxygen2": {
"Package": "roxygen2",
"Version": "7.3.2",
"Source": "Repository"
},
"tibble": {
"Package": "tibble",
"Version": "3.2.1",
Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/test-bundles.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ library(omopbundles)
library(testthat)


test_that("available_bundles is not empty",{
test_that("available_bundles is not empty", {
result <- available_bundles()
expect_true(nrow(result) > 0, info = "The dataframe should not be empty")
})

test_that("Smoking exists as an observation",{
test_that("Smoking exists as an observation", {
result <- available_bundles() |>
dplyr::filter(concept_name == "smoking")

Expand All @@ -17,7 +17,7 @@ test_that("Smoking exists as an observation",{
})


test_that("Avilable bundles and concept_by_bundle play nicely together",{
test_that("Avilable bundles and concept_by_bundle play nicely together", {
smoking_bundle <- available_bundles() |>
dplyr::filter(concept_name == "smoking")

Expand Down

0 comments on commit 877162c

Please sign in to comment.