OHDSI / OmopSketch

https://OHDSI.github.io/OmopSketch/
Apache License 2.0
2 stars 0 forks source link

Unexpected counts #170

Open catalamarti opened 1 month ago

catalamarti commented 1 month ago
library(OmopSketch)
library(dplyr)
#> 
#> 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

cdm <- mockOmopSketch()
#> Note: method with signature 'DBIConnection#Id' chosen for function 'dbExistsTable',
#>  target signature 'duckdb_connection#Id'.
#>  "duckdb_connection#ANY" would also be valid

result <- cdm |>
  summariseConceptCounts(
    conceptId = list(
      "Renal agenesis" = 194152,
      "Manic mood" = c(4226696, 4304866, 37110496, 40371897)
    )
  )
#> ℹ Getting use of codes from Renal agenesis
#> Getting use of codes ■■■■■■■■■■■■■■■■                  50% | ETA:  1s
#> ℹ Getting use of codes from Manic mood
#> Getting use of codes ■■■■■■■■■■■■■■■■                  50% | ETA:  1sGetting use of codes ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■  100% | ETA:  0s

result |>
  filter(estimate_name == "person_count") |>
  plotConceptCounts(facet = "codelist_name", colour = "codelist_name")
#> ! Multiple values of `variable_level` and `person_count` detected, consider
#>   including them in either: `x`, `facet`, and `colour`.

Created on 2024-09-23 with reprex v2.1.1

Is there any explanation why Manic mood counts are higher than overall? That's an unexpected result for me... @KimLopezGuell @martaalcalde

catalamarti commented 1 month ago

found... there are two concepts with the same name... How we want to deal with this?

KimLopezGuell commented 1 month ago

I would not add them together, it's very confusing... Can we keep them separate (potentially change names to name_1 or similar) and throw a warning?

catalamarti commented 1 month ago

to do so we would have to include concept_id (variable_level) in the naming

KimLopezGuell commented 1 month ago

Can we do that only if needed?