A framework for specifying and identifying temporal sequences in clinical data