patients_per_medcode() gets frequencies of patients for each medcode