An automated algorithmic approach for activity recognition and step detection in the presence of functional compromise