An optical engine directly attached to a surface of a toilet bowl is disclosed. An optical element of the optical engine traps urine for analysis. A cleaning jet may be used to clean and dry the optical element after urine is analyzed. A heater may be used to preheat a urine capture area before receiving urine and control urine temperature while testing the urine. User feedback associated with urinalysis results may be visually given to a toilet user by one or more light sources of the optical engine.