Skip to content

Commit

Permalink
fixes cast omop columns as omopgenerics specifies #103
Browse files Browse the repository at this point in the history
  • Loading branch information
ilovemane committed Aug 22, 2024
1 parent f7ed1d0 commit 57e10c3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion R/mockObservationPeriod.R
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ mockObservationPeriod <- function(cdm,
)

observationPeriod <-
observationPeriod |> dplyr::mutate(period_type_concept_id = NA)
observationPeriod |> dplyr::mutate(period_type_concept_id = as.integer(NA))

cdm <-
omopgenerics::insertTable(
Expand Down
12 changes: 6 additions & 6 deletions R/mockPerson.R
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,15 @@ mockPerson <- function(cdm = mockCdmReference(),

person <- dplyr::tibble(
person_id = person_id,
gender_concept_id = gender,
year_of_birth = as.numeric(lubridate::year(dob)),
month_of_birth = as.numeric(lubridate::month(dob)),
day_of_birth = as.numeric(lubridate::day(dob))
gender_concept_id = as.integer(gender),
year_of_birth = as.integer(lubridate::year(dob)),
month_of_birth = as.integer(lubridate::month(dob)),
day_of_birth = as.integer(lubridate::day(dob))
)
person <- person |>
dplyr::mutate(
race_concept_id = NA,
ethnicity_concept_id = NA
race_concept_id = as.integer(NA),
ethnicity_concept_id = as.integer(NA)
)


Expand Down
4 changes: 2 additions & 2 deletions R/mockVisitOccurrence.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ mockVisitOccurrence <- function(cdm,
}

# check if table are empty
if (cdm$person |> nrow() == 0 |
cdm$observation_period |> nrow() == 0 | is.null(cdm$concept)) {
if (cdm$person |> nrow() == 0 ||
cdm$observation_period |> nrow() == 0 || is.null(cdm$concept)) {
cli::cli_abort("person and observation_period table cannot be empty")
}

Expand Down

0 comments on commit 57e10c3

Please sign in to comment.