Refactor out query_events Patient method