An analysis of risk factors and adverse events in ambulatory surgery