Identifying Dynamic Patterns of Polypharmacy for Patients with Dementia from Primary Care Electronic Health Records: A Machine Learning Driven Longitudinal Study

 is unclear how medication use evolved before diagnosis of dementia (DoD). This study aims to identify varied patterns of polypharmacy before DoD, their prevalence and possible complications. We collected primary care e-health records for 33,451 dementia patients in Wales from 1990 to 2015. The medication uses in every 5-year period along with 20-years prior to dementia diagnosis were considered. Exploratory factor analysis was used to identify clusters of medicines for every 5-year period. The prevalence of patients taking three or more medications was 82.16%, 69.7%, 41.1% and 5.5% in the Period 1 (0-5 years before DoD) ~ Period 4 (16-20 years before DoD) respectively. The Period 1 showed 3 clusters of polypharmacy – medicines for respiratory/urinary infections, arthropathies and rheumatism, and cardio-vascular disease (CVD) (66.55%); medicines for infections, arthropathies and rheumatism (AR), cardio-metabolic disease (CMD) and depression (22.02%); and medicines for arthropathies, rheumatism and osteoarthritis (2.6%). The Period 2 showed 4 clusters of polypharmacy – medicines for infections, arthropathies, and CVD (69.7%); medicines for CVD and depression (3%); medicines for CMD and arthropathies (0.3%); and medicines for AR, and CVD (2,5%). The Period 3 showed 6 clusters of polypharmacy – medicines for infections, arthropathies, and CVD (41.1%); medicines for CVD, acute-respiratory-infection (ARI), and arthropathies (1.25%); medicines for AR (1.16%); medicines for depression, anxiety (0.06%); medicines for CMD (1.4%); and medicines for dermatologic disorders (0.9%). The Period 4 showed 3 main clusters of polypharmacy – medicines for infections, arthropathy, and CVD (5.5%); medicines for anxiety, ARI (2.4%); and medicines for ARI and CVD (2.1%). As the development towards dementia progressed, the associative diseases tended to cluster with a larger prevalence in each cluster. Farther away before DoD, the clusters of polypharmacy tended to be clearly distinct between each other, resulting in an increasing number of patterns, but in a smaller prevalence.