Journal List > Transl Clin Pharmacol > v.25(3) > 1082660

Han, Cho, Yoon, Kim, and Bae: Caffsim: simulation of plasma caffeine concentrations implemented as an R package and Web-applications

Abstract

Caffeine is a naturally-occurring central nervous system stimulant found in plant constituents including coffee, cocoa beans, and tea leaves. Consumption of caffeine through imbibing caffeinated drinks is rapidly growing among children, adolescents, and young adults, who tend to be more caffeine-sensitive than the rest of the general public; consequently, caffeine-related toxicities among these groups are also growing in number. However, a quantitative and interactive tool for predicting the plasma caffeine concentration that may lead to caffeine intoxication has yet to be developed. Using the previously established population-pharmacokinetic model, we developed “caffsim” R package and its web-based applications using Shiny and EDISON (EDucation-research Integration through Simulation On the Net). The primary aim of the software is to easily predict and calculate plasma caffeine concentration and pharmacokinetic parameters and visualize their changes after single or multiple ingestions of caffeine. The caffsim R package helps understand how plasma caffeine concentration changes over time and how long toxic concentration of caffeine can last in caffeine-sensitive groups. It may also help clinical evaluation of relationship between caffeine intake and toxicities when suspicious acute symptoms occur.

Introduction

Caffeine is a naturally occurring mild central nervous system stimulant that is found in plant constituents such as coffee, cocoa beans, and tea leaves. Caffeine has a long history of human consumption, and is currently used worldwide for enhancing wakefulness, relieving fatigue, and improving mental concentration. Generally, consumption of 400 mg of caffeine per day is safe for healthy adults, which is approximately the amount of caffeine in four cups of brewed coffee, 10 cans of cola, or two caffeinated drinks.[1] Although typical caffeine use is safe for healthy adults, its effects can be significantly different in caffeine-sensitive groups such as low-weight people including children and adolescents, and the consumption of caffeinated drinks is rapidly growing in these groups.[2] Consequently, caffeine-related toxicities are growing in number as well[3]; effects of caffeine intoxication include hallucinations, seizures, metabolic acidosis, rhabdomyolysis, and arrhythmias.[4] and several reports have associated caffeinated-drink ingestion with serious caffeine intoxication.[56] In most of cases of emergency room visits related to caffeine intoxication, the patients present with tachyarrhythmia and involves consumption of extremely high doses of caffeine (> 3 mg/kg).[3] Recently, a series of investigations of high caffeine exposure in adolescents revealed behavioral consequences including sleep-pattern change.[78]
To better explain the relationship between caffeine and its toxicities, a population-pharmacokinetic model was previously established, and Monte Carlo simulations successfully predicted maximal plasma caffeine-concentration profiles after ingestion of a single caffeinated drink.[91011] It enables researchers to explore the permissible dose range of caffeine, especially for those who are vulnerable to caffeine overdose. However, a quantitative and interactive tool for predicting and simulating plasma caffeine concentration leading to caffeine intoxication has yet to be developed.
Using the previously established population-pharmacokinetic model and its parameters.[11] we developed “caffsim” R package and its web-based applications using Shiny and EDISON (EDucation-research Integration through Simulation On the Net, https://www.edison.re.kr/). The primary aim of the software is allowing for easy prediction of plasma caffeine concentration and visualizing its changes after single or multiple ingestions of caffeine.

Methods

Pharmacokinetic model of caffeine

A population-pharmacokinetic analysis was previously established based on a study of 30 healthy adult male volunteers of South Asian and European ancestry.[910] and Lee et al.[11] further investigated the model using Monte Carlo simulations to predict Cmax and AUC of caffeine in children.One-compartment model with first-order absorption kinetics and first-order elimination kinetics was shown to be well-fitted to the pharmacokinetic data, and the final pharmacokinetic parameters were adopted from the previous study[11] for development of the package.

Caffsim R package

Caffsim was developed in the open-source R programming language in order to allow contribution from anyone interested in the study (https://github.com/asancpt/caffsim). It is freely available for download on the CRAN repository (https://CRAN.R-project.org/package=caffsim), and the installation can be carried out by typing tcp-25-141-i002.jpg in the R console. The package utilizes data manipulation or visualization packages such as dplyr, tidyr, ggplot2[12] and Shiny. Contents of the caffsim R package can be broadly categorized into three main functions—single dosing simulations, multiple dosing simulations, and the other functions including descriptive statistics of pharmacokinetic parameters and a duration of toxic concentration, and execution of Shiny application (Table 1). Detailed documentation and examples for each function can be found on the online user manual on the CRAN repository, a package website (https://asancpt.github.io/caffsim) or directly within the R console by entering ?function (tcp-25-141-i003.jpg and tcp-25-141-i004.jpg) after the installation.

Results

Usage of caffsim R package

Workflow of the caffsim R package and examples of its main functions are shown in Fig. 1 and 2 The process starts with generation of the concentration-time data by tcp-25-141-i005.jpg for single dosing simulations and tcp-25-141-i006.jpg for multiple dosing simulations (Fig. 2A). The generated data frame can be then used as an input argument of tcp-25-141-i007.jpg function or tcp-25-141-i008.jpg function, which generates concentration-time plots (Fig. 2B) The properties (log-y scale, line colors, shape of points, etc.) of the plots can be further manipulated or overwritten by adding ‘+’ pipe and functions of ggplot2. The data generated by functions tcp-25-141-i005.jpg and tcp-25-141-i006.jpg can be passed to tcp-25-141-i009.jpg, which calculates the duration of concentration over certain levels that may lead to fatal toxicities, while showing the proportion (%) of population which exceeds such levels (Fig. 2C, Supplementary Table 1).

Application of caffsim R package to investigate pharmacokinetics of multiple oral dosing

The concentration-time profiles of caffeine following 5-times multiple oral doses of 100, 250, 400, and 550 mg (n = 200 each) in combination with dosing intervals 8 hr, 4 hr, 2 hr, and 1 hr with respect to body weights are shown in Fig. 3 The known covariate, body weights.[11] were shown to affect the clearance of caffeine, volume of distribution and ka (absorption rate constant); low-weighted population was found to have significantly high AUC, but subjects with body weights > 70 kg generally maintained low Cav,ss (average concentration at steady-state) levels (< 10 mg/L). We also observed that multiple larger doses of caffeine (> 400 mg) increased its steady-state concentration, which was generally maintained above 10 mg/L, a level considered safe for the multiple dosing of less than 250 mg.

Application of caffsim R package for developing web-based applications

The Caffeine Concentration Predictor Shiny web-application is freely available online (https://asan.shinyapps.io/caff) for a responsive simulation of the data; it can also be obtained by typing tcp-25-141-i010.jpgin the R console as shown in Fig. 4 The web-application is fully supported in mobile web-browsers (Fig. 4D) as well as desktop web-browsers (Fig. 4A-C). The source R script of the Shiny web-application is open to the public (https://github.com/asancpt/shiny-caff). For education purposes, the EDISON Science App, CaffeineEdison (https://www.edison.re.kr/web/cmed/run_simulation) was generated based on the caffsim R package. Although EDISON Science App does not support responsive web designs and mobile web browsers, registered students can easily perform a simulation in desktop computers, and each simulation can be recorded and reviewed later (Fig. 5). The source R script of the EDISON Science App is also open to the public (https://github.com/asancpt/edison-caff).

Discussion

We developed an R package: caffsim as a comprehensive tool for simulating plasma caffeine concentration. It is mainly targeted for researchers who study caffeine or other stimulants, and particularly those who have only basic knowledge of R, visualization, or web-based applications. We aimed to implement the following functionalities to perform a simulation: 1) An easy and straightforward generation of concentration-time data; 2) visualization of changes of concentration in single and multiple dosing; 3) a cross-platform software that can be operated in both desktop and mobile web browsers as well as in the R console; 4) an open-source software on which discussion and suggestions from users can be freely exchanged. Based on our results, we believe that the caffsim R package meets the objectives described above.
Predicting the exact plasma caffeine concentration at a given time is critical for assessing the effect of caffeine exposure to certain sensitive groups including children, adolescents, and low-weight adults. Although the data on plasma caffeine concentrations are mainly derived from reports of severe caffeine toxicities, these observations are decidedly relevant to clinical prediction. A quantitative relationship among plasma caffeine concentrations, pharmacokinetics, and toxicities is yet to be clearly concluded, but well-documented case reports studying caffeine concentration have indicated the following:
  1. Plasma caffeine concentrations < 10 mg/L are generally safe, but caffeine concentrations of > 15 mg/L may exert toxicity.[5]

  2. Fatalities from caffeine intoxication have been reported with plasma caffeine concentrations of < 40 mg/L.[513]

  3. Fatal caffeine poisoning cases are usually reported when the concentration is > 80 mg/L.[14151617]

The physiological and pathological effects of caffeine ingestion in individuals can be more properly interpreted once the information on toxic caffeine concentration levels from case reports are aptly combined with the concentration-time data simulation obtained through the caffsim R package.
The caffsim R package also broadens the perspective on accessibility by creating and utilizing diverse web-based open-science applications such as Shiny app and EDISON Science App. We expect that the EDISON Science App based on the caffsim R package will have significant impact on relevant education, and further stimulate the development of open-science applications. This approach makes innovative and state-of-the-art technologies more accessible to both students and the public; also, physicians in training may benefit from it for understanding the pharmacokinetics following one compartment model, and for recognizing caffeine intoxication or caffeine-related syndromes.
In conclusion, we report that our newly-developed caffsim R package and its web-applications enable researchers and clinicians to perform fast, easy-to-use, and versatile simulations of caffeine dosing in various settings (in R console or in desktop and mobile web-browsers). This software will expand our knowledge of the relationship between the plasma caffeine concentration and caffeine intoxication in caffeine-sensitive groups. The caffsim R package may help people understand how plasma caffeine concentration changes over time and how long toxic caffeine concentration can last in the plasma of caffeine-sensitive groups. It may also help clinical evaluation of the relationship between caffeine intake and toxicities when suspicious acute symptoms occur.

Acknowledgements

This research was supported by the EDISON (EDucationresearch Integration through Simulation On the Net) Program through the National Research Foundation of Korea (NRF) funded by the Ministry of Education, Science and Technology (grant number: 016M3C1A6936614). We thank Dr. Joon Seo Lim from the Scientific Publications Team at Asan Medical Center for his editorial assistance in preparing this manuscript.

Notes

Reviewer: This article was reviewed by peer experts who are not TCP editors.

Conflicts of interests: -Authors: No potential conflicts of interest relevant to this article were reported.

-Reviewers: Nothing to declare

-Editors: Nothing to declare

References

1. EFSA Panel on Dietetic Products, Nutrition and Allergies (NDA). Scientific Opinion on the safety of caffeine: Safety of caffeine. EFSA J. 2015; 13:4102. DOI: 10.2903/j.efsa.2015.4102.
2. Reissig CJ, Strain EC, Griffiths RR. Caffeinated energy drinks--A growing problem. Drug Alcohol Depend. 2009; 99:1–10. DOI: 10.1016/j.drugalcdep.2008.08.001. PMID: 18809264.
crossref
3. Pray L. Caffeine in food and dietary supplements: examining safety: workshop summary. Washington D.C: The National Academies Press;2014.
4. Seifert SM, Schaechter JL, Hershorin ER, Lipshultz SE. Health Effects of Energy Drinks on Children, Adolescents, and Young Adults. Pediatrics. 2011; 127:511–528. PMID: 21321035.
crossref
5. Banerjee P, Ali Z, Levine B, Fowler DR. Fatal Caffeine Intoxication: A Series of Eight Cases from 1999 to 2009. J Forensic Sci. 2014; 59:865–868. PMID: 24502704.
crossref
6. Trabulo D, Marques S, Pedroso E. Caffeinated energy drink intoxication. BMJ Case Rep. 2011; 2011:pii:bcr0920103322. DOI: 10.1136/bcr.09.2010.3322.
crossref
7. Jun N, Lee A, Baik I. Associations of Caffeinated Beverage Consumption and Screen Time with Excessive Daytime Sleepiness in Korean High School Students. Clin Nutr Res. 2017; 6:55–60. PMID: 28168182.
crossref
8. Temple JL, Ziegler AM, Graczyk AM, Crandall A. Effects of acute and chronic caffeine on risk-taking behavior in children and adolescents. J Psychopharmacol. 2017; 31:561–568. DOI: 10.1177/0269881117691568. PMID: 28198658.
crossref
9. Perera V, Gross AS, Xu H, McLachlan AJ. Pharmacokinetics of caffeine in plasma and saliva, and the influence of caffeine abstinence on CYP1A2 metrics. J Pharm Pharmacol. 2011; 63:1161–1168. DOI: 10.1111/j.2042-7158.2011.01326.x. PMID: 21827488.
crossref
10. Perera V, Gross AS, Forrest A, Landersdorfer CB, Xu H, Ait-Oudhia S, et al. A Pharmacometric Approach to Investigate the Impact of Methylxanthine Abstinence and Caffeine Consumption on CYP1A2 Activity. Drug Metab Dispos. 2013; 41:1957–1966. DOI: 10.1124/dmd.113.053074. PMID: 23996078.
crossref
11. Lee JW, Kim Y, Perera V, McLachlan AJ, Bae KS. Prediction of plasma caffeine concentrations in young adolescents following ingestion of caffeinated energy drinks: a Monte Carlo simulation. Eur J Pediatr. 2015; 174:1671–1678. DOI: 10.1007/s00431-015-2581-x. PMID: 26113286.
crossref
12. Wickham H. ggplot2: Elegant Graphics for Data Analysis. New York: Springer-Verlag;2016.
13. Cannon ME, Cooke CT, McCarthy JS. Caffeine-induced cardiac arrhythmi a: an unrecognised danger of healthfood products. Med J Aust. 2001; 174:520–521. PMID: 11419773.
14. Holmgren P, Nordén-Pettersson L, Ahlner J. Caffeine fatalities--four case reports. Forensic Sci Int. 2004; 139:71–73. PMID: 14687776.
crossref
15. Kerrigan S, Lindsey T. Fatal caffeine overdose: two case reports. Forensic Sci Int. 2005; 153:67–69. PMID: 15935584.
crossref
16. Thelander G, Jönsson AK, Personne M, Forsberg GS, Lundqvist KM, Ahlner J. Caffeine fatalities--Do sales restrictions prevent intentional intoxications? Clin Toxicol (Phila). 2010; 48:354–358. DOI: 10.3109/15563650903586752. PMID: 20170393.
17. de Wijkerslooth LR, Koch BC, Malingré MM, Smits P, Bartelink AKM. Lifethreatening hypokalaemia and lactate accumulation after autointoxication with Stacker 2®, a “powerful slimming agent. ” Br J Clin Pharmacol. 2008; 66:728–731. DOI: 10.1111/j.1365-2125.2008.03279.x. PMID: 18823307.
crossref

Supplementary Material

Supplementary Table 1

A descriptive summary on the duration (hour) of plasma caffeine concentration over certain levels (40 mg/L or 80 mg/L) previously known to cause serious toxicity. Values were generated by caffOverdose function for 500 subjects per each body weight group. (Abbreviations: SD, standard deviation)
tcp-25-141-s001.pdf
Figure 1

Development workflow of the caffsim R package. Items on the left side can be executed in web browsers and the others are R functions that can be run on the R console. The shiny web-application or tcp-25-141-i011.jpg function enables users to interactively perform a simulation (Abbreviations: Web-app., web-application.).

tcp-25-141-g001
Figure 2

Examples of the caffsim R package functions. A) examples by tcp-25-141-i005.jpg and tcp-25-141-i006.jpg, B) examples by tcp-25-141-i007.jpg and tcp-25-141-i008.jpg, C) examples by tcp-25-141-i009.jpg, and D) examples by tcp-25-141-i012.jpg and tcp-25-141-i013.jpg

tcp-25-141-g002
Figure 3

Plasma concentration-time profiles derived from 5 times multiple dosing simulations with an interval of 8, 4, 2, and 1 hr. Values were generated by tcp-25-141-i006.jpg function for 500 subjects per each body weight group. Line plots show the arithmetic mean and shades denote the range of standard errors.

tcp-25-141-g003
Figure 4

Shiny web-application using the caffsim R package. A) a scatter plot of Cmax according to body weight, B) a scatter plot of AUCinf according to body weight, C) a concentration-time plot of single dose, and D) concentration-time plots and box-whisker plot of Cmax opened in mobile web-browsers (Abbreviation: Cmax, Maximal plasma concentration; AUCinf; area under the curve infinity).

tcp-25-141-g004
Figure 5

EDISON Science App web-application using the caffsim R package. A) An input-deck editor, and B) HTML report containing various information regarding simulation runs.

tcp-25-141-g005
Table 1

Explanation on the functions in the caffsim R package

tcp-25-141-i001
Class Functions Description
Single dose caffConcTime Create a concentration-time dataset of single oral dosing of caffeine.
Usage in R: caffConcTime(Weight = 20, Dose = 200, N = 20)
caffPkparam Create a dataset of pharmacokinetic parameters of single oral dosing of caffeine.
Usage in R: caffPkparam(Weight = 20, Dose = 200, N = 20)
caffPlot Plot plasma concentration-time curves of single oral dosing of caffeine.
Usage in R: caffPlot(caffConcTime(Weight = 20, Dose = 200, N = 20))
Mulitple doses caffConcTimeMulti Create a concentration-time dataset of multiple oral dosing of caffeine.
Usage in R: caffConcTimeMulti(Weight = 20, Dose = 200, N = 20, Tau = 8, Repeat = 4)
caffPkparamMulti Create a dataset of pharmacokinetic parameters of multiple oral dosing of caffeine.
Usage in R: caffPkparamMulti(Weight = 20, Dose = 200, N = 20, Tau = 8)
caffPlotMulti Plot plasma concentration-time curves of multiple oral dosing of caffeine.
Usage in R: caffPlotMulti(caffConcTimeMulti(Weight = 20, Dose = 200, N = 20, Tau = 8, Repeat = 4))
Others caffDescstat Calculate descriptive statistics of simulated pharmacokinetic parameters.
Usage in R: caffDescstat(caffPkparam(20,500))
caffOverdose Calculate a duration of toxic concentration over specified levels (40 mg/L or 80 mg/L).
Usage in R: caffOverdose(caffConcTime(Weight = 20, Dose = 200, N = 20))
caffShiny Run Shiny app to interactively simulate single and multiple dosing for plasma caffeine concentration.
Usage in R: caffShiny()
UnitTable Unit data of PK parameters.
Usage in R: UnitTable
TOOLS
Similar articles