get_outpatient_services: extract data from the outpatient services table

Description Usage Arguments Details Value Examples

Description

The outpatient_services family of functions (get_outpatient_services) provides an interface to query the outpatient_services table in the Truven Marketscan Health Research Database. The get_outpatient_services function extracts data verbatim from the outpatient_servives table. The get_patient_id_outpatient function extracts the index date (i.e., the first date of service) corresponding to patient ids (generally the 'enrolid') within the given date range and if applicable, optional parameters.

Usage

1
2
3
4
5
6
7
8
9
get_outpatient_services(optional_q_table_name = "outpatient_services",
  columns_to_return, start, end, optional_diag_codes = "__NULL__",
  optional_enrolids = "__NULL__", return_all_flag = F,
  api_function = "get_outpatient_services", ...)

get_patient_id_outpatient(optional_q_table_name = "outpatient_services",
  start, end, optional_diag_codes = "__NULL__",
  optional_enrolids = "__NULL__", return_all_flag = F,
  api_function = "get_patient_id_outpatient", ...)

Arguments

optional_q_table_name

an optional field where the name of the outpatient_services table may be passed. The function sets a default table name called "outpatient_services" which is used when the user does not provide a table name

columns_to_return

a character vector of columns names corresponding to the names of the table headers (columns) in the outpatient services table.

start

the start date for the query. This should be of the form yyyy.mm.dd and must be passed as a character. For example, to pass June 30, 2017, the value of the start parameter should be "2017.06.30"

end

the end date for the query. This should be of the form yyyy.mm.dd and must be passed as a character. For example, to pass Nov. 30, 2017, the value of the start parameter should be "2017.11.30"

optional_diag_codes

a character vector of dx (diagnosis) codes

optional_enrolids

an integer vector of enrolid values

return_all_flag

a boolean value indicating whether all the data should be returned to R. This parameter generally defaults to FALSE since returning large amounts of data to the R Session may take time. It should be set to TRUE only if you are certain that you'd like to load all the data that is a result of the query into your session.

api_function

a variable indicating the name of the function. It is unlikely that you'll ever need to change the value of this parameter and it is best left as-is

get_stats

a boolean variable indicating whether query statistics should be printed

Details

The outpatient_services functions allow the user to retrieve data from the outpatient_services table in the Truven Health MarketScan® Research Database.

The Outpatient Services dataset is part of the Truven Health Marketscan's Commercial Claims & Encounters database that contains claims information for services provided in a doctor's office, emergency rooms, and other similar settings not requiring a hospital stay. The table provides detailed information on pre-admission treatment such as diagnosis codes, co-insurance amounts and other variables. It also contains detailed patient-level demographic data such as age, gender, employment-related information and others on a per-record basis. Additional information from Truven: "A small percentage of claims in this table may represent inpatient services, because the claim was not incorporated into an inpatient admission (e.g., no room and board charge was found). These claims generally have an “inpatient” Place of Service (STDPLAC) code."

Value

A data.table with the results of the query

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# extract data from outpatient_services table

# extract age and month from outpatient_services between svcdates 2015.03.04 and 2015.03.07 for diagnosis (dx)
# codes (\code{c("32723","4439")}) and enrolids \code{c(8601,12901)}

get_outpatient_services(columns_to_return=c("age","month"),start="2015.03.04",end="2015.03.07",
optional_diag_codes=c("32723","4439"), optional_enrolids=c(8601,12901),return_all_flag=F,get_stats="TRUE")

# extract age and month from outpatient_services between svcdates 2015.03.04 and 2015.03.05 for diagnosis (dx)
# codes (\code{c("32723","4439")}) and return all data

get_outpatient_services(columns_to_return=c("age","month"),start="2015.03.04",end="2015.03.05",
optional_diag_codes=c("32723","4439"),return_all_flag=T,get_stats="TRUE")

xbsd/rxdsapi2 documentation built on May 14, 2019, 11:08 a.m.