Automated generation of comparator patients in the electronic medical record