searchCasesByLOINC

searchCasesByLOINC(
  labData,
  idColName = NULL,
  loincColName = NULL,
  dateColName = NULL,
  condition,
  isSummary = FALSE
)

Arguments

labData

a file or dataframe of laboratory test data with at least 4 columns about patient ID, lab item, test value and test date, respectively.

idColName

the column name that records patient ID in labData.

loincColName

tthe column name that records LOINC in labData.

dateColName

the column name that records test date in labData. It should be in "YYYYMMDD"/"YYYY-MM-DD" format.

condition

desired keyword string.

isSummary

summary T or F

Value

A data.table merged two tables.

Details

LOINC provides a column to record related names for lab tests. This function can be used to search this kind of description. Only searching LOINC codes are also avaliable, but not recoommended.

Examples

loincSample <- mapLOINC(labData = labSample,
                       labItemColName = ITEMID,
                       mappingTable = mapSample)
searchCasesByLOINC(labData = loincSample,
                  idColName = SUBJECT_ID,
                  loincColName = LOINC,
                  dateColName = CHARTTIME,
                  condition = "Creatinine",
                  isSummary = TRUE)
#>     ID  LOINC Count firstRecord lastRecode
#> 1:  36 2160-0    37  2131-04-30 2134-05-20
#> 2: 109 2160-0   238  2137-11-04 2142-08-30
#> 3: 132 2160-0    32  2115-05-06 2116-04-08
#> 4: 143 2160-0    60  2154-12-25 2155-10-22
#> 5: 145 2160-0   162  2144-03-29 2145-02-22