-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
When you have a multi-layer nested criteria in a cohort definition where the outer nested portion has only one element, you are unable to pull the concept list from the cohort: functions for pulling the list return an empty list instead. This makes it very hard to generate a working JSON.
A temp workaround can be to add an extra line into the outer nest using a dummy cs
atLeast(0, conditionOccurrence(cs(9999999, name = "dummy")))
A working example is below.
## Pass:
x <- cohort(
entry(
conditionOccurrence(cs(1, name = "test"),
nestedWithAll(
atLeast(1, conditionOccurrence(cs(2, name = "test2"))),
atLeast(1, conditionOccurrence(cs(3, name = "test3"),
nestedWithAll(atLeast(1, conditionOccurrence(cs(1, name = "test"))))
))))
)
)
Capr:::listConceptSets(x)
## Fail: returns empty list
x <- cohort(
entry(
conditionOccurrence(cs(1, name = "test"),
nestedWithAll(
# atLeast(1, conditionOccurrence(cs(2, name = "test2"))),
atLeast(1, conditionOccurrence(cs(3, name = "test3"),
nestedWithAll(atLeast(1, conditionOccurrence(cs(1, name = "test"))))
))))
)
)
Capr:::listConceptSets(x)
## Pass:
x <- entry(
conditionOccurrence(cs(1, name = "test"),
nestedWithAll(
# atLeast(1, conditionOccurrence(cs(2, name = "test2"))),
atLeast(1, conditionOccurrence(cs(3, name = "test3"),
nestedWithAll(atLeast(1, conditionOccurrence(cs(1, name = "test"))))
))))
)
Capr:::listConceptSets(x)
## Workaround:
x <- cohort(
entry(
conditionOccurrence(cs(1, name = "test"),
nestedWithAll(
atLeast(0, conditionOccurrence(cs(9999999, name = "dummy"))),
atLeast(1, conditionOccurrence(cs(3, name = "test3"),
nestedWithAll(atLeast(1, conditionOccurrence(cs(1, name = "test"))))
))))
)
)
Capr:::listConceptSets(x)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels