Skip to content

Validation and informative error messages for entry and attrition events #130

Description

@ob325

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.
> 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions