BackgroundLithium is the most effective treatment in bipolar disorder. Its use is limited by concerns about risk of chronic kidney disease (CKD). We aimed to develop a model to predict risk of CKD following lithium treatment initiation, by identifying individuals with a high-risk trajectory of kidney function.MethodsWe used United Kingdom Clinical Practice Research Datalink (CPRD) electronic health records (EHRs) from 2000 to 2018. CPRD Aurum for prediction model development and CPRD Gold for external validation. We used elastic net regularised regression to generate a prediction model from potential features. We performed discrimination and calibration assessments in an external validation data set.We included all patients aged ≥ 16 with bipolar disorder prescribed lithium. To be included patients had to have ≥ 1 year of follow-up before lithium initiation, ≥ 3 estimated glomerular filtration rate (eGFR) measures after lithium initiation (to be able to determine a trajectory) and a normal (≥ 60 mL/min/1.73 m2) eGFR at lithium initiation (baseline). In the Aurum development cohort, 1609 fulfilled these criteria. The Gold external validation cohort included 934 patients.We included 44 potential baseline features in the prediction model, including sociodemographic, mental and physical health and drug treatment characteristics. We compared a full model with the 3-variable 5-year kidney failure risk equation (KFRE) and a 3-variable elastic net model.We used group-based trajectory modelling to identify latent trajectory groups for eGFR. We were interested in the group with deteriorating kidney function (the high-risk group).ResultsThe high risk of deteriorating eGFR group included 191 (11.87%) of the Aurum cohort and 137 (14.67%) of the Gold cohort. Of these, 168 (87.96%) and 117 (85.40%) respectively developed CKD 3a or more severe during follow-up. The model, developed in Aurum, had a ROC area of 0.879 (95%CI 0.853–0.904) in the Gold external validation data set. At the empirical optimal cut-point defined in the development dataset, the model had a sensitivity of 0.91 (95%CI 0.84–0.97) and a specificity of 0.74 (95% CI 0.67–0.82). However, a 3-variable elastic net model (including only age, sex and baseline eGFR) performed similarly well (ROC area 0.888; 95%CI 0.864–0.912), as did the KFRE (ROC area 0.870; 95%CI 0.841–0.898).ConclusionsIndividuals at high risk of a poor eGFR trajectory can be identified before initiation of lithium treatment by a simple equation including age, sex and baseline eGFR. Risk was increased in individuals who were younger at commencement of lithium, female and had a lower baseline eGFR. We did not identify strong predicters of eGFR decline specific to lithium-treated patients. Notably, lithium duration and toxicity were not associated with high-risk trajectory.