How would you use SQL window functions to compare each patient's lab result to their previous visit and calculate a running average over time?