updated the query which is pulling encounters