The disclosure relates to a method and system for controlling glucose levels comprising receiving behavioral sensor measurements and analyte sensor measurements, determining a plurality of analyte profiles from continuous analyte sensor measurements; grouping the plurality of analyte profiles into clusters; assigning a selected behavioral parameter or a selected pattern of behavioral parameters to each analyte profile in a first cluster, and providing a treatment recommendation.