A framework for feature extraction from hospital medical data with applications in risk prediction