Title: | Identify Characteristics of Patients in the OMOP Common Data Model |
---|---|
Description: | Identify the characteristics of patients in data mapped to the Observational Medical Outcomes Partnership (OMOP) common data model. |
Authors: | Marti Catala [aut, cre] , Yuchen Guo [aut] , Mike Du [aut] , Kim Lopez-Guell [aut] , Edward Burn [aut] , Nuria Mercade-Besora [aut] , Xintong Li [ctb] , Xihang Chen [ctb] |
Maintainer: | Marti Catala <[email protected]> |
License: | Apache License (>= 2) |
Version: | 1.2.1.900 |
Built: | 2024-10-31 06:18:50 UTC |
Source: | https://github.com/darwin-eu/patientprofiles |
Compute the age of the individuals at a certain date
addAge( x, indexDate = "cohort_start_date", ageName = "age", ageGroup = NULL, ageMissingMonth = 1, ageMissingDay = 1, ageImposeMonth = FALSE, ageImposeDay = FALSE, missingAgeGroupValue = "None", name = NULL )
addAge( x, indexDate = "cohort_start_date", ageName = "age", ageGroup = NULL, ageMissingMonth = 1, ageMissingDay = 1, ageImposeMonth = FALSE, ageImposeDay = FALSE, missingAgeGroupValue = "None", name = NULL )
x |
Table with individuals in the cdm. |
indexDate |
Variable in x that contains the date to compute the age. |
ageName |
Name of the new column that contains age. |
ageGroup |
List of age groups to be added. |
ageMissingMonth |
Month of the year assigned to individuals with missing month of birth. By default: 1. |
ageMissingDay |
day of the month assigned to individuals with missing day of birth. By default: 1. |
ageImposeMonth |
Whether the month of the date of birth will be considered as missing for all the individuals. |
ageImposeDay |
Whether the day of the date of birth will be considered as missing for all the individuals. |
missingAgeGroupValue |
Value to include if missing age. |
name |
Name of the new table, if NULL a temporary table is returned. |
tibble with the age column added.
cdm <- mockPatientProfiles() cdm$cohort1 |> addAge() mockDisconnect(cdm = cdm)
cdm <- mockPatientProfiles() cdm$cohort1 |> addAge() mockDisconnect(cdm = cdm)
'r lifecycle::badge("experimental")' Same as 'addAge()', except query is not computed to a table.
addAgeQuery( x, indexDate = "cohort_start_date", ageName = "age", ageGroup = NULL, ageMissingMonth = 1, ageMissingDay = 1, ageImposeMonth = FALSE, ageImposeDay = FALSE, missingAgeGroupValue = "None" )
addAgeQuery( x, indexDate = "cohort_start_date", ageName = "age", ageGroup = NULL, ageMissingMonth = 1, ageMissingDay = 1, ageImposeMonth = FALSE, ageImposeDay = FALSE, missingAgeGroupValue = "None" )
x |
Table with individuals in the cdm. |
indexDate |
Variable in x that contains the date to compute the age. |
ageName |
Name of the new column that contains age. |
ageGroup |
List of age groups to be added. |
ageMissingMonth |
Month of the year assigned to individuals with missing month of birth. By default: 1. |
ageMissingDay |
day of the month assigned to individuals with missing day of birth. By default: 1. |
ageImposeMonth |
Whether the month of the date of birth will be considered as missing for all the individuals. |
ageImposeDay |
Whether the day of the date of birth will be considered as missing for all the individuals. |
missingAgeGroupValue |
Value to include if missing age. |
tibble with the age column added.
cdm <- mockPatientProfiles() cdm$cohort1 |> addAgeQuery() mockDisconnect(cdm = cdm)
cdm <- mockPatientProfiles() cdm$cohort1 |> addAgeQuery() mockDisconnect(cdm = cdm)
Categorize a numeric variable
addCategories( x, variable, categories, missingCategoryValue = "None", overlap = FALSE, name = NULL )
addCategories( x, variable, categories, missingCategoryValue = "None", overlap = FALSE, name = NULL )
x |
Table with individuals in the cdm. |
variable |
Target variable that we want to categorize. |
categories |
List of lists of named categories with lower and upper limit. |
missingCategoryValue |
Value to assign to those individuals not in any named category. If NULL or NA, missing will values will be given. |
overlap |
TRUE if the categories given overlap. |
name |
Name of the new table, if NULL a temporary table is returned. |
The x table with the categorical variable added.
cdm <- mockPatientProfiles() result <- cdm$cohort1 %>% addAge() %>% addCategories( variable = "age", categories = list("age_group" = list( "0 to 39" = c(0, 39), "40 to 79" = c(40, 79), "80 to 150" = c(80, 150) )) ) mockDisconnect(cdm = cdm)
cdm <- mockPatientProfiles() result <- cdm$cohort1 %>% addAge() %>% addCategories( variable = "age", categories = list("age_group" = list( "0 to 39" = c(0, 39), "40 to 79" = c(40, 79), "80 to 150" = c(80, 150) )) ) mockDisconnect(cdm = cdm)
Add cdm name
addCdmName(table, cdm = omopgenerics::cdmReference(table))
addCdmName(table, cdm = omopgenerics::cdmReference(table))
table |
Table in the cdm |
cdm |
A cdm reference object |
Table with an extra column with the cdm names
library(PatientProfiles) cdm <- mockPatientProfiles() cdm$cohort1 %>% addCdmName()
library(PatientProfiles) cdm <- mockPatientProfiles() cdm$cohort1 %>% addCdmName()
It creates columns to indicate number of occurrences of intersection with a cohort
addCohortIntersectCount( x, targetCohortTable, targetCohortId = NULL, indexDate = "cohort_start_date", censorDate = NULL, targetStartDate = "cohort_start_date", targetEndDate = "cohort_end_date", window = list(c(0, Inf)), nameStyle = "{cohort_name}_{window_name}", name = NULL )
addCohortIntersectCount( x, targetCohortTable, targetCohortId = NULL, indexDate = "cohort_start_date", censorDate = NULL, targetStartDate = "cohort_start_date", targetEndDate = "cohort_end_date", window = list(c(0, Inf)), nameStyle = "{cohort_name}_{window_name}", name = NULL )
x |
Table with individuals in the cdm. |
targetCohortTable |
name of the cohort that we want to check for overlap. |
targetCohortId |
vector of cohort definition ids to include. |
indexDate |
Variable in x that contains the date to compute the intersection. |
censorDate |
whether to censor overlap events at a specific date or a column date of x. |
targetStartDate |
date of reference in cohort table, either for start (in overlap) or on its own (for incidence). |
targetEndDate |
date of reference in cohort table, either for end (overlap) or NULL (if incidence). |
window |
window to consider events of. |
nameStyle |
naming of the added column or columns, should include required parameters. |
name |
Name of the new table, if NULL a temporary table is returned. |
table with added columns with overlap information.
cdm <- mockPatientProfiles() cdm$cohort1 %>% addCohortIntersectCount( targetCohortTable = "cohort2" ) mockDisconnect(cdm = cdm)
cdm <- mockPatientProfiles() cdm$cohort1 %>% addCohortIntersectCount( targetCohortTable = "cohort2" ) mockDisconnect(cdm = cdm)
Date of cohorts that are present in a certain window
addCohortIntersectDate( x, targetCohortTable, targetCohortId = NULL, indexDate = "cohort_start_date", censorDate = NULL, targetDate = "cohort_start_date", order = "first", window = c(0, Inf), nameStyle = "{cohort_name}_{window_name}", name = NULL )
addCohortIntersectDate( x, targetCohortTable, targetCohortId = NULL, indexDate = "cohort_start_date", censorDate = NULL, targetDate = "cohort_start_date", order = "first", window = c(0, Inf), nameStyle = "{cohort_name}_{window_name}", name = NULL )
x |
Table with individuals in the cdm. |
targetCohortTable |
Cohort table to. |
targetCohortId |
Cohort IDs of interest from the other cohort table. If NULL, all cohorts will be used with a time variable added for each cohort of interest. |
indexDate |
Variable in x that contains the date to compute the intersection. |
censorDate |
whether to censor overlap events at a specific date or a column date of x. |
targetDate |
Date of interest in the other cohort table. Either cohort_start_date or cohort_end_date. |
order |
date to use if there are multiple records for an individual during the window of interest. Either first or last. |
window |
Window of time to identify records relative to the indexDate. Records outside of this time period will be ignored. |
nameStyle |
naming of the added column or columns, should include required parameters. |
name |
Name of the new table, if NULL a temporary table is returned. |
x along with additional columns for each cohort of interest.
cdm <- mockPatientProfiles() cdm$cohort1 %>% addCohortIntersectDate( targetCohortTable = "cohort2" ) mockDisconnect(cdm = cdm)
cdm <- mockPatientProfiles() cdm$cohort1 %>% addCohortIntersectDate( targetCohortTable = "cohort2" ) mockDisconnect(cdm = cdm)
It creates columns to indicate the number of days between the current table and a target cohort
addCohortIntersectDays( x, targetCohortTable, targetCohortId = NULL, indexDate = "cohort_start_date", censorDate = NULL, targetDate = "cohort_start_date", order = "first", window = c(0, Inf), nameStyle = "{cohort_name}_{window_name}", name = NULL )
addCohortIntersectDays( x, targetCohortTable, targetCohortId = NULL, indexDate = "cohort_start_date", censorDate = NULL, targetDate = "cohort_start_date", order = "first", window = c(0, Inf), nameStyle = "{cohort_name}_{window_name}", name = NULL )
x |
Table with individuals in the cdm. |
targetCohortTable |
Cohort table to. |
targetCohortId |
Cohort IDs of interest from the other cohort table. If NULL, all cohorts will be used with a days variable added for each cohort of interest. |
indexDate |
Variable in x that contains the date to compute the intersection. |
censorDate |
whether to censor overlap events at a specific date or a column date of x. |
targetDate |
Date of interest in the other cohort table. Either cohort_start_date or cohort_end_date. |
order |
date to use if there are multiple records for an individual during the window of interest. Either first or last. |
window |
Window of time to identify records relative to the indexDate. Records outside of this time period will be ignored. |
nameStyle |
naming of the added column or columns, should include required parameters. |
name |
Name of the new table, if NULL a temporary table is returned. |
x along with additional columns for each cohort of interest.
cdm <- mockPatientProfiles() cdm$cohort1 %>% addCohortIntersectDays( targetCohortTable = "cohort2" ) mockDisconnect(cdm = cdm)
cdm <- mockPatientProfiles() cdm$cohort1 %>% addCohortIntersectDays( targetCohortTable = "cohort2" ) mockDisconnect(cdm = cdm)
It creates columns to indicate the presence of cohorts
addCohortIntersectFlag( x, targetCohortTable, targetCohortId = NULL, indexDate = "cohort_start_date", censorDate = NULL, targetStartDate = "cohort_start_date", targetEndDate = "cohort_end_date", window = list(c(0, Inf)), nameStyle = "{cohort_name}_{window_name}", name = NULL )
addCohortIntersectFlag( x, targetCohortTable, targetCohortId = NULL, indexDate = "cohort_start_date", censorDate = NULL, targetStartDate = "cohort_start_date", targetEndDate = "cohort_end_date", window = list(c(0, Inf)), nameStyle = "{cohort_name}_{window_name}", name = NULL )
x |
Table with individuals in the cdm. |
targetCohortTable |
name of the cohort that we want to check for overlap. |
targetCohortId |
vector of cohort definition ids to include. |
indexDate |
Variable in x that contains the date to compute the intersection. |
censorDate |
whether to censor overlap events at a specific date or a column date of x. |
targetStartDate |
date of reference in cohort table, either for start (in overlap) or on its own (for incidence). |
targetEndDate |
date of reference in cohort table, either for end (overlap) or NULL (if incidence). |
window |
window to consider events of. |
nameStyle |
naming of the added column or columns, should include required parameters. |
name |
Name of the new table, if NULL a temporary table is returned. |
table with added columns with overlap information.
cdm <- mockPatientProfiles() cdm$cohort1 %>% addCohortIntersectFlag( targetCohortTable = "cohort2" ) mockDisconnect(cdm = cdm)
cdm <- mockPatientProfiles() cdm$cohort1 %>% addCohortIntersectFlag( targetCohortTable = "cohort2" ) mockDisconnect(cdm = cdm)
Add cohort name for each cohort_definition_id
addCohortName(cohort)
addCohortName(cohort)
cohort |
cohort to which add the cohort name |
cohort with an extra column with the cohort names
library(PatientProfiles) cdm <- mockPatientProfiles() cdm$cohort1 %>% addCohortName()
library(PatientProfiles) cdm <- mockPatientProfiles() cdm$cohort1 %>% addCohortName()
It creates column to indicate the count overlap information between a table and a concept
addConceptIntersectCount( x, conceptSet, indexDate = "cohort_start_date", censorDate = NULL, window = list(c(0, Inf)), targetStartDate = "event_start_date", targetEndDate = "event_end_date", inObservation = TRUE, nameStyle = "{concept_name}_{window_name}", name = NULL )
addConceptIntersectCount( x, conceptSet, indexDate = "cohort_start_date", censorDate = NULL, window = list(c(0, Inf)), targetStartDate = "event_start_date", targetEndDate = "event_end_date", inObservation = TRUE, nameStyle = "{concept_name}_{window_name}", name = NULL )
x |
Table with individuals in the cdm. |
conceptSet |
Concept set list. |
indexDate |
Variable in x that contains the date to compute the intersection. |
censorDate |
whether to censor overlap events at a date column of x |
window |
window to consider events in. |
targetStartDate |
Event start date to use for the intersection. |
targetEndDate |
Event end date to use for the intersection. |
inObservation |
If TRUE only records inside an observation period will be considered. |
nameStyle |
naming of the added column or columns, should include required parameters. |
name |
Name of the new table, if NULL a temporary table is returned. |
table with added columns with overlap information
library(PatientProfiles) cdm <- mockPatientProfiles() concept <- dplyr::tibble( concept_id = c(1125315), domain_id = "Drug", vocabulary_id = NA_character_, concept_class_id = "Ingredient", standard_concept = "S", concept_code = NA_character_, valid_start_date = as.Date("1900-01-01"), valid_end_date = as.Date("2099-01-01"), invalid_reason = NA_character_ ) %>% dplyr::mutate(concept_name = paste0("concept: ", .data$concept_id)) cdm <- CDMConnector::insertTable(cdm, "concept", concept) result <- cdm$cohort1 %>% addConceptIntersectCount( conceptSet = list("acetaminophen" = 1125315) ) %>% dplyr::collect() mockDisconnect(cdm = cdm)
library(PatientProfiles) cdm <- mockPatientProfiles() concept <- dplyr::tibble( concept_id = c(1125315), domain_id = "Drug", vocabulary_id = NA_character_, concept_class_id = "Ingredient", standard_concept = "S", concept_code = NA_character_, valid_start_date = as.Date("1900-01-01"), valid_end_date = as.Date("2099-01-01"), invalid_reason = NA_character_ ) %>% dplyr::mutate(concept_name = paste0("concept: ", .data$concept_id)) cdm <- CDMConnector::insertTable(cdm, "concept", concept) result <- cdm$cohort1 %>% addConceptIntersectCount( conceptSet = list("acetaminophen" = 1125315) ) %>% dplyr::collect() mockDisconnect(cdm = cdm)
It creates column to indicate the date overlap information between a table and a concept
addConceptIntersectDate( x, conceptSet, indexDate = "cohort_start_date", censorDate = NULL, window = list(c(0, Inf)), targetDate = "event_start_date", order = "first", inObservation = TRUE, nameStyle = "{concept_name}_{window_name}", name = NULL )
addConceptIntersectDate( x, conceptSet, indexDate = "cohort_start_date", censorDate = NULL, window = list(c(0, Inf)), targetDate = "event_start_date", order = "first", inObservation = TRUE, nameStyle = "{concept_name}_{window_name}", name = NULL )
x |
Table with individuals in the cdm. |
conceptSet |
Concept set list. |
indexDate |
Variable in x that contains the date to compute the intersection. |
censorDate |
whether to censor overlap events at a date column of x |
window |
window to consider events in. |
targetDate |
Event date to use for the intersection. |
order |
last or first date to use for date/days calculations. |
inObservation |
If TRUE only records inside an observation period will be considered. |
nameStyle |
naming of the added column or columns, should include required parameters. |
name |
Name of the new table, if NULL a temporary table is returned. |
table with added columns with overlap information
library(PatientProfiles) cdm <- mockPatientProfiles() concept <- dplyr::tibble( concept_id = c(1125315), domain_id = "Drug", vocabulary_id = NA_character_, concept_class_id = "Ingredient", standard_concept = "S", concept_code = NA_character_, valid_start_date = as.Date("1900-01-01"), valid_end_date = as.Date("2099-01-01"), invalid_reason = NA_character_ ) %>% dplyr::mutate(concept_name = paste0("concept: ", .data$concept_id)) cdm <- CDMConnector::insertTable(cdm, "concept", concept) result <- cdm$cohort1 %>% addConceptIntersectDate( conceptSet = list("acetaminophen" = 1125315) ) %>% dplyr::collect() mockDisconnect(cdm = cdm)
library(PatientProfiles) cdm <- mockPatientProfiles() concept <- dplyr::tibble( concept_id = c(1125315), domain_id = "Drug", vocabulary_id = NA_character_, concept_class_id = "Ingredient", standard_concept = "S", concept_code = NA_character_, valid_start_date = as.Date("1900-01-01"), valid_end_date = as.Date("2099-01-01"), invalid_reason = NA_character_ ) %>% dplyr::mutate(concept_name = paste0("concept: ", .data$concept_id)) cdm <- CDMConnector::insertTable(cdm, "concept", concept) result <- cdm$cohort1 %>% addConceptIntersectDate( conceptSet = list("acetaminophen" = 1125315) ) %>% dplyr::collect() mockDisconnect(cdm = cdm)
It creates column to indicate the days of difference from an index date to a concept
addConceptIntersectDays( x, conceptSet, indexDate = "cohort_start_date", censorDate = NULL, window = list(c(0, Inf)), targetDate = "event_start_date", order = "first", inObservation = TRUE, nameStyle = "{concept_name}_{window_name}", name = NULL )
addConceptIntersectDays( x, conceptSet, indexDate = "cohort_start_date", censorDate = NULL, window = list(c(0, Inf)), targetDate = "event_start_date", order = "first", inObservation = TRUE, nameStyle = "{concept_name}_{window_name}", name = NULL )
x |
Table with individuals in the cdm. |
conceptSet |
Concept set list. |
indexDate |
Variable in x that contains the date to compute the intersection. |
censorDate |
whether to censor overlap events at a date column of x |
window |
window to consider events in. |
targetDate |
Event date to use for the intersection. |
order |
last or first date to use for date/days calculations. |
inObservation |
If TRUE only records inside an observation period will be considered. |
nameStyle |
naming of the added column or columns, should include required parameters. |
name |
Name of the new table, if NULL a temporary table is returned. |
table with added columns with overlap information
library(PatientProfiles) cdm <- mockPatientProfiles() concept <- dplyr::tibble( concept_id = c(1125315), domain_id = "Drug", vocabulary_id = NA_character_, concept_class_id = "Ingredient", standard_concept = "S", concept_code = NA_character_, valid_start_date = as.Date("1900-01-01"), valid_end_date = as.Date("2099-01-01"), invalid_reason = NA_character_ ) %>% dplyr::mutate(concept_name = paste0("concept: ", .data$concept_id)) cdm <- CDMConnector::insertTable(cdm, "concept", concept) result <- cdm$cohort1 %>% addConceptIntersectDays( conceptSet = list("acetaminophen" = 1125315) ) %>% dplyr::collect() mockDisconnect(cdm = cdm)
library(PatientProfiles) cdm <- mockPatientProfiles() concept <- dplyr::tibble( concept_id = c(1125315), domain_id = "Drug", vocabulary_id = NA_character_, concept_class_id = "Ingredient", standard_concept = "S", concept_code = NA_character_, valid_start_date = as.Date("1900-01-01"), valid_end_date = as.Date("2099-01-01"), invalid_reason = NA_character_ ) %>% dplyr::mutate(concept_name = paste0("concept: ", .data$concept_id)) cdm <- CDMConnector::insertTable(cdm, "concept", concept) result <- cdm$cohort1 %>% addConceptIntersectDays( conceptSet = list("acetaminophen" = 1125315) ) %>% dplyr::collect() mockDisconnect(cdm = cdm)
It creates column to indicate the flag overlap information between a table and a concept
addConceptIntersectFlag( x, conceptSet, indexDate = "cohort_start_date", censorDate = NULL, window = list(c(0, Inf)), targetStartDate = "event_start_date", targetEndDate = "event_end_date", inObservation = TRUE, nameStyle = "{concept_name}_{window_name}", name = NULL )
addConceptIntersectFlag( x, conceptSet, indexDate = "cohort_start_date", censorDate = NULL, window = list(c(0, Inf)), targetStartDate = "event_start_date", targetEndDate = "event_end_date", inObservation = TRUE, nameStyle = "{concept_name}_{window_name}", name = NULL )
x |
Table with individuals in the cdm. |
conceptSet |
Concept set list. |
indexDate |
Variable in x that contains the date to compute the intersection. |
censorDate |
whether to censor overlap events at a date column of x |
window |
window to consider events in. |
targetStartDate |
Event start date to use for the intersection. |
targetEndDate |
Event end date to use for the intersection. |
inObservation |
If TRUE only records inside an observation period will be considered. |
nameStyle |
naming of the added column or columns, should include required parameters. |
name |
Name of the new table, if NULL a temporary table is returned. |
table with added columns with overlap information
library(PatientProfiles) cdm <- mockPatientProfiles() concept <- dplyr::tibble( concept_id = c(1125315), domain_id = "Drug", vocabulary_id = NA_character_, concept_class_id = "Ingredient", standard_concept = "S", concept_code = NA_character_, valid_start_date = as.Date("1900-01-01"), valid_end_date = as.Date("2099-01-01"), invalid_reason = NA_character_ ) %>% dplyr::mutate(concept_name = paste0("concept: ", .data$concept_id)) cdm <- CDMConnector::insertTable(cdm, "concept", concept) result <- cdm$cohort1 %>% addConceptIntersectFlag( conceptSet = list("acetaminophen" = 1125315) ) %>% dplyr::collect() mockDisconnect(cdm = cdm)
library(PatientProfiles) cdm <- mockPatientProfiles() concept <- dplyr::tibble( concept_id = c(1125315), domain_id = "Drug", vocabulary_id = NA_character_, concept_class_id = "Ingredient", standard_concept = "S", concept_code = NA_character_, valid_start_date = as.Date("1900-01-01"), valid_end_date = as.Date("2099-01-01"), invalid_reason = NA_character_ ) %>% dplyr::mutate(concept_name = paste0("concept: ", .data$concept_id)) cdm <- CDMConnector::insertTable(cdm, "concept", concept) result <- cdm$cohort1 %>% addConceptIntersectFlag( conceptSet = list("acetaminophen" = 1125315) ) %>% dplyr::collect() mockDisconnect(cdm = cdm)
Add a column with the individual birth date
addDateOfBirth( x, dateOfBirthName = "date_of_birth", missingDay = 1, missingMonth = 1, imposeDay = FALSE, imposeMonth = FALSE, name = NULL )
addDateOfBirth( x, dateOfBirthName = "date_of_birth", missingDay = 1, missingMonth = 1, imposeDay = FALSE, imposeMonth = FALSE, name = NULL )
x |
Table in the cdm that contains 'person_id' or 'subject_id'. |
dateOfBirthName |
Name of the column to be added with the date of birth. |
missingDay |
Day of the individuals with no or imposed day of birth. |
missingMonth |
Month of the individuals with no or imposed month of birth. |
imposeDay |
Whether to impose day of birth. |
imposeMonth |
Whether to impose month of birth. |
name |
Name of the new table, if NULL a temporary table is returned. |
The function returns the table x with an extra column that contains the date of birth.
library(PatientProfiles) cdm <- mockPatientProfiles() cdm$cohort1 %>% addDateOfBirth() mockDisconnect(cdm = cdm)
library(PatientProfiles) cdm <- mockPatientProfiles() cdm$cohort1 %>% addDateOfBirth() mockDisconnect(cdm = cdm)
'r lifecycle::badge("experimental")' Same as 'addDateOfBirth()', except query is not computed to a table.
addDateOfBirthQuery( x, dateOfBirthName = "date_of_birth", missingDay = 1, missingMonth = 1, imposeDay = FALSE, imposeMonth = FALSE )
addDateOfBirthQuery( x, dateOfBirthName = "date_of_birth", missingDay = 1, missingMonth = 1, imposeDay = FALSE, imposeMonth = FALSE )
x |
Table in the cdm that contains 'person_id' or 'subject_id'. |
dateOfBirthName |
Name of the column to be added with the date of birth. |
missingDay |
Day of the individuals with no or imposed day of birth. |
missingMonth |
Month of the individuals with no or imposed month of birth. |
imposeDay |
Whether to impose day of birth. |
imposeMonth |
Whether to impose month of birth. |
The function returns the table x with an extra column that contains the date of birth.
library(PatientProfiles) cdm <- mockPatientProfiles() cdm$cohort1 %>% addDateOfBirthQuery() mockDisconnect(cdm = cdm)
library(PatientProfiles) cdm <- mockPatientProfiles() cdm$cohort1 %>% addDateOfBirthQuery() mockDisconnect(cdm = cdm)
Add date of death for individuals. Only death within the same observation period than 'indexDate' will be observed.
addDeathDate( x, indexDate = "cohort_start_date", censorDate = NULL, window = c(0, Inf), deathDateName = "date_of_death", name = NULL )
addDeathDate( x, indexDate = "cohort_start_date", censorDate = NULL, window = c(0, Inf), deathDateName = "date_of_death", name = NULL )
x |
Table with individuals in the cdm. |
indexDate |
Variable in x that contains the window origin. |
censorDate |
Name of a column to stop followup. |
window |
window to consider events over. |
deathDateName |
name of the new column to be added. |
name |
Name of the new table, if NULL a temporary table is returned. |
table x with the added column with death information added.
cdm <- mockPatientProfiles() cdm$cohort1 %>% addDeathDate() mockDisconnect(cdm = cdm)
cdm <- mockPatientProfiles() cdm$cohort1 %>% addDeathDate() mockDisconnect(cdm = cdm)
Add days to death for individuals. Only death within the same observation period than 'indexDate' will be observed.
addDeathDays( x, indexDate = "cohort_start_date", censorDate = NULL, window = c(0, Inf), deathDaysName = "days_to_death", name = NULL )
addDeathDays( x, indexDate = "cohort_start_date", censorDate = NULL, window = c(0, Inf), deathDaysName = "days_to_death", name = NULL )
x |
Table with individuals in the cdm. |
indexDate |
Variable in x that contains the window origin. |
censorDate |
Name of a column to stop followup. |
window |
window to consider events over. |
deathDaysName |
name of the new column to be added. |
name |
Name of the new table, if NULL a temporary table is returned. |
table x with the added column with death information added.
cdm <- mockPatientProfiles() cdm$cohort1 %>% addDeathDays() mockDisconnect(cdm = cdm)
cdm <- mockPatientProfiles() cdm$cohort1 %>% addDeathDays() mockDisconnect(cdm = cdm)
Add flag for death for individuals. Only death within the same observation period than 'indexDate' will be observed.
addDeathFlag( x, indexDate = "cohort_start_date", censorDate = NULL, window = c(0, Inf), deathFlagName = "death", name = NULL )
addDeathFlag( x, indexDate = "cohort_start_date", censorDate = NULL, window = c(0, Inf), deathFlagName = "death", name = NULL )
x |
Table with individuals in the cdm. |
indexDate |
Variable in x that contains the window origin. |
censorDate |
Name of a column to stop followup. |
window |
window to consider events over. |
deathFlagName |
name of the new column to be added. |
name |
Name of the new table, if NULL a temporary table is returned. |
table x with the added column with death information added.
cdm <- mockPatientProfiles() cdm$cohort1 %>% addDeathFlag() mockDisconnect(cdm = cdm)
cdm <- mockPatientProfiles() cdm$cohort1 %>% addDeathFlag() mockDisconnect(cdm = cdm)
Compute demographic characteristics at a certain date
addDemographics( x, indexDate = "cohort_start_date", age = TRUE, ageName = "age", ageMissingMonth = 1, ageMissingDay = 1, ageImposeMonth = FALSE, ageImposeDay = FALSE, ageGroup = NULL, missingAgeGroupValue = "None", sex = TRUE, sexName = "sex", missingSexValue = "None", priorObservation = TRUE, priorObservationName = "prior_observation", priorObservationType = "days", futureObservation = TRUE, futureObservationName = "future_observation", futureObservationType = "days", dateOfBirth = FALSE, dateOfBirthName = "date_of_birth", name = NULL )
addDemographics( x, indexDate = "cohort_start_date", age = TRUE, ageName = "age", ageMissingMonth = 1, ageMissingDay = 1, ageImposeMonth = FALSE, ageImposeDay = FALSE, ageGroup = NULL, missingAgeGroupValue = "None", sex = TRUE, sexName = "sex", missingSexValue = "None", priorObservation = TRUE, priorObservationName = "prior_observation", priorObservationType = "days", futureObservation = TRUE, futureObservationName = "future_observation", futureObservationType = "days", dateOfBirth = FALSE, dateOfBirthName = "date_of_birth", name = NULL )
x |
Table with individuals in the cdm. |
indexDate |
Variable in x that contains the date to compute the demographics characteristics. |
age |
TRUE or FALSE. If TRUE, age will be calculated relative to indexDate. |
ageName |
Age variable name. |
ageMissingMonth |
Month of the year assigned to individuals with missing month of birth. |
ageMissingDay |
day of the month assigned to individuals with missing day of birth. |
ageImposeMonth |
TRUE or FALSE. Whether the month of the date of birth will be considered as missing for all the individuals. |
ageImposeDay |
TRUE or FALSE. Whether the day of the date of birth will be considered as missing for all the individuals. |
ageGroup |
if not NULL, a list of ageGroup vectors. |
missingAgeGroupValue |
Value to include if missing age. |
sex |
TRUE or FALSE. If TRUE, sex will be identified. |
sexName |
Sex variable name. |
missingSexValue |
Value to include if missing sex. |
priorObservation |
TRUE or FALSE. If TRUE, days of between the start of the current observation period and the indexDate will be calculated. |
priorObservationName |
Prior observation variable name. |
priorObservationType |
Whether to return a "date" or the number of "days". |
futureObservation |
TRUE or FALSE. If TRUE, days between the indexDate and the end of the current observation period will be calculated. |
futureObservationName |
Future observation variable name. |
futureObservationType |
Whether to return a "date" or the number of "days". |
dateOfBirth |
TRUE or FALSE, if true the date of birth will be return. |
dateOfBirthName |
dateOfBirth column name. |
name |
Name of the new table, if NULL a temporary table is returned. |
cohort table with the added demographic information columns.
library(PatientProfiles) cdm <- mockPatientProfiles() cdm$cohort1 %>% addDemographics() mockDisconnect(cdm = cdm)
library(PatientProfiles) cdm <- mockPatientProfiles() cdm$cohort1 %>% addDemographics() mockDisconnect(cdm = cdm)
'r lifecycle::badge("experimental")' Same as 'addDemographics()', except query is not computed to a table.
addDemographicsQuery( x, indexDate = "cohort_start_date", age = TRUE, ageName = "age", ageMissingMonth = 1, ageMissingDay = 1, ageImposeMonth = FALSE, ageImposeDay = FALSE, ageGroup = NULL, missingAgeGroupValue = "None", sex = TRUE, sexName = "sex", missingSexValue = "None", priorObservation = TRUE, priorObservationName = "prior_observation", priorObservationType = "days", futureObservation = TRUE, futureObservationName = "future_observation", futureObservationType = "days", dateOfBirth = FALSE, dateOfBirthName = "date_of_birth" )
addDemographicsQuery( x, indexDate = "cohort_start_date", age = TRUE, ageName = "age", ageMissingMonth = 1, ageMissingDay = 1, ageImposeMonth = FALSE, ageImposeDay = FALSE, ageGroup = NULL, missingAgeGroupValue = "None", sex = TRUE, sexName = "sex", missingSexValue = "None", priorObservation = TRUE, priorObservationName = "prior_observation", priorObservationType = "days", futureObservation = TRUE, futureObservationName = "future_observation", futureObservationType = "days", dateOfBirth = FALSE, dateOfBirthName = "date_of_birth" )
x |
Table with individuals in the cdm. |
indexDate |
Variable in x that contains the date to compute the demographics characteristics. |
age |
TRUE or FALSE. If TRUE, age will be calculated relative to indexDate. |
ageName |
Age variable name. |
ageMissingMonth |
Month of the year assigned to individuals with missing month of birth. |
ageMissingDay |
day of the month assigned to individuals with missing day of birth. |
ageImposeMonth |
TRUE or FALSE. Whether the month of the date of birth will be considered as missing for all the individuals. |
ageImposeDay |
TRUE or FALSE. Whether the day of the date of birth will be considered as missing for all the individuals. |
ageGroup |
if not NULL, a list of ageGroup vectors. |
missingAgeGroupValue |
Value to include if missing age. |
sex |
TRUE or FALSE. If TRUE, sex will be identified. |
sexName |
Sex variable name. |
missingSexValue |
Value to include if missing sex. |
priorObservation |
TRUE or FALSE. If TRUE, days of between the start of the current observation period and the indexDate will be calculated. |
priorObservationName |
Prior observation variable name. |
priorObservationType |
Whether to return a "date" or the number of "days". |
futureObservation |
TRUE or FALSE. If TRUE, days between the indexDate and the end of the current observation period will be calculated. |
futureObservationName |
Future observation variable name. |
futureObservationType |
Whether to return a "date" or the number of "days". |
dateOfBirth |
TRUE or FALSE, if true the date of birth will be return. |
dateOfBirthName |
dateOfBirth column name. |
cohort table with the added demographic information columns.
library(PatientProfiles) cdm <- mockPatientProfiles() cdm$cohort1 %>% addDemographicsQuery() mockDisconnect(cdm = cdm)
library(PatientProfiles) cdm <- mockPatientProfiles() cdm$cohort1 %>% addDemographicsQuery() mockDisconnect(cdm = cdm)
Compute the number of days till the end of the observation period at a certain date
addFutureObservation( x, indexDate = "cohort_start_date", futureObservationName = "future_observation", futureObservationType = "days", name = NULL )
addFutureObservation( x, indexDate = "cohort_start_date", futureObservationName = "future_observation", futureObservationType = "days", name = NULL )
x |
Table with individuals in the cdm. |
indexDate |
Variable in x that contains the date to compute the future observation. |
futureObservationName |
name of the new column to be added. |
futureObservationType |
Whether to return a "date" or the number of "days". |
name |
Name of the new table, if NULL a temporary table is returned. |
cohort table with added column containing future observation of the individuals.
cdm <- mockPatientProfiles() cdm$cohort1 %>% addFutureObservation() mockDisconnect(cdm = cdm)
cdm <- mockPatientProfiles() cdm$cohort1 %>% addFutureObservation() mockDisconnect(cdm = cdm)
'r lifecycle::badge("experimental")' Same as 'addFutureObservation()', except query is not computed to a table.
addFutureObservationQuery( x, indexDate = "cohort_start_date", futureObservationName = "future_observation", futureObservationType = "days" )
addFutureObservationQuery( x, indexDate = "cohort_start_date", futureObservationName = "future_observation", futureObservationType = "days" )
x |
Table with individuals in the cdm. |
indexDate |
Variable in x that contains the date to compute the future observation. |
futureObservationName |
name of the new column to be added. |
futureObservationType |
Whether to return a "date" or the number of "days". |
cohort table with added column containing future observation of the individuals.
cdm <- mockPatientProfiles() cdm$cohort1 %>% addFutureObservationQuery() mockDisconnect(cdm = cdm)
cdm <- mockPatientProfiles() cdm$cohort1 %>% addFutureObservationQuery() mockDisconnect(cdm = cdm)
Indicate if a certain record is within the observation period
addInObservation( x, indexDate = "cohort_start_date", window = c(0, 0), completeInterval = FALSE, nameStyle = "in_observation", name = NULL )
addInObservation( x, indexDate = "cohort_start_date", window = c(0, 0), completeInterval = FALSE, nameStyle = "in_observation", name = NULL )
x |
Table with individuals in the cdm. |
indexDate |
Variable in x that contains the date to compute the observation flag. |
window |
window to consider events of. |
completeInterval |
If the individuals are in observation for the full window. |
nameStyle |
Name of the new columns to create, it must contain "window_name" if multiple windows are provided. |
name |
Name of the new table, if NULL a temporary table is returned. |
cohort table with the added binary column assessing inObservation.
cdm <- mockPatientProfiles() cdm$cohort1 %>% addInObservation() mockDisconnect(cdm = cdm)
cdm <- mockPatientProfiles() cdm$cohort1 %>% addInObservation() mockDisconnect(cdm = cdm)
'r lifecycle::badge("experimental")' Same as 'addInObservation()', except query is not computed to a table.
addInObservationQuery( x, indexDate = "cohort_start_date", window = c(0, 0), completeInterval = FALSE, nameStyle = "in_observation" )
addInObservationQuery( x, indexDate = "cohort_start_date", window = c(0, 0), completeInterval = FALSE, nameStyle = "in_observation" )
x |
Table with individuals in the cdm. |
indexDate |
Variable in x that contains the date to compute the observation flag. |
window |
window to consider events of. |
completeInterval |
If the individuals are in observation for the full window. |
nameStyle |
Name of the new columns to create, it must contain "window_name" if multiple windows are provided. |
cohort table with the added binary column assessing inObservation.
cdm <- mockPatientProfiles() cdm$cohort1 %>% addInObservationQuery() mockDisconnect(cdm = cdm)
cdm <- mockPatientProfiles() cdm$cohort1 %>% addInObservationQuery() mockDisconnect(cdm = cdm)
Add the ordinal number of the observation period associated that a given date is in.
addObservationPeriodId( x, indexDate = "cohort_start_date", nameObservationPeriodId = "observation_period_id", name = NULL )
addObservationPeriodId( x, indexDate = "cohort_start_date", nameObservationPeriodId = "observation_period_id", name = NULL )
x |
Table with individuals in the cdm. |
indexDate |
Variable in x that contains the date to compute the observation flag. |
nameObservationPeriodId |
Name of the new colum. |
name |
Name of the new table, if NULL a temporary table is returned. |
Table with the current observation period id added.
cdm <- mockPatientProfiles() cdm$cohort1 %>% addObservationPeriodId() mockDisconnect(cdm = cdm)
cdm <- mockPatientProfiles() cdm$cohort1 %>% addObservationPeriodId() mockDisconnect(cdm = cdm)
Add the ordinal number of the observation period associated that a given date is in. Result is not computed, only query is added.
addObservationPeriodIdQuery( x, indexDate = "cohort_start_date", nameObservationPeriodId = "observation_period_id" )
addObservationPeriodIdQuery( x, indexDate = "cohort_start_date", nameObservationPeriodId = "observation_period_id" )
x |
Table with individuals in the cdm. |
indexDate |
Variable in x that contains the date to compute the observation flag. |
nameObservationPeriodId |
Name of the new colum. |
Table with the current observation period id added.
cdm <- mockPatientProfiles() cdm$cohort1 %>% addObservationPeriodIdQuery() mockDisconnect(cdm = cdm)
cdm <- mockPatientProfiles() cdm$cohort1 %>% addObservationPeriodIdQuery() mockDisconnect(cdm = cdm)
Compute the number of days of prior observation in the current observation period at a certain date
addPriorObservation( x, indexDate = "cohort_start_date", priorObservationName = "prior_observation", priorObservationType = "days", name = NULL )
addPriorObservation( x, indexDate = "cohort_start_date", priorObservationName = "prior_observation", priorObservationType = "days", name = NULL )
x |
Table with individuals in the cdm. |
indexDate |
Variable in x that contains the date to compute the prior observation. |
priorObservationName |
name of the new column to be added. |
priorObservationType |
Whether to return a "date" or the number of "days". |
name |
Name of the new table, if NULL a temporary table is returned. |
cohort table with added column containing prior observation of the individuals.
cdm <- mockPatientProfiles() cdm$cohort1 %>% addPriorObservation() mockDisconnect(cdm = cdm)
cdm <- mockPatientProfiles() cdm$cohort1 %>% addPriorObservation() mockDisconnect(cdm = cdm)
'r lifecycle::badge("experimental")' Same as 'addPriorObservation()', except query is not computed to a table.
addPriorObservationQuery( x, indexDate = "cohort_start_date", priorObservationName = "prior_observation", priorObservationType = "days" )
addPriorObservationQuery( x, indexDate = "cohort_start_date", priorObservationName = "prior_observation", priorObservationType = "days" )
x |
Table with individuals in the cdm. |
indexDate |
Variable in x that contains the date to compute the prior observation. |
priorObservationName |
name of the new column to be added. |
priorObservationType |
Whether to return a "date" or the number of "days". |
cohort table with added column containing prior observation of the individuals.
cdm <- mockPatientProfiles() cdm$cohort1 %>% addPriorObservationQuery() mockDisconnect(cdm = cdm)
cdm <- mockPatientProfiles() cdm$cohort1 %>% addPriorObservationQuery() mockDisconnect(cdm = cdm)
Compute the sex of the individuals
addSex(x, sexName = "sex", missingSexValue = "None", name = NULL)
addSex(x, sexName = "sex", missingSexValue = "None", name = NULL)
x |
Table with individuals in the cdm. |
sexName |
name of the new column to be added. |
missingSexValue |
Value to include if missing sex. |
name |
Name of the new table, if NULL a temporary table is returned. |
table x with the added column with sex information.
cdm <- mockPatientProfiles() cdm$cohort1 %>% addSex() mockDisconnect(cdm = cdm)
cdm <- mockPatientProfiles() cdm$cohort1 %>% addSex() mockDisconnect(cdm = cdm)
'r lifecycle::badge("experimental")' Same as 'addSex()', except query is not computed to a table.
addSexQuery(x, sexName = "sex", missingSexValue = "None")
addSexQuery(x, sexName = "sex", missingSexValue = "None")
x |
Table with individuals in the cdm. |
sexName |
name of the new column to be added. |
missingSexValue |
Value to include if missing sex. |
table x with the added column with sex information.
cdm <- mockPatientProfiles() cdm$cohort1 %>% addSexQuery() mockDisconnect(cdm = cdm)
cdm <- mockPatientProfiles() cdm$cohort1 %>% addSexQuery() mockDisconnect(cdm = cdm)
Compute number of intersect with an omop table.
addTableIntersectCount( x, tableName, indexDate = "cohort_start_date", censorDate = NULL, window = list(c(0, Inf)), targetStartDate = startDateColumn(tableName), targetEndDate = endDateColumn(tableName), nameStyle = "{table_name}_{window_name}", name = NULL )
addTableIntersectCount( x, tableName, indexDate = "cohort_start_date", censorDate = NULL, window = list(c(0, Inf)), targetStartDate = startDateColumn(tableName), targetEndDate = endDateColumn(tableName), nameStyle = "{table_name}_{window_name}", name = NULL )
x |
Table with individuals in the cdm. |
tableName |
Name of the table to intersect with. Options: visit_occurrence, condition_occurrence, drug_exposure, procedure_occurrence, device_exposure, measurement, observation, drug_era, condition_era, specimen, episode. |
indexDate |
Variable in x that contains the date to compute the intersection. |
censorDate |
whether to censor overlap events at a specific date or a column date of x. |
window |
window to consider events in. |
targetStartDate |
Column name with start date for comparison. |
targetEndDate |
Column name with end date for comparison. |
nameStyle |
naming of the added column or columns, should include required parameters. |
name |
Name of the new table, if NULL a temporary table is returned. |
table with added columns with intersect information.
cdm <- mockPatientProfiles() cdm$cohort1 %>% addTableIntersectCount(tableName = "visit_occurrence") mockDisconnect(cdm = cdm)
cdm <- mockPatientProfiles() cdm$cohort1 %>% addTableIntersectCount(tableName = "visit_occurrence") mockDisconnect(cdm = cdm)
Compute date of intersect with an omop table.
addTableIntersectDate( x, tableName, indexDate = "cohort_start_date", censorDate = NULL, window = list(c(0, Inf)), targetDate = startDateColumn(tableName), order = "first", nameStyle = "{table_name}_{window_name}", name = NULL )
addTableIntersectDate( x, tableName, indexDate = "cohort_start_date", censorDate = NULL, window = list(c(0, Inf)), targetDate = startDateColumn(tableName), order = "first", nameStyle = "{table_name}_{window_name}", name = NULL )
x |
Table with individuals in the cdm. |
tableName |
Name of the table to intersect with. Options: visit_occurrence, condition_occurrence, drug_exposure, procedure_occurrence, device_exposure, measurement, observation, drug_era, condition_era, specimen, episode. |
indexDate |
Variable in x that contains the date to compute the intersection. |
censorDate |
whether to censor overlap events at a specific date or a column date of x. |
window |
window to consider events in. |
targetDate |
Target date in tableName. |
order |
which record is considered in case of multiple records (only required for date and days options). |
nameStyle |
naming of the added column or columns, should include required parameters. |
name |
Name of the new table, if NULL a temporary table is returned. |
table with added columns with intersect information.
cdm <- mockPatientProfiles() cdm$cohort1 %>% addTableIntersectDate(tableName = "visit_occurrence") mockDisconnect(cdm = cdm)
cdm <- mockPatientProfiles() cdm$cohort1 %>% addTableIntersectDate(tableName = "visit_occurrence") mockDisconnect(cdm = cdm)
Compute time to intersect with an omop table.
addTableIntersectDays( x, tableName, indexDate = "cohort_start_date", censorDate = NULL, window = list(c(0, Inf)), targetDate = startDateColumn(tableName), order = "first", nameStyle = "{table_name}_{window_name}", name = NULL )
addTableIntersectDays( x, tableName, indexDate = "cohort_start_date", censorDate = NULL, window = list(c(0, Inf)), targetDate = startDateColumn(tableName), order = "first", nameStyle = "{table_name}_{window_name}", name = NULL )
x |
Table with individuals in the cdm. |
tableName |
Name of the table to intersect with. Options: visit_occurrence, condition_occurrence, drug_exposure, procedure_occurrence, device_exposure, measurement, observation, drug_era, condition_era, specimen, episode. |
indexDate |
Variable in x that contains the date to compute the intersection. |
censorDate |
whether to censor overlap events at a specific date or a column date of x. |
window |
window to consider events in. |
targetDate |
Target date in tableName. |
order |
which record is considered in case of multiple records (only required for date and days options). |
nameStyle |
naming of the added column or columns, should include required parameters. |
name |
Name of the new table, if NULL a temporary table is returned. |
table with added columns with intersect information.
cdm <- mockPatientProfiles() cdm$cohort1 %>% addTableIntersectDays(tableName = "visit_occurrence") mockDisconnect(cdm = cdm)
cdm <- mockPatientProfiles() cdm$cohort1 %>% addTableIntersectDays(tableName = "visit_occurrence") mockDisconnect(cdm = cdm)
Intersecting the cohort with columns of an OMOP table of user's choice. It will add an extra column to the cohort, indicating the intersected entries with the target columns in a window of the user's choice.
addTableIntersectField( x, tableName, field, indexDate = "cohort_start_date", censorDate = NULL, window = list(c(0, Inf)), targetDate = startDateColumn(tableName), order = "first", nameStyle = "{table_name}_{extra_value}_{window_name}", name = NULL )
addTableIntersectField( x, tableName, field, indexDate = "cohort_start_date", censorDate = NULL, window = list(c(0, Inf)), targetDate = startDateColumn(tableName), order = "first", nameStyle = "{table_name}_{extra_value}_{window_name}", name = NULL )
x |
Table with individuals in the cdm. |
tableName |
Name of the table to intersect with. Options: visit_occurrence, condition_occurrence, drug_exposure, procedure_occurrence, device_exposure, measurement, observation, drug_era, condition_era, specimen, episode. |
field |
The columns from the table in tableName to intersect over. For example, if the user uses visit_occurrence in tableName then for field the possible options include visit_occurrence_id, visit_concept_id, visit_type_concept_id. |
indexDate |
Variable in x that contains the date to compute the intersection. |
censorDate |
whether to censor overlap events at a specific date or a column date of x. |
window |
window to consider events in when intersecting with the chosen column. |
targetDate |
The dates in the target columns in tableName that the user may want to restrict to. |
order |
which record is considered in case of multiple records (only required for date and days options). |
nameStyle |
naming of the added column or columns, should include required parameters. |
name |
Name of the new table, if NULL a temporary table is returned. |
table with added columns with intersect information.
cdm <- mockPatientProfiles() cdm$cohort1 %>% addTableIntersectField( tableName = "visit_occurrence", field = "visit_concept_id", order = "last", window = c(-Inf, -1) ) mockDisconnect(cdm = cdm)
cdm <- mockPatientProfiles() cdm$cohort1 %>% addTableIntersectField( tableName = "visit_occurrence", field = "visit_concept_id", order = "last", window = c(-Inf, -1) ) mockDisconnect(cdm = cdm)
Compute a flag intersect with an omop table.
addTableIntersectFlag( x, tableName, indexDate = "cohort_start_date", censorDate = NULL, window = list(c(0, Inf)), targetStartDate = startDateColumn(tableName), targetEndDate = endDateColumn(tableName), nameStyle = "{table_name}_{window_name}", name = NULL )
addTableIntersectFlag( x, tableName, indexDate = "cohort_start_date", censorDate = NULL, window = list(c(0, Inf)), targetStartDate = startDateColumn(tableName), targetEndDate = endDateColumn(tableName), nameStyle = "{table_name}_{window_name}", name = NULL )
x |
Table with individuals in the cdm. |
tableName |
Name of the table to intersect with. Options: visit_occurrence, condition_occurrence, drug_exposure, procedure_occurrence, device_exposure, measurement, observation, drug_era, condition_era, specimen, episode. |
indexDate |
Variable in x that contains the date to compute the intersection. |
censorDate |
whether to censor overlap events at a specific date or a column date of x. |
window |
window to consider events in. |
targetStartDate |
Column name with start date for comparison. |
targetEndDate |
Column name with end date for comparison. |
nameStyle |
naming of the added column or columns, should include required parameters. |
name |
Name of the new table, if NULL a temporary table is returned. |
table with added columns with intersect information.
cdm <- mockPatientProfiles() cdm$cohort1 %>% addTableIntersectFlag(tableName = "visit_occurrence") mockDisconnect(cdm = cdm)
cdm <- mockPatientProfiles() cdm$cohort1 %>% addTableIntersectFlag(tableName = "visit_occurrence") mockDisconnect(cdm = cdm)
Show the available estimates that can be used for the different variable_type supported.
availableEstimates(variableType = NULL, fullQuantiles = FALSE)
availableEstimates(variableType = NULL, fullQuantiles = FALSE)
variableType |
A set of variable types. |
fullQuantiles |
Whether to display the exact quantiles that can be computed or only the qXX to summarise all of them. |
A tibble with the available estimates.
library(PatientProfiles) availableEstimates() availableEstimates("numeric") availableEstimates(c("numeric", "categorical"))
library(PatientProfiles) availableEstimates() availableEstimates("numeric") availableEstimates(c("numeric", "categorical"))
Get the name of the end date column for a certain table in the cdm
endDateColumn(tableName)
endDateColumn(tableName)
tableName |
Name of the table. |
Name of the end date column in that table.
library(PatientProfiles) endDateColumn("condition_occurrence")
library(PatientProfiles) endDateColumn("condition_occurrence")
Function to disconnect from the mock
mockDisconnect(cdm)
mockDisconnect(cdm)
cdm |
A cdm_reference object. |
It creates a mock database for testing PatientProfiles package
mockPatientProfiles( con = NULL, writeSchema = NULL, numberIndividuals = 10, ..., seed = NULL )
mockPatientProfiles( con = NULL, writeSchema = NULL, numberIndividuals = 10, ..., seed = NULL )
con |
A DBI connection to create the cdm mock object. |
writeSchema |
Name of an schema on the same connection with writing permisions. |
numberIndividuals |
Number of individuals to create in the cdm reference. |
... |
User self defined tables to put in cdm, it can input as many as the user want. |
seed |
A number to set the seed. If NULL seed is not used. |
A mock cdm_reference object created following user's specifications.
library(PatientProfiles) library(CDMConnector) cdm <- mockPatientProfiles() mockDisconnect(cdm = cdm)
library(PatientProfiles) library(CDMConnector) cdm <- mockPatientProfiles() mockDisconnect(cdm = cdm)
Get the name of the source concept_id column for a certain table in the cdm
sourceConceptIdColumn(tableName)
sourceConceptIdColumn(tableName)
tableName |
Name of the table. |
Name of the source_concept_id column in that table.
library(PatientProfiles) sourceConceptIdColumn("condition_occurrence")
library(PatientProfiles) sourceConceptIdColumn("condition_occurrence")
Get the name of the standard concept_id column for a certain table in the cdm
standardConceptIdColumn(tableName)
standardConceptIdColumn(tableName)
tableName |
Name of the table. |
Name of the concept_id column in that table.
library(PatientProfiles) standardConceptIdColumn("condition_occurrence")
library(PatientProfiles) standardConceptIdColumn("condition_occurrence")
Get the name of the start date column for a certain table in the cdm
startDateColumn(tableName)
startDateColumn(tableName)
tableName |
Name of the table. |
Name of the start date column in that table.
library(PatientProfiles) startDateColumn("condition_occurrence")
library(PatientProfiles) startDateColumn("condition_occurrence")
Summarise variables using a set of estimate functions. The output will be a formatted summarised_result object.
summariseResult( table, group = list(), includeOverallGroup = FALSE, strata = list(), includeOverallStrata = TRUE, variables = NULL, estimates = c("min", "q25", "median", "q75", "max", "count", "percentage"), counts = TRUE )
summariseResult( table, group = list(), includeOverallGroup = FALSE, strata = list(), includeOverallStrata = TRUE, variables = NULL, estimates = c("min", "q25", "median", "q75", "max", "count", "percentage"), counts = TRUE )
table |
Table with different records. |
group |
List of groups to be considered. |
includeOverallGroup |
TRUE or FALSE. If TRUE, results for an overall group will be reported when a list of groups has been specified. |
strata |
List of the stratifications within each group to be considered. |
includeOverallStrata |
TRUE or FALSE. If TRUE, results for an overall strata will be reported when a list of strata has been specified. |
variables |
Variables to summarise, it can be a list to point to different set of estimate names. |
estimates |
Estimates to obtain, it can be a list to point to different set of variables. |
counts |
Whether to compute number of records and number of subjects. |
A summarised_result object with the summarised data of interest.
library(PatientProfiles) library(dplyr) cdm <- mockPatientProfiles() x <- cdm$cohort1 %>% addDemographics() %>% collect() result <- summariseResult(x) mockDisconnect(cdm = cdm)
library(PatientProfiles) library(dplyr) cdm <- mockPatientProfiles() x <- cdm$cohort1 %>% addDemographics() %>% collect() result <- summariseResult(x) mockDisconnect(cdm = cdm)
Classify the variables between 5 types: "numeric", "categorical", "binary", "date", or NA.
variableTypes(table)
variableTypes(table)
table |
Tibble. |
Tibble with the variables type and classification.
library(PatientProfiles) x <- dplyr::tibble( person_id = c(1, 2), start_date = as.Date(c("2020-05-02", "2021-11-19")), asthma = c(0, 1) ) variableTypes(x)
library(PatientProfiles) x <- dplyr::tibble( person_id = c(1, 2), start_date = as.Date(c("2020-05-02", "2021-11-19")), asthma = c(0, 1) ) variableTypes(x)