d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Python Script For Specific Purpose > Could Use A Little Help
Add Reply New Topic New Poll
Member
Posts: 2,188
Joined: Jun 23 2008
Gold: 2,885.00
Mar 31 2013 01:53pm
I'm sure there are better ways of doing this, but what I need to do is use this rating scale for patient acuity. I've been able to implement this with my extremely limited programming experience for one patient with the following code:

def main():
import time

room=raw_input("Input patient room Number ")

##Lists and prints/input for Procedural acuity
print "1- No Procedures"
print "2- IV Starts, Foley Catheter"
print "3- Vitals, Neuro Check, Bladder Scans"
print "4- Bedside Procedure, Physician post-op, frequent catheterization"
a=raw_input("Input Procedural Acuity 1-4 ")

##Lists and prints/input for Nutritional acuity
print "1- Setup Self"
print "2- Ordering Assistance"
print "3- Feed"
print "4- Tubefeed, Aspiration Procedures"
b=raw_input("Input Nutritional Acuity 1-4 ")

##Lists and prints/input for Medication acuity
print "1- Minimal Oral"
print "2- Moderate PO/IV"
print "3- Dysphasia/Multi IV"
print "4- Chemo/GTUBE/Complex IV"
c=raw_input("Input Medication Acuity 1-4 ")

##Lists and prints/input for Mobility acuity
print "1- Od lib"
print "2- ESB"
print "3- E1"
print "4- E2"
d=raw_input("Input Mobility Acuity 1-4 ")

##Lists and prints/inputs for Behavioral Acuity
print "1- Calls Appropriately/No Needs"
print "2- Some Education/ Calls Often"
print "3- Anxious/ Calls Frequently"
print "4- New Diagnosis, Calls very frequently, highly anxious"
e=raw_input("Input Behavioral Acuity 1-4 ")

a=float(a)
b=float(b)
c=float(c)
d=float(d)
e=float(e)

Acuity1= a+b+c+d+e
print "Patient in room %s, is graded at acuity %s"%(room, Acuity1)
time.sleep(30)


if __name__ == '__main__':
main()

I need to be able to store the acquity value for multiple patients and then assign them to several different nurses by some means of even distribution. Any insight would be ery helpful, fg can definitely be had.
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Mar 31 2013 02:01pm
Quote
I need to be able to store the acquity value for multiple patients and then assign them to several different nurses by some means of even distribution.

You're gonna have to explain all of this.

Storing the acuity value where? to a file, database, web service, etc?
where are you getting the room numbers from? file, database, web service, etc?
how do you assign them to a "nurse"? file, database, web service, email notification, etc?
How do you know which nurse? Where are you getting that info from?
What is "even distribution"? FIFO?

is this a homework assignment or actually something for work? deadline?
Member
Posts: 2,188
Joined: Jun 23 2008
Gold: 2,885.00
Mar 31 2013 02:21pm
Quote (carteblanche @ Mar 31 2013 04:01pm)
You're gonna have to explain all of this.

Storing the acuity value where? to a file, database, web service, etc?
where are you getting the room numbers from? file, database, web service, etc?
how do you assign them to a "nurse"? file, database, web service, email notification, etc?
How do you know which nurse? Where are you getting that info from?
What is "even distribution"? FIFO?

is this a homework assignment or actually something for work? deadline?


Ok I'll do my best to explain this, sorry I've just begun to learn python, it is my first language. This is just a problem my girlfriend was encountering at work (she is a nurse) I'm attempting to learn python, and figured maybe I could help her solve her problem.

As far as "storing" the acuity value it can be temporarily while the program is being run (it only needs to be run once). There are generally 6-7 nurses on the floor. The current script I have will spit out a value 5-20 as an acuity rating. I think each nurse could just be a variable as there are a maximum of 7 on the floor at one time. I would like for the above script to run 30 times or so (number of rooms on the floor) and once it has an acuity value for each assign them to a nurse with something like n1 < 120 (total acuity value). I cannot for the life of me figure out a way to do this. Sorry, I appreciate you attempting to help, I know I'm not explaining things very succinctly.
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Mar 31 2013 02:28pm
1. have you already talked to the administrator about this? i dont think a nurse can install and use programs without approval.
2. why python?
3. i'd suggest using a GUI if it's for non-technical people. instead of typing in 1-4 for all those questions, have them mouse-click their choices
Member
Posts: 2,188
Joined: Jun 23 2008
Gold: 2,885.00
Mar 31 2013 02:47pm
Quote (carteblanche @ Mar 31 2013 04:28pm)
1. have you already talked to the administrator about this? i dont think a nurse can install and use programs without approval.
2. why python?
3. i'd suggest using a GUI if it's for non-technical people. instead of typing in 1-4 for all those questions, have them mouse-click their choices


We have to go-ahead as far as experimenting with it, it wouldn't be run on hospital computers just on the charge nurse's phone. I went back and forth an awful lot on which language to attempt to learn first, python was suggested most often, I finally just took the plunge. I'll look into the GUI, don't have any experience doing so of course.
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Mar 31 2013 04:32pm
What is your plan to get a python script running on the nurse's phone?
Member
Posts: 2,188
Joined: Jun 23 2008
Gold: 2,885.00
Mar 31 2013 04:33pm
Quote (carteblanche @ Mar 31 2013 06:32pm)
What is your plan to get a python script running on the nurse's phone?


https://code.google.com/p/python-for-android/wiki/fullscreenwrapper2
Member
Posts: 927
Joined: Jul 26 2011
Gold: 0.00
Apr 4 2013 01:01am
Maybe consider storing the patients and their acquity values into a dictionary (key : value)?

From there, you could have a dictionary of nurses (or a list of lists, or just several lists, w/e works but I think a dictionary is cleaner) where their values are a list of patient names (which are the keys in the patients dictionary.

As far as evenly distributing, you could always give the "next" patient to the nurse with the least amount of patients. If there is a tie, you can give it to the "first" nurse found or a random nurse from that list of ties.

So...

patients = { "Bob" : 10,
"Dan" : 20,
"Jan" : 5,
"Bam" : 15
}

nurses = { "A" : ["Bob", "Dan"],
"B" : ["Jan", "Bam"]
}

And if you add a patient "Tom" with rating 25:
1) add the patient to the patients dictionary
2) assuming we decided to give it to a random nurse, get the nurse with the least patients
- if there are ties, count the number of ties, pick a random number from 1 to that number, then assume that represents the nurse to be given the patient

A heads up, I only skimmed through the post, but in case my thoughts aren't your answer, I hope they gave you an idea to get to one.

This post was edited by OmegaJSP on Apr 4 2013 01:06am
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll