Creates a table containing event-level counts of codes by concept, year, gender and age decile. This function processes each domain separately and creates a comprehensive table with event counts for individual concepts before aggregation.

createStratifiedCodeCountsTable(
  CDMdbHandler,
  domains = NULL,
  stratifiedCodeCountsTable = "stratified_code_counts"
)

Arguments

CDMdbHandler

A CDMdbHandler object that contains database connection details

domains

Optional data frame defining domains to process. If NULL, uses standard OMOP domains

stratifiedCodeCountsTable

Name of the stratified counts table to create. Defaults to "stratified_code_counts"

Value

Nothing. Creates a table called 'stratified_code_counts' in the results schema with columns:

  • concept_id - The OMOP concept ID

  • maps_to_concept_id - The mapped concept ID

  • calendar_year - The year of the events

  • gender_concept_id - The gender concept ID

  • age_decile - The age decile (0-9, 10-19, etc.)

  • record_counts - Number of events for this code

Examples

if (FALSE) { # \dontrun{
# Create stratified code counts table for all domains
createStratifiedCodeCountsTable(CDMdbHandler)

# Create stratified code counts table with custom domain configuration
custom_domains <- tibble::tribble(
  ~domain_id, ~table_name, ~concept_id_field, ~date_field, ~maps_to_concept_id_field,
  "Condition", "condition_occurrence", "condition_concept_id", "condition_start_date", "condition_concept_id"
)
createStratifiedCodeCountsTable(CDMdbHandler, domains = custom_domains)
} # }