Abstract
BACKGROUND: Hospital-acquired infections (HAIs) remain a critical patient safety concern, affecting one in 31 hospitalized patients daily. Non-compliance with personal protective equipment (PPE) protocols is a preventable driver. Current monitoring methods, such as manual audits and closed-circuit television (CCTV), are limited by delays, inconsistency, and reactivity. Traditional artificial intelligence (AI) systems are rigid and require retraining when protocols change. OBJECTIVE: To construct and evaluate a generative AI-driven compliance monitoring system, built with Google Gemini (Mountain View, CA, USA) on Raspberry Pi (Cambridge, UK) hardware that translates hospital rulebooks or free-text prompts into real-time enforcement logic without retraining. METHODS: The system integrated Gemini, OpenCV (Dover, DE, USA) and Streamlit (San Francisco, CA, USA) to convert natural language rules into executable logic. Performance was tested in 168 mannequin-based trials under varied conditions (skin tones, orientations, and object presence). Outcomes were compared with reference labels using accuracy, recall, specificity, F1 score, and Cohen's Kappa. RESULTS: The system achieved 95.8% accuracy, 91.0% recall, 100% specificity, F1 = 0.95, and Cohen's Kappa = 0.92. Performance was consistent across mannequin skin tones and between rulebook-derived and free-text prompts, with no false positives recorded. CONCLUSION: This generative AI compliance system demonstrated strong accuracy, adaptability, and cost efficiency. Integration into hospital workflows could enable proactive real-time monitoring of evolving safety protocols, improving compliance and reducing costs relative to current methods.