Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

concept function #75

Merged
merged 6 commits into from
Apr 11, 2024
Merged

concept function #75

merged 6 commits into from
Apr 11, 2024

Conversation

catalamarti
Copy link
Collaborator

No description provided.

conceptCohortSet <- function(cdm,
conceptSet = NULL,
name = "cohort",
verbose = TRUE) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove this argument, we have removed it from other packages and try to just provide messages that strike a balance (if we want to have options to turn off I think we could do this as a global option for all our packages)

#'
#' @return A cohort_table object.
#'
conceptCohortSet <- function(cdm,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about conceptCohort() for an even shorter name?

#'
conceptCohortSet <- function(cdm,
conceptSet = NULL,
name = "cohort",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should provide a default name or conceptSet and we should always require the user to give us both

cdm <- validateCdm(cdm)
name <- validateName(name)
verbose <- validateVerbose(verbose)
if (length(conceptSet) == 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to figure this out, because current behaviour would give errors for all these below examples (but if we change that we would have to deal with it)

conceptSet<-list()
length(conceptSet)
omopgenerics::newCodelist(conceptSet)

conceptSet<-list("my_empty_cs" = NA)
length(conceptSet)
omopgenerics::newCodelist(conceptSet)

conceptSet<-list("my_non_empty_cs" = c(1,2),
                 "my_empty_cs" = NA)
length(conceptSet)
omopgenerics::newCodelist(conceptSet)

conceptCohortSet <- function(cdm,
conceptSet = NULL,
name = "cohort",
verbose = TRUE) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we not need an end date argument, or would this function only follow one option?

@@ -46,3 +54,23 @@ validateDateRange<-function(dateRange){
}
return(invisible(dateRange))
}

validateName <- function(name) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@catalamarti general comment (not for this pr)- should these validation functions be exported from omopgenerics?

@edward-burn edward-burn merged commit bcf69bf into main Apr 11, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants