getEligiblePeriod: Data integration for patient record period

View source: R/getEligiblePeriod.R

getEligiblePeriodR Documentation

Data integration for patient record period

Description

getEligiblePeriod is a function to find the first and last clinical event for a given patient. The result can be index date in the folloing process such as splitDataByDate.

Usage

getEligiblePeriod(dxDataFile, idColName, dateColName)

Arguments

dxDataFile

A data frame object of clinical diagnostic data with at least 3 columns: ID, ICD, and Date. As for date column, the data format should be YYYY/MM/DD or YYYY-MM-DD.

idColName

Column name of ID column in dxDataFile. Data type of this argumant should be string without quotation marks.

dateColName

Column name of date column in dxDataFile, and the type of date column should be a date format in R or a string format with date information in YYYY/MM/DD or YYYY-MM-DD. Data type of this argumant should be string without quotation marks.

Details

The function queries the earliest and latest admission date for each patient.

Value

A new data.table based on dxDataFile with the earliest and latest admission date for each patient.

See Also

Other data integration functions: selectCases, splitDataByDate, getConditionEra

Examples

# sample file for example

head(sampleDxFile)

# Earliest and latest admission date for each patient

record <- getEligiblePeriod(sampleDxFile, ID, Date)
head(record)

DHLab-CGU/emr documentation built on Sept. 2, 2023, 9:16 p.m.