Title: | Analyze Data from Electronic Adherence Monitoring Devices |
---|---|
Description: | Medication adherence, defined as medication-taking behavior that aligns with the agreed-upon treatment protocol, is critical for realizing the benefits of prescription medications. Medication adherence can be assessed using electronic adherence monitoring devices (EAMDs), pill bottles or boxes that contain a computer chip that records the date and time of each opening (or “actuation”). Before researchers can use EAMD data, they must apply a series of decision rules to transform actuation data into adherence data. The purpose of this R package ('oncmap') is to transform EAMD actuations in the form of a raw .csv file, information about the patient, regimen, and non-monitored periods into two daily adherence values -- Dose Taken and Correct Dose Taken. |
Authors: | Michal Kouril [aut, cre]
|
Maintainer: | Michal Kouril <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.5 |
Built: | 2025-01-27 23:35:23 UTC |
Source: | CRAN |
Pre-process time data for adherence
adherence_preprocess( timestamps, regimen, patinfo = list(), nonmonit = data.frame() )
adherence_preprocess( timestamps, regimen, patinfo = list(), nonmonit = data.frame() )
timestamps |
Input timestamps - vector of timestamps |
regimen |
Regimen - regimen definition |
patinfo |
Patient info - patient specific information |
nonmonit |
Non-monitored date intervals |
A list of output variables
all_periods
- Processed timestamps into periods applying input parameters.
Defines input format parameters to apply when reading input files.
input_formats
input_formats
One input format per row described by the following variables:
skip_header_lines
double Number of lines to skip before reading data
header_line_patientid
character Regex to apply to the header line to extract patient ID
patientid_filename
logical Patient id is embedded in the filename
deviceid_header
character Device ID column in the input data
headers
character Comma separated list of expected column headers
patientid_header
character Patient ID column in the input data
datetime_header
character Actuation Date/Time column in the input data
datetime_format
character Actuation Date/Time format
filter
character Inclusion/Exclusion filter to apply on the input data
tz_colon_fix
logical Fix for when TZ contains with ':'
Process input file and return adherence report
process_eamd( infile, include_formats = NULL, exclude_formats = NULL, formats_def = NULL, infile_data_output = FALSE, regimen = NULL, patinfo = NULL, nonmonit = NULL, med = "", adhstart = NULL, adhend = NULL )
process_eamd( infile, include_formats = NULL, exclude_formats = NULL, formats_def = NULL, infile_data_output = FALSE, regimen = NULL, patinfo = NULL, nonmonit = NULL, med = "", adhstart = NULL, adhend = NULL )
infile |
Input CSV file name |
include_formats |
Which formats to include in checking |
exclude_formats |
Which formats to exclude from checking |
formats_def |
New formats definition |
infile_data_output |
Include infile data frame in the result |
regimen |
Regimen - regimen definition |
patinfo |
Patient info - patient specific information |
nonmonit |
Non-monitored date intervals |
med |
Medication name |
adhstart |
Report adherence start date |
adhend |
Report adherence end date |
A list containing variables:
report
- Per period adherence statistic
adh
- Summary adherence statistic
input_file <- system.file('extdata', 'sample-data-ecap2.csv', package = 'oncmap') report <- process_eamd("tests/testthat/ecap1.csv")
input_file <- system.file('extdata', 'sample-data-ecap2.csv', package = 'oncmap') report <- process_eamd("tests/testthat/ecap1.csv")
Read input file
read_input( infile, include_formats = NULL, exclude_formats = NULL, formats_def = NULL, infile_data_output = FALSE )
read_input( infile, include_formats = NULL, exclude_formats = NULL, formats_def = NULL, infile_data_output = FALSE )
infile |
Input CSV file name |
include_formats |
Which formats to include in checking |
exclude_formats |
Which formats to exclude from checking |
formats_def |
New formats definition |
infile_data_output |
Include infile data frame in the result |
A list of output variables
format
- Detected input format name
format_def
- Detected format definition
patient_id
- Extracted patient_id
device_id
- Extracted device_id
data
- Extracted timestamps
log
- Log of the format detection
infile_data
- Raw input data
input_file <- system.file('extdata', 'sample-data-ecap2.csv', package = 'oncmap') input <- read_input("tests/testthat/ecap1.csv")
input_file <- system.file('extdata', 'sample-data-ecap2.csv', package = 'oncmap') input <- read_input("tests/testthat/ecap1.csv")
Defines built-in regimen definitions.
regimens
regimens
One regimen per row described by the following variables:
name
character A name of the regimen
doses_per_period
integer Number of doses per period
periods_per_day
integer Number of periods per day
min_wait
integer Minimum wait time (in seconds) between actuations
days_per_week
integer Number of active days per week
weekdays
string Specific days per week when active
Report standarized output of the adherence processing
report_adherence( all_periods, timestamps, med, patinfo = list(), adhstart = NULL, adhend = NULL )
report_adherence( all_periods, timestamps, med, patinfo = list(), adhstart = NULL, adhend = NULL )
all_periods |
output of pre_adherence processing |
timestamps |
timestamps dataframe from pre_adherence to calculate times and diffs in the report |
med |
Medication name |
patinfo |
Patient info - patient specific information |
adhstart |
Report adherence start date |
adhend |
Report adherence end date |
A list of output variables
report
- Per period adherence statistic
adh
- Summary adherence statistic