Skip to content

Commit

Permalink
Merge pull request #211 from OHDSI/mah_collectTables
Browse files Browse the repository at this point in the history
Conduct analyses in the db side
  • Loading branch information
martaalcalde authored Oct 21, 2024
2 parents d237b73 + 588ed54 commit 5749f1a
Show file tree
Hide file tree
Showing 13 changed files with 13 additions and 564 deletions.
10 changes: 5 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,19 @@ Suggests:
rmarkdown,
RPostgres,
testthat (>= 3.0.0),
withr
withr,
omock (>= 0.3.0)
Config/testthat/edition: 3
Config/testthat/parallel: true
Imports:
CDMConnector (>= 1.3.0),
cli,
clock,
CohortCharacteristics (>= 0.3.0),
CohortConstructor (>= 0.3.1),
dplyr,
ggplot2,
omock (>= 0.3.0),
omopgenerics (>= 0.3.1),
PatientProfiles (>= 1.2.0),
PatientProfiles (>= 1.2.0.900),
purrr,
rlang,
stringr,
Expand All @@ -71,4 +70,5 @@ URL: https://OHDSI.github.io/OmopSketch/
BugReports: https://github.com/OHDSI/OmopSketch/issues
VignetteBuilder: knitr
Remotes:
darwin-eu-dev/omopgenerics@mah_vl
darwin-eu-dev/omopgenerics@mah_vl,
darwin-eu-dev/PatientProfiles@issue_705
2 changes: 0 additions & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@ export(summariseConceptCounts)
export(summariseInObservation)
export(summariseObservationPeriod)
export(summariseOmopSnapshot)
export(summarisePopulationCharacteristics)
export(summariseRecordCount)
export(suppress)
export(tableClinicalRecords)
export(tableObservationPeriod)
export(tableOmopSnapshot)
export(tablePopulationCharacteristics)
importFrom(dplyr,"%>%")
importFrom(omopgenerics,bind)
importFrom(omopgenerics,exportSummarisedResult)
Expand Down
6 changes: 3 additions & 3 deletions R/summariseClinicalRecords.R
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ getNumberPeopleInCdm <- function(cdm, strata, peopleStrata){
peopleStrata |>
dplyr::select(-c("observation_period_start_date","observation_period_end_date")) |>
dplyr::inner_join(cdm[["person"]] |> dplyr::select("person_id"), by = "person_id") |>
dplyr::collect() |> # https://github.com/darwin-eu-dev/PatientProfiles/issues/706
# dplyr::collect() |> # https://github.com/darwin-eu-dev/PatientProfiles/issues/706
PatientProfiles::summariseResult(strata = strata,
includeOverallStrata = TRUE,
counts = TRUE,
Expand All @@ -240,7 +240,7 @@ addCounts <- function(result, strata, omopTable){
rbind(
omopTable |>
dplyr::select("person_id", dplyr::any_of(c("age_group","sex"))) |>
dplyr::collect() |> # https://github.com/darwin-eu-dev/PatientProfiles/issues/706
# dplyr::collect() |> # https://github.com/darwin-eu-dev/PatientProfiles/issues/706
PatientProfiles::summariseResult(strata = strata,
includeOverallStrata = TRUE,
counts = TRUE,
Expand Down Expand Up @@ -291,7 +291,7 @@ addRecordsPerPerson <- function(result, omopTable, recordsPerPerson, cdm, people
.data$records_per_person
)) |>
dplyr::distinct() |>
dplyr::collect() |> # https://github.com/darwin-eu-dev/PatientProfiles/issues/706
# dplyr::collect() |> # https://github.com/darwin-eu-dev/PatientProfiles/issues/706
PatientProfiles::summariseResult(
strata = strata,
includeOverallStrata = TRUE,
Expand Down
2 changes: 1 addition & 1 deletion R/summariseConceptCounts.R
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ getCodeUse <- function(x,
if(!"number subjects" %in% c(countBy)){records <- records |> dplyr::select(-"person_id")}

cc <- records |>
dplyr::collect() |> # https://github.com/darwin-eu-dev/PatientProfiles/issues/706
# dplyr::collect() |> # https://github.com/darwin-eu-dev/PatientProfiles/issues/706
PatientProfiles::summariseResult(strata = strata,
variable = "standard_concept_name",
group = "standard_concept_id",
Expand Down
6 changes: 3 additions & 3 deletions R/summariseObservationPeriod.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ summariseObservationPeriod <- function(observationPeriod,

if (omopgenerics::isTableEmpty(observationPeriod)) {
obsSr <- observationPeriod |>
dplyr::collect() |> # https://github.com/darwin-eu-dev/PatientProfiles/issues/706
# dplyr::collect() |> # https://github.com/darwin-eu-dev/PatientProfiles/issues/706
PatientProfiles::summariseResult(
variables = NULL, estimates = NULL, counts = TRUE)
} else {
Expand All @@ -74,7 +74,7 @@ summariseObservationPeriod <- function(observationPeriod,
dplyr::collect()

obsSr <- obs |>
dplyr::collect() |> # https://github.com/darwin-eu-dev/PatientProfiles/issues/706
# dplyr::collect() |> # https://github.com/darwin-eu-dev/PatientProfiles/issues/706
PatientProfiles::summariseResult(
strata = strataId,
variables = c("duration", "next_obs"),
Expand All @@ -86,7 +86,7 @@ summariseObservationPeriod <- function(observationPeriod,
dplyr::group_by(.data$person_id, dplyr::across(dplyr::any_of(c("sex","age_group")))) |>
dplyr::tally(name = "n") |>
dplyr::ungroup() |>
dplyr::collect() |> # https://github.com/darwin-eu-dev/PatientProfiles/issues/706
# dplyr::collect() |> # https://github.com/darwin-eu-dev/PatientProfiles/issues/706
PatientProfiles::summariseResult(
variables = c("n"),
estimates = estimates,
Expand Down
82 changes: 0 additions & 82 deletions R/summarisePopulationCharacteristics.R

This file was deleted.

2 changes: 1 addition & 1 deletion R/summariseRecordCount.R
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ createSummarisedResultRecordCount <- function(result, strata, omopTable, omopTab
result <- result |>
dplyr::mutate(n = 1) |>
dplyr::select(-"person_id") |>
dplyr::collect() |> # https://github.com/darwin-eu-dev/PatientProfiles/issues/706
# dplyr::collect() |> # https://github.com/darwin-eu-dev/PatientProfiles/issues/706
PatientProfiles::summariseResult(
variables = "n",
strata = strata,
Expand Down
57 changes: 0 additions & 57 deletions R/tablePopulationCharacteristics.R

This file was deleted.

5 changes: 0 additions & 5 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ reference:
- contents:
- summariseConceptCounts
- plotConceptCounts
- subtitle: Individual Characteristics
desc: Summarise characteristics of the individuals in the OMOP Common Data Model
- contents:
- summarisePopulationCharacteristics
- tablePopulationCharacteristics
- subtitle: Mock Database
desc: Create a mock database to test the OmopSketch package
- contents:
Expand Down
48 changes: 0 additions & 48 deletions man/summarisePopulationCharacteristics.Rd

This file was deleted.

37 changes: 0 additions & 37 deletions man/tablePopulationCharacteristics.Rd

This file was deleted.

Loading

0 comments on commit 5749f1a

Please sign in to comment.