The cohort function will accept invalid entry events without error, then a confusing error message is shown after calling compile because the collectGuid generic isn't defined when it takes an argument of class logicAttribute (return value of firstOccurrence).
Could we validate the three-dots arguments to entry (and probably attrition too), and give the user an informative error?
@msuchard
library(Capr)
cs1 <- cs(1, name = "testCs")
cohort1 <- cohort(
entry = entry(
drugExposure(cs1),
firstOccurrence() ## invalid entry event, should be an arg to drugExposure not entry
)
)
compile(cohort1)
Error in `purrr::map()`:
ℹ In index: 2.
Caused by error:
! unable to find an inherited method for function 'collectGuid' for signature 'x = "logicAttribute"'
Run `rlang::last_trace()` to see where the error occurred.
>
The
cohortfunction will accept invalid entry events without error, then a confusing error message is shown after callingcompilebecause thecollectGuidgeneric isn't defined when it takes an argument of class logicAttribute (return value offirstOccurrence).Could we validate the three-dots arguments to
entry(and probablyattritiontoo), and give the user an informative error?@msuchard