knitr::opts_chunk$set(echo = FALSE) library(dplyr) library(DT)
covariate_ref
tableSys.setenv(DATABASECONNECTOR_JAR_FOLDER = keyring::key_get("legendT2dmDriverPath")) # NOTE to Jin: you need to set these key-chain variables for your computer legendT2dmConnectionDetails <- DatabaseConnector::createConnectionDetails( dbms = "postgresql", server = paste(keyring::key_get("legendt2dmServer"), keyring::key_get("legendt2dmDatabase"), sep = "/"), user = keyring::key_get("legendt2dmUser"), password = keyring::key_get("legendt2dmPassword"))
con <- DatabaseConnector::connect(legendT2dmConnectionDetails) covariates <- DatabaseConnector::querySql(con, sql = "SELECT DISTINCT covariate_id, covariate_name, concept_id FROM legendt2dm_class_diagnostics.covariate_ref;", snakeCaseToCamelCase = TRUE) DatabaseConnector::disconnect(con) covariates <- covariates %>% mutate(covariateName = toupper(covariateName)) matchNeedle <- grep(pattern = "NEEDLE", covariates$covariateName) matchDevice <- grep(pattern = "DEVICE_EXPOSURE", covariates$covariateName) matches <- intersect(matchNeedle, matchDevice) needles <- covariates[matches,]
Table contains r nrow(covariates)
distinct covariateId
s.
Of these, r length(matches)
contain DEVICE_EXPOSURE
and NEEDLE
.
And, r length(unique(needles$conceptId))
unique concept_id
codes.
covariate_ref
table`datatable(needles, rownames = FALSE, options = list(order = list(2, 'desc')))
PEN NEEDLE
matchNeedle <- grep(pattern = "PEN NEEDLE", covariates$covariateName) matchDevice <- grep(pattern = "DEVICE_EXPOSURE", covariates$covariateName) matches <- intersect(matchNeedle, matchDevice) penNeedles <- covariates[matches,] datatable(penNeedles, rownames = FALSE, options = list(order = list(2, 'desc')))
PEN NEEDLE
conceptId
ssort(unique(penNeedles$conceptId))
NOVO NEEDLE
matchNovo <- grep(pattern = "NOVO", covariates$covariateName) matchNeedle <- grep(pattern = "NEEDLE", covariates$covariateName) matchDevice <- grep(pattern = "DEVICE_EXPOSURE", covariates$covariateName) matches <- intersect(matchNovo, intersect(matchNeedle, matchDevice)) novoNeedles <- covariates[matches,] datatable(novoNeedles, rownames = FALSE, options = list(order = list(2, 'desc')))
NOVO NEEDLE
sort(unique(novoNeedles$conceptId))
con <- DatabaseConnector::connect(legendT2dmConnectionDetails) psCovariates <- DatabaseConnector::querySql(con, sql = " SELECT DISTINCT ps_covariate_assessment.covariate_id, ps_covariate_assessment.covariate_name, concept_id FROM legendt2dm_class_diagnostics.ps_covariate_assessment INNER JOIN legendt2dm_class_diagnostics.covariate_ref ON covariate_ref.covariate_id = ps_covariate_assessment.covariate_id;", snakeCaseToCamelCase = TRUE) DatabaseConnector::disconnect(con) psCovariates <- psCovariates %>% mutate(covariateName = toupper(covariateName)) psMatchNeedle <- grep(pattern = "NEEDLE", psCovariates$covariateName) psNeedles <- psCovariates[psMatchNeedle,]
Fitted PS models contain r nrow(psCovariates)
distinct covariateId
s.
Of these, r length(psMatchNeedle)
contain NEEDLE
.
And, r length(unique(psNeedles$conceptId))
unique concept_id
codes.
covariateId
from fitted PS modelsdatatable(psNeedles, rownames = FALSE, options = list(order = list(2, 'desc')))
conceptId
s to excludesort(unique(psNeedles$conceptId))
conceptId
s to excludeexclude <- sort(unique(c(penNeedles$conceptId,novoNeedles$conceptId))) exclude
paste(exclude, collapse = ";")
Limitations: would like to include VA results before modifying package
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.