• The relationship between community follow-up and diabetes risk was discussed. • The key community life characteristics that affect the risk of diabetes were obtained. • A diabetes risk assessment model based on Random forest classifier is designed. • A risk scoring card for diabetes was designed to improve its clinical applicability. • It provides a method suitable for large-scale screening of diabetes risk in the community.