Skip to content
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

Table 1 - does not report correct subject count #237

Closed
gowthamrao opened this issue Feb 28, 2024 · 3 comments
Closed

Table 1 - does not report correct subject count #237

gowthamrao opened this issue Feb 28, 2024 · 3 comments
Assignees
Labels
Milestone

Comments

@gowthamrao
Copy link
Member

formatCount(attr(covariateData1, "metaData")$populationSize),

To reproduce

  • do feature extraction with aggregate = TRUE for more than cohorts
  • make sure more than cohort has data in it
  • create table 1 for any cohortId other than the first
  • the subjectCount of the first cohort is shown in table header
@anthonysena anthonysena added the bug label Mar 1, 2024
@anthonysena anthonysena added this to the V3.5.0 milestone Mar 1, 2024
@anthonysena anthonysena self-assigned this Mar 1, 2024
@anthonysena
Copy link
Collaborator

Note: I'll create a reprex for this issue so we have details on how to reproduce this bug.

@ginberg
Copy link
Collaborator

ginberg commented Mar 26, 2024

@anthonysena could you create a reprex for this?

@anthonysena
Copy link
Collaborator

anthonysena commented Mar 29, 2024

Here it is - in this example, I've created aggregated features for the 4 cohorts in Eunomia but the Table1 output appears to include the wrong cohorts.

connectionDetails <- Eunomia::getEunomiaConnectionDetails()
cohortCounts <- Eunomia::createCohorts(
  connectionDetails = connectionDetails
)
#> Connecting using SQLite driver
#> Creating cohort: Celecoxib
#>   |                                                                              |                                                                      |   0%  |                                                                              |======================================================================| 100%
#> Executing SQL took 0.0157 secs
#> Creating cohort: Diclofenac
#>   |                                                                              |                                                                      |   0%  |                                                                              |======================================================================| 100%
#> Executing SQL took 0.0157 secs
#> Creating cohort: GiBleed
#>   |                                                                              |                                                                      |   0%  |                                                                              |======================================================================| 100%
#> Executing SQL took 0.0308 secs
#> Creating cohort: NSAIDs
#>   |                                                                              |                                                                      |   0%  |                                                                              |======================================================================| 100%
#> Executing SQL took 0.0659 secs
#> Cohorts created in table main.cohort
print(cohortCounts)
#>   cohortId       name
#> 1        1  Celecoxib
#> 2        2 Diclofenac
#> 3        3    GiBleed
#> 4        4     NSAIDs
#>                                                                                        description
#> 1    A simplified cohort definition for new users of celecoxib, designed specifically for Eunomia.
#> 2    A simplified cohort definition for new users ofdiclofenac, designed specifically for Eunomia.
#> 3 A simplified cohort definition for gastrointestinal bleeding, designed specifically for Eunomia.
#> 4       A simplified cohort definition for new users of NSAIDs, designed specifically for Eunomia.
#>   count
#> 1  1844
#> 2   850
#> 3   479
#> 4  2694

covariateData <- FeatureExtraction::getDbCovariateData(
  connectionDetails = connectionDetails,
  cdmDatabaseSchema = "main",
  cohortDatabaseSchema = "main",
  covariateSettings = FeatureExtraction::createDefaultCovariateSettings(),
  aggregated = TRUE
)
#> Connecting using SQLite driver
#> Constructing features on server
#>   |                                                                              |                                                                      |   0%  |                                                                              |                                                                      |   1%  |                                                                              |=                                                                     |   1%  |                                                                              |=                                                                     |   2%  |                                                                              |==                                                                    |   2%  |                                                                              |==                                                                    |   3%  |                                                                              |===                                                                   |   4%  |                                                                              |===                                                                   |   5%  |                                                                              |====                                                                  |   5%  |                                                                              |====                                                                  |   6%  |                                                                              |=====                                                                 |   7%  |                                                                              |=====                                                                 |   8%  |                                                                              |======                                                                |   8%  |                                                                              |======                                                                |   9%  |                                                                              |=======                                                               |   9%  |                                                                              |=======                                                               |  10%  |                                                                              |========                                                              |  11%  |                                                                              |========                                                              |  12%  |                                                                              |=========                                                             |  12%  |                                                                              |=========                                                             |  13%  |                                                                              |==========                                                            |  14%  |                                                                              |==========                                                            |  15%  |                                                                              |===========                                                           |  15%  |                                                                              |===========                                                           |  16%  |                                                                              |============                                                          |  16%  |                                                                              |============                                                          |  17%  |                                                                              |============                                                          |  18%  |                                                                              |=============                                                         |  18%  |                                                                              |=============                                                         |  19%  |                                                                              |==============                                                        |  20%  |                                                                              |==============                                                        |  21%  |                                                                              |===============                                                       |  21%  |                                                                              |===============                                                       |  22%  |                                                                              |================                                                      |  22%  |                                                                              |================                                                      |  23%  |                                                                              |=================                                                     |  24%  |                                                                              |=================                                                     |  25%  |                                                                              |==================                                                    |  25%  |                                                                              |==================                                                    |  26%  |                                                                              |===================                                                   |  27%  |                                                                              |===================                                                   |  28%  |                                                                              |====================                                                  |  28%  |                                                                              |====================                                                  |  29%  |                                                                              |=====================                                                 |  29%  |                                                                              |=====================                                                 |  30%  |                                                                              |======================                                                |  31%  |                                                                              |======================                                                |  32%  |                                                                              |=======================                                               |  32%  |                                                                              |=======================                                               |  33%  |                                                                              |=======================                                               |  34%  |                                                                              |========================                                              |  34%  |                                                                              |========================                                              |  35%  |                                                                              |=========================                                             |  35%  |                                                                              |=========================                                             |  36%  |                                                                              |==========================                                            |  37%  |                                                                              |==========================                                            |  38%  |                                                                              |===========================                                           |  38%  |                                                                              |===========================                                           |  39%  |                                                                              |============================                                          |  40%  |                                                                              |============================                                          |  41%  |                                                                              |=============================                                         |  41%  |                                                                              |=============================                                         |  42%  |                                                                              |==============================                                        |  42%  |                                                                              |==============================                                        |  43%  |                                                                              |===============================                                       |  44%  |                                                                              |===============================                                       |  45%  |                                                                              |================================                                      |  45%  |                                                                              |================================                                      |  46%  |                                                                              |=================================                                     |  47%  |                                                                              |=================================                                     |  48%  |                                                                              |==================================                                    |  48%  |                                                                              |==================================                                    |  49%  |                                                                              |===================================                                   |  49%  |                                                                              |===================================                                   |  50%  |                                                                              |===================================                                   |  51%  |                                                                              |====================================                                  |  51%  |                                                                              |====================================                                  |  52%  |                                                                              |=====================================                                 |  52%  |                                                                              |=====================================                                 |  53%  |                                                                              |======================================                                |  54%  |                                                                              |======================================                                |  55%  |                                                                              |=======================================                               |  55%  |                                                                              |=======================================                               |  56%  |                                                                              |========================================                              |  57%  |                                                                              |========================================                              |  58%  |                                                                              |=========================================                             |  58%  |                                                                              |=========================================                             |  59%  |                                                                              |==========================================                            |  59%  |                                                                              |==========================================                            |  60%  |                                                                              |===========================================                           |  61%  |                                                                              |===========================================                           |  62%  |                                                                              |============================================                          |  62%  |                                                                              |============================================                          |  63%  |                                                                              |=============================================                         |  64%  |                                                                              |=============================================                         |  65%  |                                                                              |==============================================                        |  65%  |                                                                              |==============================================                        |  66%  |                                                                              |===============================================                       |  66%  |                                                                              |===============================================                       |  67%  |                                                                              |===============================================                       |  68%  |                                                                              |================================================                      |  68%  |                                                                              |================================================                      |  69%  |                                                                              |=================================================                     |  70%  |                                                                              |=================================================                     |  71%  |                                                                              |==================================================                    |  71%  |                                                                              |==================================================                    |  72%  |                                                                              |===================================================                   |  72%  |                                                                              |===================================================                   |  73%  |                                                                              |====================================================                  |  74%  |                                                                              |====================================================                  |  75%  |                                                                              |=====================================================                 |  75%  |                                                                              |=====================================================                 |  76%  |                                                                              |======================================================                |  77%  |                                                                              |======================================================                |  78%  |                                                                              |=======================================================               |  78%  |                                                                              |=======================================================               |  79%  |                                                                              |========================================================              |  79%  |                                                                              |========================================================              |  80%  |                                                                              |=========================================================             |  81%  |                                                                              |=========================================================             |  82%  |                                                                              |==========================================================            |  82%  |                                                                              |==========================================================            |  83%  |                                                                              |==========================================================            |  84%  |                                                                              |===========================================================           |  84%  |                                                                              |===========================================================           |  85%  |                                                                              |============================================================          |  85%  |                                                                              |============================================================          |  86%  |                                                                              |=============================================================         |  87%  |                                                                              |=============================================================         |  88%  |                                                                              |==============================================================        |  88%  |                                                                              |==============================================================        |  89%  |                                                                              |===============================================================       |  90%  |                                                                              |===============================================================       |  91%  |                                                                              |================================================================      |  91%  |                                                                              |================================================================      |  92%  |                                                                              |=================================================================     |  92%  |                                                                              |=================================================================     |  93%  |                                                                              |==================================================================    |  94%  |                                                                              |==================================================================    |  95%  |                                                                              |===================================================================   |  95%  |                                                                              |===================================================================   |  96%  |                                                                              |====================================================================  |  97%  |                                                                              |====================================================================  |  98%  |                                                                              |===================================================================== |  98%  |                                                                              |===================================================================== |  99%  |                                                                              |======================================================================|  99%  |                                                                              |======================================================================| 100%
#> Executing SQL took 1.58 secs
#> Fetching data from server
#> Fetching data took 0.226 secs

table1 <- FeatureExtraction::createTable1(
  covariateData1 = covariateData,
  covariateData2 = covariateData,
  cohortId1 = 2, #Diclofenac - Cohort Count == 850
  cohortId2 = 4,  #NSAIDs - Cohort Count = 2694
  output = 'one column'
)
print(table1, n = 30)
#> # A tibble: 30 × 4
#>    Characteristic                `% (n = 1,844)` `% (n =   479)` `% (n = 2,694)`
#>    <chr>                         <chr>           <chr>           <chr>          
#>  1 "Age group"                   ""              ""              ""             
#>  2 "   30 -  34"                 " 11.8"         " 11.5"         "-0.01"        
#>  3 "   35 -  39"                 " 49.4"         " 48.4"         "-0.02"        
#>  4 "   40 -  44"                 " 35.8"         " 36.4"         " 0.01"        
#>  5 "   45 -  49"                 "  3.1"         "  3.7"         " 0.04"        
#>  6 "Gender: female"              " 52.1"         " 51.0"         "-0.02"        
#>  7 "Medical history: General"    ""              ""              ""             
#>  8 "  Osteoarthritis"            "100.0"         "100.0"         "  NaN"        
#>  9 "  Rheumatoid arthritis"      " 0"            "  0.0"         " 0.03"        
#> 10 "  Ulcerative colitis"        "  1.1"         "  2.4"         " 0.11"        
#> 11 "Medical history: Cardiovasc… ""              ""              ""             
#> 12 "  Coronary arteriosclerosis" "  0.1"         "  0.1"         " 0.01"        
#> 13 ""                            ""              ""              ""             
#> 14 "Characteristic"              "Value"         "Value"         "Std.Diff"     
#> 15 "Charlson comorbidity index"  ""              ""              ""             
#> 16 "    Mean"                    "0.4"           "0.5"           " 0.40"        
#> 17 "    Std. deviation"          "0.3"           "0.4"           "  "           
#> 18 "    Minimum"                 "0.0"           "0.0"           "  "           
#> 19 "    25th percentile"         "0.0"           "0.0"           "  "           
#> 20 "    Median"                  "0.0"           "0.0"           "  "           
#> 21 "    75th percentile"         "1.0"           "1.0"           "  "           
#> 22 "    Maximum"                 "3.0"           "3.0"           "  "           
#> 23 "CHADS2Vasc"                  ""              ""              ""             
#> 24 "    Mean"                    "0.5"           "0.5"           "-0.02"        
#> 25 "    Std. deviation"          "0.5"           "0.5"           "  "           
#> 26 "    Minimum"                 "0.0"           "0.0"           "  "           
#> 27 "    25th percentile"         "0.0"           "0.0"           "  "           
#> 28 "    Median"                  "0.0"           "1.0"           "  "           
#> 29 "    75th percentile"         "0.0"           "1.0"           "  "           
#> 30 "    Maximum"                 "1.0"           "1.0"           "  "

Created on 2024-03-29 with reprex v2.1.0

@ginberg ginberg self-assigned this Apr 8, 2024
@ginberg ginberg closed this as completed Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants