You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This code is taken from the Cohort Definition Examples pdf, but when I try to run it it gives me an error when converting to Json. I found out that it only gives an error when nestedAttribute (such as nestedWithAny) is used
library(Capr)
cs0 <- cs(descendants(313217),
name = "Atrial fibrillation")
ch <- cohort(conditionOccurrence(cs0))
afib <- cs(descendants(313217),
name = "Atrial fibrillation")
ip <- cs(descendants(262, 9201),
name = "Inpatient or inpatient ER visit")
op <- cs(descendants(9202, 9203),
name = "Outpatient or ER visit")
op
ch <- cohort(
entry = entry(
conditionOccurrence(afib,
nestedWithAny(
atLeast(1, visit(ip), duringInterval(eventStarts(-Inf, 0), eventEnds(0, Inf))),
nestedWithAll(
atLeast(1, visit(op, duringInterval(eventStarts(-Inf, 0), eventEnds(0, Inf)),
nestedWithAll(
atLeast(1, conditionOccurrence(afib, duringInterval(eventStarts(7, 365)),
nestedWithAll(
atLeast(1, visit(op, duringInterval(eventStarts(-Inf, 0), eventEnds(0, Inf))))
)
))
)
))
)
)
)
)
)
ch
miCohort <- compile(ch,pretty = TRUE)
outputPath <- fs::path(here::here("cohorts"), "miCohort", ext = "json")
readr::write_file(miCohort, file = outputPath)
result:
> miCohort <- compile(ch,pretty = TRUE)
Error in purrr::map():
ℹ In index: 1.
Caused by error in purrr::map()
ℹ In index: 2.
Caused by error:
! unable to find an inherited method for function collectGuid for signature "nestedAttribute"
Run rlang::last_trace() to see where the error occurred.
The text was updated successfully, but these errors were encountered:
This code is taken from the Cohort Definition Examples pdf, but when I try to run it it gives me an error when converting to Json. I found out that it only gives an error when nestedAttribute (such as nestedWithAny) is used
Sample code available here
code:
result:
The text was updated successfully, but these errors were encountered: