We leveraged the Electronic medical record Support for Public Health (ESP) surveillance platform to create a chronic disease surveillance module. ESP is an open source software (esphealth.org) that reads structured EHR data, analyzes them for events of public health interest and communicates findings to public health agencies. We created algorithms to identify diabetes types using a combination of diagnosis codes, laboratory tests and medication prescriptions. We then applied these algorithms to the ESP installation in Atrius Health, a multisite, ambulatory practice with over 700,000 patients. We programmed ESP to create patient level linelists each night that detail patients' demographics (age, sex, race/ethnicity and zip code), vitals (body mass index, blood pressure and pregnancy status), key laboratories (hemoglobin A1C and cholesterol levels), diabetes type and care (medications and medical nutrition counseling). De-identified linelists are transmitted nightly to a secure website called the 'RiskScape' that automatically maps selected health indicators and stratifies results by age group, race/ethnicity, year of diagnosis and body mass index. Users can customize indicators and stratifications displayed by RiskScape.