Wednesday, November 18, 2015

Of Patient Algorithms and Python



An algorithm is defined in computer science as a specific set of instructions for carrying out a procedure or solving a problem. In medicine, doctors use algorithms in patient management. When a steps are being used to solve a certain problem, this process is known as a medical algorithm. Wikipedia defines a medical algorithm as a "any computation, formula, statistical survey, nomogram, or look-up table, useful in healthcare. Medical algorithms include decision tree approaches to healthcare treatment (e.g., if symptoms A, B, and C are evident, then use treatment X) and also less clear-cut tools aimed at reducing or defining uncertainty."

What is interesting about the Python programming language is that it supports the object-oriented programming paradigm. This means that Python considers data to be the starting point of the problem-solving process. This is why Python is so promising in medicine.

This brings into my mind the Boolean data type which may be very useful in medicine. For computer programmers and those who have studied computer science, you may have recalled that this data type consists of the values TRUE and FALSE that are associated with conditional statements. In Python, Boolean data is designated by the bool class. The possible state values for a boolean object are True and False with the standard boolean operators, andor, and not.

Actually, these concepts are very useful in medicine. Everyday, medical doctors are faced with numerous problems regarding patient care. For instance, in the emergency room, a patient comes in unconcious, in a coma. The doctor suspects stroke, but he or she does not know whether this is a case of hemorrhagic stroke or an ischemic type of stroke. This is the standard algorithm for managing such stroke cases:



Take a look at the algorithm. Have you noticed? The steps can be rewritten using programming code. The steps contain "if and only" statements. If I were to write code for this, I will do this as follows. 

print "You are looking at the cranial CT scan. Type #1 if its a bleed or 
type #2 if its a clot"
Type of stroke = raw_input("> ")

if stroke == "1":
    print "Refer the patient to neurosurgery"
    print "1. Refer to the handsome neurosurgeon."
    print "2. Refer to the ugly neurosurgeon."

    neurosurgery = raw_input("> ")

    if neurosurgery == "1":
        print "Good job!"
    elif neurosurgery == "2":
        print "Loser!"
    else:
        print "Well, couldn't you decide? Hahaha."

elif stroke == "2":
    print "Consider fibrinolytic therapy"
    print "1. Check fibrinolytic exclusions"
    print "2. Repeat neurologic exams"

    therapy = raw_input("> ")

    if therapy == "1" or therapy == "2":
        print "Good job!"
    else:
        print "Still good!!"

else:
    print "Your'e a good doctor!"

No, sorry I was just joking. This probably wasn't the right code! Hahahahaha! You can forgive me, I'm a newbie!
Anyway, back to the discussion, there are a lot of medical algorithms that can be translated into code and made into life-saving computer programs. Do you agree with me? Can you also write code for the other medical algorithms? What can you say? I want to see your comments below!


No comments:

Post a Comment