Does anyone have an algorithm to detect swim laps using the accelerometer data?

I'm a newbie and trying to create an app for myself that detects when I complete a swim lap in a pool by pushing off the wall.

Thx!