Creates a comprehensive table containing counts of codes by domain, concept, year, gender and age decile. The table includes both event counts and person counts, as well as descendant counts for hierarchical concept analysis.

createCodeCountsTables(
  CDMdbHandler,
  domains = NULL,
  codeCountsTable = "code_counts"
)

Arguments

CDMdbHandler

A CDMdbHandler object that contains database connection details

domains

Optional vector of domains to process. If NULL, processes all standard domains

codeCountsTable

Name of the table to create. Defaults to "code_counts"

Value

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

  • domain - The domain of the code (Condition, Drug, etc.)

  • concept_id - The OMOP 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

  • person_counts - Number of persons with this code

  • incidence_person_counts - Number of persons with first occurrence of this code

  • descendant_record_counts - Number of events including descendant concepts

  • descendant_person_counts - Number of persons including descendant concepts

  • descendant_incidence_person_counts - Number of persons with first occurrence including descendants

  • total_person_counts - Total number of persons in the stratum

Examples

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

# Create code counts table for specific domains only
createCodeCountsTable(CDMdbHandler, domains = c("Condition", "Drug"))
} # }