Adding functionality

I am working on a project that requires me to write code and integrate to OpenMRS a basic decision support functionality, such as predicting a particular detail such as mortality risk for example from the patient information stored in the database.

For implementing such a system, do I create a new module or an OWA to achieve this? Is it possibe to integrate a machine learning model into this system that can do the prediction.