Care Pathways reports

http://manage.dimagi.com/default.asp?124276
@snopoke would you mind reviewing this function for best practices in terms of querying using sqlagg/sqlalchemy?