-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle leap year birthdays in demographicsCohort #171
Labels
Comments
This was one subject born on the 29th of February ahhaha library(CDMConnector)
library(CodelistGenerator)
library(PatientProfiles)
library(CohortConstructor)
#>
#> Attaching package: 'CohortConstructor'
#> The following objects are masked from 'package:CDMConnector':
#>
#> intersectCohorts, unionCohorts
library(dplyr)
#> Warning: package 'dplyr' was built under R version 4.2.3
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
con <- DBI::dbConnect(duckdb::duckdb(),
dbdir = eunomia_dir())
cdm <- cdm_from_con(con, cdm_schema = "main",
write_schema = c(prefix = "my_study_", schema = "main"))
cdm$working_age_cohort <- demographicsCohort(cdm = cdm,
ageRange = c(18, 65),
name = "working_age_cohort")
#> ℹ Building new trimmed cohort
#> Adding birth date
#> Creating initial cohort
#> Trim age
#> ✔ Cohort trimmed
cdm$working_age_cohort |>
addAge(indexDate = "cohort_start_date") |>
summarise(min_start_age = min(age),
median_start_age = median(age),
max_start_age = max(age))
#> Warning: Missing values are always removed in SQL aggregation functions.
#> Use `na.rm = TRUE` to silence this warning
#> This warning is displayed once every 8 hours.
#> # Source: SQL [1 x 3]
#> # Database: DuckDB v0.10.1 [nmercade@Windows 10 x64:R 4.2.2/C:\Users\nmercade\AppData\Local\Temp\Rtmp8KaPeO\file242c567f7787.duckdb]
#> min_start_age median_start_age max_start_age
#> <dbl> <dbl> <dbl>
#> 1 18 18 18 Created on 2024-05-22 with reprex v2.1.0 |
Hmm I'm not sure if the issue is not actually that patient profiles should consider 28 Feb the person's birthday if born on a leap year.... |
nmercadeb
changed the title
min age in demographicsCohort
Handle leap year birthdays in demographicsCohort
Oct 22, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@nmercadeb @catalamarti shouldn't min age be 18 in the case below?
Created on 2024-05-22 with reprex v2.1.0
The text was updated successfully, but these errors were encountered: