The last decade has seen a considerable growth in data generated by scientific instrumentation. Accountability requirements have grown similarly, requiring forensic toxicology laboratories to generate summary of findings to funders, stakeholders and the general public. This work aims to show how the programming language R and its integrated development environment (IDE) RStudio can be harnessed to speed up data analysis and produce summary reports in three different forensic toxicology applications. R version 3.6.1 or above and RStudio® version 1.2.5001 or above were used in developing and implementing all applications. A wide array of packages were employed, including readr, readtext and docxtractr to import data; tidyr and dplyr for data preparation (“wrangling”); stringr for text manipulation; ggplot2 and plotly for data visualization; rmarkdown to generate HTML and PDF reports; and shiny for the creation of interactive web applications. Automation can begin with the instrumental output analysis. The authors have already published two such examples (Desharnais et al. Journal of Analytical Toxicology 2017;41:261–268 and Desharnais et al. Journal of Analytical Toxicology 2019;43:512–519). A new example presented here is the implementation of trend monitoring, as required for the ISO 17025 accreditation. An interactive application allows for importation of raw instrument output into the database and periodic creation of PDF reports assessing a number of fixed criteria for the wide-scope LC-MS/MS method under analysis. Furthermore, a diagnostic tool allows interactive creation of scatterplots where a variable of interest (area, area ratio, concentration) is plotted for selected time frame, instrument(s), sample type(s) (e.g., standards, QC) and analytes. This allows to not only identify concerns via the presence of warning and action lines, but to explore potential causes of instrument issues with a single tool, which decreases troubleshooting time. This type of interactive data exploration is also possible for casework. Indeed, an application allowing inquiry into basically all variables related to driving under the influence of drugs or alcohol cases was built. The user can obtain summary statistics (e.g., total number of cases) and graphs (e.g., bar plots) by selecting and/or modulating one or more of the following: biological matrix analyzed, drug(s) detected, concentration, administrative region, date and time of the event, etc. As an example, with a few clicks, the user can find out how many DUI cases included a combination of THC and flubromazolam between June 2020 and September 2021 in a given city. This allows for seamless production of yearly reports (within 30 minutes instead of 3 days) as well as quick answers to punctual inquiries by other stakeholders such as police officers, prosecutors and deputy ministers. Annual summary reports can also be extracted from atypical datasets, such as toxicology reports in .docx or PDF format. Using this tool, a periodic update of xenobiotics concentrations found in postmortem casework can be quickly performed. Toxicologists can therefore inform their interpretation with recent data from within the lab–without a time-consuming manual search. It also allows for the production of an annual prospectus designed for the general public, summarizing the caseload and findings. When a suitable Laboratory Information Management System (LIMS) is not available, or mis-adapted to accomplish the desired task, R and its IDE RStudio offer unparalleled power and flexibility to achieve data importation, analysis and presentation. Since they are both available at no cost, the online documentation and community to support the user is vast, which is an advantage for laboratories with scant resources. In order to add another pillar to this network, the creation of an R User Group in Forensic Toxicology is first announced here.
Read full abstract