Abstract Background Surgical site infection (SSI) is a major health problem associated with high morbidity and mortality, the consequences of which can be very serious for the patient and costly for the organisation. Surveillance systems provide insight into the incidence of SSI, the analysis of which enables improvement plans to be established to reduce it. Traditionally, surveillance systems have been based on manual medical record review for evidence of the presence of surgical infection. Objectives To create and validate a global SSI diagnostic algorithm and to optimise the SSI workload of Preventive Medicine services. Methods The study population included patients undergoing surgical procedures of rectal surgery, colon surgery, knee replacement surgery, hip replacement surgery, coronary bypass and valve surgery, at the Hospital Universitario Vinalopó in Elche (n = 1240). Data mining was used to collect clinical, microbiological and postoperative follow-up values from the electronic medical record. Machine Learning techniques were used to train (n = 1054) and validate the model (n = 186). Time spent on SSI surveillance of the preventive medicine service was measured. Results Model performance after validation was: sensitivity of 0.83 specificity of 0.87, accuracy of 0.87, an F1 score of 0.45, and an area under the curve of 0.87. The time spent by preventive medicine staff in identifying patients with surgical site infection decreased from 168 person-hours per procedure per quarter to 34 person-hours, a 77% reduction in the workload allocated to this task. Conclusions This project not only improves surveillance efficiency, but also optimises the workload in Preventive Medicine services very significantly. Key messages • This project improves the efficiency of surgical site infection surveillance and significantly optimises the workload in preventive medicine departments. • It makes it possible to extend surveillance to new surgical procedures and to work more intensively on preventive measures.