Description Usage Arguments Details Value Examples
The get_prescriptions family of functions (get_prescriptions
)
provides an interface to query the prescriptions drug table in the Truven Marketscan Health
Research Database. The get_prescriptions
function extracts data verbatim from the
prescriptions_drug table. The get_patient_id_prescriptions
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.
1 2 3 4 5 6 7 8 | get_prescriptions(optional_q_table_name = "prescription_drug",
columns_to_return, start, end, optional_ndc_codes = "__NULL__",
optional_enrolids = "__NULL__", api_function = "get_prescriptions",
return_all_flag = F, ...)
get_patient_id_prescriptions(optional_q_table_name = "prescription_drug",
start, end, optional_ndc_codes = "__NULL__",
optional_enrolid = "__NULL__", ...)
|
optional_q_table_name |
an optional field where the name of the prescriptions table may be passed. The function sets a default table name called "prescriptions" 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 inpatient 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_ndc_codes |
a character vector of ndcnum (NDC) codes |
optional_enrolids |
an integer vector of enrolid values |
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 |
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. |
get_stats |
a boolean variable indicating whether query statistics should be printed |
The get_prescriptions
& get_patient_id_prescriptions
functions allow the user to retrieve
data from the prescriptions table in the Truven Health MarketScan® Research Database.
The Pharmaceutical Claims Data (Prescription Drug) dataset is part of the Truven Health Marketscan's Commercial Claims & Encounters database and contains claims for drugs filled at pharmacies. The table provides detailed information on the drugs dispensed, including data on days of supply, ingredient cost, NDC number, Refill indicator and other important variables. Apart from drug-related information, the dataset 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: The outpatient pharmaceutical data are linked by ENROLID to the medical/surgical data. Each record represents either a mail-order or card program prescription drug claim.
Note: Before you begin your analysis, carefully determine which data sources (e.g., medical/surgical, outpatient pharmaceutical, enrollment) will be necessary to support your analytic plan. If you require more than one of these data sources, it first may be necessary to utilize the various cohort flags to determine which data contributors or plans have the required data (via RX, MHSACOVG, and/or EIDFLAG/ENRFLAG variables).
A data.table with the results of the query
1 2 3 4 5 6 7 8 9 10 11 12 13 | # extract data from prescriptions table
# extract enrolid, ndcnum and svcdate from prescription drug table between svcdates 2015.03.04
# and 2015.03.07 for ndcnum (NDC) code c("00555099702")
get_prescriptions(start="2015.03.04",end="2015.03.07",optional_ndc_codes = c("00555099702"),
columns_to_return = c("enrolid","ndcnum","svcdate"))
# extract first svcdate (index date) by patient id (enrolid) from prescription_drug table
# between svcdates 2015.03.04 and 2015.03.07 for ndcnum (NDC) code c("00555099702")
get_patient_id_prescriptions(start="2015.03.04",end="2015.03.07",optional_ndc_codes =
c("00555099702"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.