Warfarin Design

From CSSEMediaWiki
(Difference between revisions)
Jump to: navigation, search
Line 30: Line 30:
  
 
[[image:WarfarinArc.JPG|frame|left|]]
 
[[image:WarfarinArc.JPG|frame|left|]]
 +
 +
 +
Domain logic is made out of 4 classes:
 +
 +
* ModelBuilder wraps up the logic for new model creation and the updates of existing models. It makes appropriate calls to WekaUtil and Datapoint Generators and data source as needed. Once the model is created and updated it invokes the data layer methods for persisting the model to the database.
 +
* PresentationBuilder gives back the INR prediction. It uses DataPoint Generator to make the datapoint , and then it passes it to the WekaUtil to get the prediction for it. It also interprets Weka’s result depending on whether the predicted INR reading needs to be nominal or numeric. It is also responsible for making appropriate calls to data layer to persist (log) completed predictions.
 +
* DataPointGenerator has the datapoint creation logic. It loops through the patient’s dose history and based on the attributes selected it calculates the amounts, comma separates them and puts them in to the datapoint. Its final product is an arff file (made of numerous datapoints) needed for model creation and updates as well as for making a prediction.
 +
* WekaUtil process the API calls to Weka in order to physically create and update a model, persist it to the file, calculate the accuracy level of model created as well make a prediction on the generated datapoint.

Revision as of 12:21, 29 July 2010

Contents

Background

Warfarin predictor was a result of my cosc366 research project. It is a web based application that uses machine learning algorithms to predict a right dose for hart-valve transplant patients. The importance of determining a correct dose comes from a fact that there is a very real danger of blood clots occurring on the heart-valve of a patient . In order to prevent blood clotting Warfarin is taken by patients as a blood thinner. By taking a right dose a patient has a minimal chance of clotting, while still ensuring that patient has enough clotting ability so that he or she does not bleed to death.

Even though I did try to do this project in OO style, the functionality that needed to come out of it were more important for the project so I haven’t spent too much time on putting it in right OO space. There is a good chance I will need to work on this project again ( add some more functionality) in the near future so before I do start I would like to see it being refactored.

Initial Requirements

  • System users: administrators, doctors.
  • Administrators can add new doctors.
  • Doctors adds patients, patient records.
  • Main use case is to record a new blood test (INR reading), get a dose prediction.
  • Dose predictions may be returned in several ways, probably not advisable to just give the dose to prescribe because of liability issues. For example, could give a graphical representation of the likelihood of being below the safe range, in range or above.
  • The system needs to be able to "learn" a model from the historical data. This involves transforming the data into a special format (an "ARFF" file) and submitting this to the learning algorithm.
  • The data-to-arff step needs to be flexible (i.e. able to be easily changed if the learner's data requirements change.
  • Models will need to be persisted.
  • The data needs to be reliably persisted.

Future requirements

  • There may be a need to record other data for the patient, possibly temporally, such as diet, other drugs taken, smoking and alcohol consumption.
  • Generate graphs from multiple classifiers to present to the doctor
  • Investigate other ensemble methods
  • Investigate using more classes (e.g. not just high and low but also very high and very low)

Initial design

The high level design:

WarfarinArc.JPG


Domain logic is made out of 4 classes:

  • ModelBuilder wraps up the logic for new model creation and the updates of existing models. It makes appropriate calls to WekaUtil and Datapoint Generators and data source as needed. Once the model is created and updated it invokes the data layer methods for persisting the model to the database.
  • PresentationBuilder gives back the INR prediction. It uses DataPoint Generator to make the datapoint , and then it passes it to the WekaUtil to get the prediction for it. It also interprets Weka’s result depending on whether the predicted INR reading needs to be nominal or numeric. It is also responsible for making appropriate calls to data layer to persist (log) completed predictions.
  • DataPointGenerator has the datapoint creation logic. It loops through the patient’s dose history and based on the attributes selected it calculates the amounts, comma separates them and puts them in to the datapoint. Its final product is an arff file (made of numerous datapoints) needed for model creation and updates as well as for making a prediction.
  • WekaUtil process the API calls to Weka in order to physically create and update a model, persist it to the file, calculate the accuracy level of model created as well make a prediction on the generated datapoint.
Personal tools