Closed ablack3 closed 3 months ago
I'm able to fix it in my code with this but I don't think we can use the !! with something like mutate_all or across.
Hi @ablack3 which version of PatientProfiles are you using? for me this works:
library(PatientProfiles)
con <- DBI::dbConnect(duckdb::duckdb(), CDMConnector::eunomia_dir())
cdm <- CDMConnector::cdmFromCon(con = con, cdmSchema = "main", writeSchema = "main")
cdm <- CDMConnector::generateConceptCohortSet(cdm = cdm, conceptSet = list("a" = 4112343), name = "my_cohort")
cdm$my_cohort |>
addConceptIntersectDate(conceptSet = list("b" = 192671, "x" = 35208414), nameStyle = "{value}_{concept_name}") |>
dplyr::select(dplyr::starts_with("date"))
#> # Source: SQL [?? x 2]
#> # Database: DuckDB v0.10.0 [martics@Windows 10 x64:R 4.2.3/C:\Users\martics\AppData\Local\Temp\RtmpiqEMe1\file78101bd83c44.duckdb]
#> date_b date_x
#> <date> <date>
#> 1 2012-05-14 NA
#> 2 2002-01-26 NA
#> 3 2010-05-27 NA
#> 4 1993-01-08 NA
#> 5 1976-01-06 NA
#> 6 2014-02-21 NA
#> 7 1982-09-03 NA
#> 8 1986-09-22 NA
#> 9 1994-02-17 NA
#> 10 1990-10-23 NA
#> # ℹ more rows
Created on 2024-03-24 with reprex v2.1.0
i think this is fixed, please reopen if it is not the case
I'm using addConceptIntersect. When the date is missing it is create a numeric type which is causeing issues in the code. If it is missing it should still be a date type.
to reproduce try creating an example of using addConceptIntersectDate where the date are missing for all rows in the result and makes sure it is a date type. Needs to be checked in all supported databases.