TITLE: Protocol for Medication Possession Ratio (MPR) Calculation
AUTHORS: Pryscila Rodrigues Moreira, Leonardo Teodoro de Farias, Ana Carolina Figueiredo Modesto

[DESCRIPTION]
The Medication Possession Ratio (MPR) provides an estimate of patient adherence based on the actual possession of medications. It is a metric that offers crucial information to assist in the development of strategies for the proper management of chronic diseases, such as Chronic Myeloid Leukemia (CML). RStudio is a free, open-source software maintained by an active community of developers, ensuring frequent updates and specialized packages in the healthcare domain. This software can be easily integrated into the practices of healthcare professionals for MPR calculations, optimizing their activities and allowing more time for direct patient care. In this context, a protocol was developed using the R programming language for MPR calculation, utilizing a spreadsheet with Tyrosine Kinase Inhibitor dispensation data. This script provides flexibility for MPR calculations to be applied to any chronic disease.



[BEFORE_START]
The RStudio program must be installed on the computer. If it is not installed, the link below provides the tutorial for download.

https://posit.co/download/rstudio-desktop/

[STEPS]
SECTION: Loading the packages
2. Every time you open the software, you should load the following
packages:
 

SECTION: Setting the working directory to a specific path
3. Setting the working directory is important because it determines the default location for reading and writing files.
1-    In RStudio, go to the "Session" menu.
2-    Select "Set Working Directory" and choose "Choose Directory..."
3-    Navigate to the directory
# Alternatively, you can use the command below:
 

SECTION: Reading CSV file
4. # Here we read the data file called "file­.mpr." and store it in a variable called MPR.
# The read.csv2 function is used to read data from a CSV file where the column separator is a semicolon (;).
# The argument "file.mpr" represents the name of the file to be read. You should download the spreadsheet with the medication dispensation data from your institution's dispensation system. In
this example, the obtained spreadsheet contains: Medication name, number of
dispensed units, and patient medical record number. We chose to use the medical
record number to avoid homonyms.
 
# Now, the variable MPR contains the data from the CSV file, and you can manipulate or perform additional analyses as needed.
SECTION: Selecting the columns of interest
5. Now, we select the columns that are relevant to our analysis and store them in a new variable called MPR1.
 

SECTION: Inspecting the Database
6. We use the "glimpse" command to visualize the structure of our MPR1 dataset.
 

SECTION: Transforming the medical.record column into character
7. In this step, we convert the by "Medical.record" column into characters to ensure it is handled correctly.
 

 
SECTION: Calculating the percentage
8.  We perform calculations in the "Dispensed" column based on the conditions specified for each
"drug".
We also group the data by "Medical.record "and "drug" and calculate the percentagem.
 

SECTION: Sorting the table alphabetically by Drug
9. Now we sort the data alphabetically based on the "Drug" column.
 

SECTION: Saving the result to a .docx file
10. Here we create a flexible table (ft) and adjust its properties such as width and alignment.
 

SECTION: Saving the .docx document
11.  Finally, we save the document with the name "MPR_Percentagem.docx" in the specified location.
 

SECTION: Installing the packages
1. In the specific context of this script, the section "Installing the packages" is dedicated to
installing additional packages that are necessary to execute the subsequent analyses. Each line install.packages("package_name") installs a specific package. Press Ctrl + Enter to run the code. The
code is as follows: