A Pattern Matching Algorithm for Self-Adjusting Basal Rates in Insulin Pump Systems