-
Notifications
You must be signed in to change notification settings - Fork 4
Description
Describe the bug
I have a study in mind where I have to run treatment patterns for 3 different target cohorts for the same 4 cohort events. When I tried running this in one go it would freeze during Collapsing eras step. When I ran them individually they ran with no issue.
Is the package intended to be used like this in the first place, and is it best practice to run them separately or can we run multiple targets?
If you can run multiple targets at once I might of found a weird behavior when stepping through your code. It seems like andromeda$cohortTable is producing duplicate rows which than is causing an issue when we try to collapse the eras.
When I ran with multiple target cohorts the variable rows you define in the doEraCollapse function gets many collisions but when I run them individually the rows is 0. This could be due to the duplicate rows being produced when handling multiple targets.
To Reproduce
Here is a provided example:
tpTargetCohorts <- tibble::tibble(
cohortId = c(3, 4),
cohortName = c("GiBleed", "NSAIDs")
) %>% dplyr::mutate(type="target")
tpEventCohorts <- tibble::tibble(
cohortId = c(1,2),
cohortName = c("Celecoxib", "Diclofenac")
) %>% dplyr::mutate(type="event")
tpExitCohorts <- tibble::tibble(
cohortId = double(),
cohortName = character()
) %>% dplyr::mutate(type="exit")
tpModuleSpecifications <- tpModuleSettingsCreator$createModuleSpecifications(
cohorts = treatmentPatternsCohorts,
startAnchor = "startDate",
windowStart = 0,
endAnchor = "endDate",
windowEnd = 0,
minEraDuration = 0,
splitEventCohorts = NULL,
splitTime = NULL,
eraCollapseSize = 14,
combinationWindow = 0,
minPostCombinationDuration = 0,
filterTreatments = "Changes",
maxPathLength = 7
)
I know this makes no sense with NSAIDs being a target but I was trying to use Eunomia to show you the issue.
Expected behavior
I was hopping when I run this I will see the treatment progressions for each target cohort in 1 output csv file.
Screenshots
I am hoping this image helps but I tired to show the duplicate rows in the andromeda$cohortTable. When I forked and tried to force only unique rows it ran through but results did not match.