Skip to contents

Format the result of summariseOrphanCodes into a table.

Usage

tableOrphanCodes(
  result,
  type = "gt",
  header = c("cdm_name", "estimate_name"),
  groupColumn = character(),
  hide = character(),
  .options = list()
)

Arguments

result

A summarised result with results of the type "orphan_codes".

type

Type of desired formatted table. To see supported formats use visOmopResults::tableType()

header

A vector specifying the elements to include in the header. The order of elements matters, with the first being the topmost header. The header vector can contain one of the following variables: "cdm_name", "codelist_name", "domain_id", "standard_concept_name", "standard_concept_id", "estimate_name", "standard_concept", "vocabulary_id". Alternatively, it can include other names to use as overall header labels.

groupColumn

Variables to use as group labels. Allowed columns are: "cdm_name", "codelist_name", "domain_id", "standard_concept_name", "standard_concept_id", "estimate_name", "standard_concept", "vocabulary_id". These cannot be used in header.

hide

Table columns to exclude, options are: "cdm_name", "codelist_name", "domain_id", "standard_concept_name", "standard_concept_id", "estimate_name", "standard_concept", "vocabulary_id". These cannot be used in header or groupColumn.

.options

Named list with additional formatting options. visOmopResults::tableOptions() shows allowed arguments and their default values.

Value

A table with a formatted version of the summariseOrphanCodes result.

Examples

# \donttest{
cdm <- mockVocabRef("database")
#> Warning: ! 8 column in cdm_source do not match expected column type:
#>  `cdm_source_abbreviation` is logical but expected character
#>  `cdm_holder` is logical but expected character
#>  `source_description` is logical but expected character
#>  `source_documentation_reference` is logical but expected character
#>  `cdm_etl_reference` is logical but expected character
#>  `source_release_date` is logical but expected date
#>  `cdm_release_date` is logical but expected date
#>  `vocabulary_version` is logical but expected character
#> Warning: ! 3 column in concept do not match expected column type:
#>  `valid_start_date` is logical but expected date
#>  `valid_end_date` is logical but expected date
#>  `invalid_reason` is logical but expected character
#> Warning: ! 3 column in concept_relationship do not match expected column type:
#>  `valid_start_date` is logical but expected date
#>  `valid_end_date` is logical but expected date
#>  `invalid_reason` is logical but expected character
#> Warning: ! 1 column in concept_synonym do not match expected column type:
#>  `language_concept_id` is logical but expected integer
#> Warning: ! 4 column in drug_strength do not match expected column type:
#>  `amount_value` is logical but expected numeric
#>  `box_size` is logical but expected integer
#>  `valid_start_date` is logical but expected date
#>  `valid_end_date` is logical but expected date
#> Warning: ! 7 column in achilles_analysis do not match expected column type:
#>  `analysis_name` is numeric but expected character
#>  `stratum_1_name` is logical but expected character
#>  `stratum_2_name` is logical but expected character
#>  `stratum_3_name` is logical but expected character
#>  `stratum_4_name` is logical but expected character
#>  `stratum_5_name` is logical but expected character
#>  `category` is logical but expected character
#> Warning: ! 5 column in achilles_results do not match expected column type:
#>  `stratum_1` is numeric but expected character
#>  `stratum_2` is logical but expected character
#>  `stratum_3` is logical but expected character
#>  `stratum_4` is logical but expected character
#>  `stratum_5` is logical but expected character
#> Warning: ! 14 column in achilles_results_dist do not match expected column type:
#>  `stratum_1` is logical but expected character
#>  `stratum_2` is logical but expected character
#>  `stratum_3` is logical but expected character
#>  `stratum_4` is logical but expected character
#>  `stratum_5` is logical but expected character
#>  `min_value` is logical but expected integer
#>  `max_value` is logical but expected integer
#>  `avg_value` is logical but expected numeric
#>  `stdev_value` is logical but expected numeric
#>  `median_value` is logical but expected numeric
#>  `p10_value` is logical but expected numeric
#>  `p25_value` is logical but expected numeric
#>  `p75_value` is logical but expected numeric
#>  `p90_value` is logical but expected numeric
#> Warning: There are observation period end dates after the current date: 2024-11-26
#>  The latest max observation period end date found is 2025-12-31
#> Warning: There are observation period end dates after the current date: 2024-11-26
#>  The latest max observation period end date found is 2025-12-31
codes <- getCandidateCodes(cdm = cdm,
keywords = "Musculoskeletal disorder",
domains = "Condition",
includeDescendants = FALSE)
#> Limiting to domains of interest
#> Getting concepts to include
#> Search completed. Finishing up.
#>  1 candidate concept identified
#> Time taken: 0 minutes and 0 seconds

orphan_codes <- summariseOrphanCodes(x = list("msk" = codes$concept_id),
cdm = cdm)
#> PHOEBE results not available
#>  The concept_recommended table is not present in the cdm.
#> Getting orphan codes for msk
#> 

tableOrphanCodes(orphan_codes)
Database name
mock
Codelist name Domain ID Standard concept name Standard concept ID Standard concept Vocabulary ID
Estimate name
Record count
msk condition Osteoarthritis of knee 4 standard SNOMED 400
Osteoarthritis of hip 5 standard SNOMED 200
CDMConnector::cdmDisconnect(cdm) # }