Post by Janet on Oct 7, 2007 12:22:34 GMT -5
This is a port from a recent LB program I wrote.
Ideally, I'd like to include a 'Show Me' or 'Help' button that will walk the student through an explanation of how to get the right answer using the current example.
For anyone who's interested, the number of drops is determined by this formula:
x = mL's per hour
d = Drop Factor (shown with the tubing image. Microdrip = 60)
Number of drops per minute = x / 60 * d
Janet
P.S. Carl, if you happened to notice the *several* crashes from my end these past few hours, they were all due to coding error and not bugs.
' IV Drill and Practice
Dim IVSol$(9)
' 9 Solutions
Dim IVSol(8)
' IVSol(0) = Hour Blocks
' IVSol(1) = Solution
' IVSol(2) = Total Amount mL's Given
' IVSol(3) = Infusion Time (Hours or Minutes)
' IVSol(4) = mL's per Hour
' IVSol(5) = Drop Factor
' IVSol(6) = gtt's per Minute
' IVSol(7) = mL's per Hour (User)
' IVSol(8) = gtt's per Minute (User)
Dim IVOrder$(5)
' IVOrder$(0) = Drop Factor
' IVOrder$(1) = "", "Infuse", "Run"
' IVOrder$(2) = "1 L", "500 mL", etc.
' IVOrder$(3) = "D5W", "D5 1/2NS", etc.
' IVOrder$(4) = "at", "@", "every", "q", "over", etc.
' IVOrder$(5) = "75 mL / hr", "5 hours", etc.
Call SolutionsData
Call SetCSS
IVMode = 0
[TryAnother]
Cls
Call IVQuiz
Div ContainerMain
Call DisplayQuiz IVMode
Div ContainerEvaluation
End Div
End Div
IVMode = 1
Wait
[CheckAnswer]
IVSolmLUser = #ml Value()
IVSol(7) = IVSolmLUser
IVSolgttUser = #gtt Value()
IVSol(8) = IVSolgttUser
Cls
Div ContainerMain
Call DisplayQuiz 2
Div ContainerEvaluation
Call IVSolCheck
End Div
End Div
Wait
==================================================
' Sub to display the practice IV problem
'==================================================
Sub DisplayQuiz IVMode
Select Case IVMode
Case 0
Div ContainerTitle
Print "Calculating IV Flow Rates"
End Div
Case 1, 2
Div ContainerTubing
Print: Print IVOrder$(0)
End Div
Div ContainerHeading
Print "The IV Order Reads -"
End Div
Div ContainerOrder
Call ConcatenateIVOrder
For i = 1 to 5
Print IVOrder$(i);" ";
Next i
End Div
Div ContainerFiller5070
End Div
Div ContainerTextbox
Select Case IVMode
Case 1
Textbox #ml, ""
Case 2
Textbox #ml, IVSol(7)
End Select
End Div
Div ContainerLabel
Print "mL / Hour"
End Div
Div ContainerTextbox
Select Case IVMode
Case 1
Textbox #gtt, ""
Case 2
Textbox #gtt, IVSol(8)
End Select
End Div
Div ContainerLabel
Print "Drops / Minute"
End Div
End Select
Div ContainerFiller25550
End Div
Div ContainerButton
Select Case IVMode
Case 0
Link #bttn, "Begin", [TryAnother]
Case 1
Link #bttn, "Check Answer", [CheckAnswer]
Case 2
Link #bttn, "Try Another", [TryAnother]
End Select
#bttn cssClass("IVButton")
End Div
Div ContainerFiller25550
End Div
End Sub
'==================================================
' Sub to evaluate the practice IV problem
'==================================================
Sub IVSolCheck
mLCorrect = 0
IVSolmLCorrect = IVSol(4)
IVSolmLUser = IVSol(7)
gttCorrect = 0
IVSolgttCorrect = IVSol(6)
IVSolgttUser = IVSol(8)
If IVSolmLCorrect = Int(IVSolmLCorrect) Then
If IVSolmLCorrect = IVSolmLUser Then
mLCorrect = 1
End If
End If
If IVSolmLCorrect > Int(IVSolmLCorrect) Then
If Abs(IVSolmLUser - IVSolmLCorrect) <= 1 Then
mLCorrect = 2
End If
End If
Select Case mLCorrect
Case 0
ml1$ = IVSolmLUser;" mL's per Hour is incorrect."
ml2$ = IVSolmLCorrect;" mL's per Hour is the correct answer."
Case 1
ml1$ = ""
ml2$ = IVSolmLUser;" mL's per Hour is correct."
Case 2
ml1$ = ""
ml2$ = IVSolmLUser;" mL's per Hour is close enough to ";IVSolmLCorrect;" mL's per Hour."
End Select
If IVSolgttCorrect = Int(IVSolgttCorrect) Then
If IVSolgttCorrect = IVSolgttUser Then
gttCorrect = 1
End If
End If
If IVSolgttCorrect > Int(IVSolgttCorrect) Then
If Abs(IVSolgttUser - IVSolgttCorrect) <= 1 Then
gttCorrect = 2
End If
End If
Select Case gttCorrect
Case 0
gtt1$ = IVSolgttUser;" gtt per Minute is incorrect."
gtt2$ = IVSolgttCorrect;" gtt per Minute is the correct answer."
Case 1
gtt1$ = ""
gtt2$ = IVSolgttUser;" gtt per Minute is correct."
Case 2
gtt1$ = ""
gtt2$ = IVSolgttUser;" gtt per Minute is close enough to ";IVSolgttCorrect;" gtt per Minute."
End Select
Print ml1$
Print ml2$
Print gtt1$
Print gtt2$
End Sub
'==================================================
' Subs to construct a practice IV problem
'==================================================
Sub IVQuiz
IVSol(7) = 0 ' Reset User's mL / hr
IVSol(8) = 0 ' Reset User's gtt / minute
Call IVData
Call IVOrder
Call IVDropFactor
IVSol(6) = (IVSol(4) / 60) * IVSol(5)
IVSol(6) = Int(IVSol(6) * 10 + 0.5) / 10
End Sub
Sub IVData
rN = Int(Rnd(1) * 3) + 1
Select Case rN
Case 1
IVOrder$(1) = ""
Case 2
IVOrder$(1) = "Infuse"
Case 3
IVOrder$(1) = "Run"
End Select
' IVSol(0) = Hour Blocks
' IVSol(3) = Infusion Time (Hours or Minutes)
IVSol(0) = Int(Rnd(1) * 9) + 1
Select Case IVSol(0)
Case 1 ' 24 Hours
IVTotalML$ = "500 1200 1400 1500 1600 1750 1800 2000 2200 2250 " + _
"2400 2500 2800 3000 3500"
n = 14
IVSol(3) = 24
Case 2 ' 12 Hours
IVTotalML$ = "500 1200 1400 1500 1600 1750 1800 2000 2200 2250"
n = 10
IVSol(3) = 12
Case 3 ' 10 Hours
IVTotalML$ = "500 1200 1400 1500 1600 1750 1800 2000 2200 2250"
n = 10
IVSol(3) = 10
Case 4 ' 8 Hours
IVTotalML$ = "250 500 750 1000 1200 1250"
n = 6
IVSol(3) = 8
Case 5 ' 6 Hours
IVTotalML$ = "250 500 750 1000 1200"
n = 5
IVSol(3) = 6
Case 6 ' 4 Hours
IVTotalML$ = "100 120 125 250 500 600 750"
n = 7
IVSol(3) = 4
Case 7 ' 1 Hour
IVTotalML$ = "20 25 30 40 50 60 75 80 100 120 125 150 175 200"
n = Hour
IVSol(3) = 1
Case 8 ' 30 Min
IVTotalML$ = "50 75 125 150 200 250 275"
n = 7
IVSol(3) = 30
Case 9 ' 20 Min
IVTotalML$ = "50 75 125 150 200"
n = 5
IVSol(3) = 20
End Select
' IVSol(1) = Random Solution
IVSol(1) = Int(Rnd(1) * 9) + 1
' IVSol(2) = Total Amount mL's Given
rN = Int(Rnd(1) * 5) + 1
IVSol(2) = Val(Word$(IVTotalML$, Int(Rnd(1) * n) + 1))
If IVSol(2) = 1000 Then
If Int(Rnd(1) * 3) = 1 Then
IVOrder$(2) = "1 L"
Else
IVOrder$(2) = "1000 mL"
End If
Else
IVOrder$(2) = "";IVSol(2);" mL"
End If
' IVSol(4) = mL's per Hour
Select Case IVSol(0)
Case 1, 2, 3, 4, 5, 6, 7
IVSol(4) = IVSol(2) / IVSol(3)
Case 8
IVSol(4) = IVSol(2) * 2
Case 9
IVSol(4) = IVSol(2) * 3
End Select
IVSol(4) = Int(IVSol(4) * 10 + 0.5) / 10
End Sub
Sub IVOrder
' IVSol(0) = Hour Blocks
' IVSol(1) = Solution
' IVSol(2) = Total Amount mL's Given
' IVSol(3) = Infusion Time (Hours or Minutes)
' IVSol(4) = mL's per Hour
' IVSol(5) = Drop Factor
' IVSol(6) = gtt's per Minute
' IVSol(7) = mL's per Hour (User)
' IVSol(8) = gtt's per Minute (User)
iv$ = IVOrder$(1);" ";IVOrder$(2)
Select Case IVSol(0)
Case 1, 2, 3, 4, 5, 6
rN = Int(Rnd(1) * 5) + 1
Select Case rN
Case 1
t3$ = "q"
Case 2
t3$ = "Q"
Case 3
t3$ = "over"
Case 4
t3$ = "every"
Case 5
t3$ = "/"
End Select
t4$ = " ";IVSol(3);" Hours"
Case 7
rN = Int(Rnd(1) * 4) + 1
Select Case rN
Case 1
t3$ = "q"
Case 2
t3$ = "Q"
Case 3
t3$ = "every"
Case 4
t3$ = "/"
End Select
t4$ = " Hour"
Case 8, 9
t3$ = "over"
t4$ = " ";IVSol(3);" Minutes"
End Select
End Sub
Sub IVDropFactor
DF$ = "10 12 15 20 60"
IVDropFactor$ = Word$(DF$, Int(Rnd(1) * 5) + 1)
IVSol(5) = Val(IVDropFactor$)
dropMode = 1
If IVSol(5) = 60 Then
If Int(Rnd(1) * 3) = 0 Then
dropMode = 2
End If
End If
If dropMode = 1 Then
IVOrder$(0) = IVDropFactor$
Else
IVOrder$(0) = "Microdrip tubing"
End If
End Sub
Sub ConcatenateIVOrder
rN = Int(Rnd(1) * 1) + 2
Select Case rN
Case 1 ' Infuse D5W at 75 mL per hour
r1 = Int(Rnd(1) * 3) + 1
IVOrder$(1) = Word$("Infuse Run", r1)
IVOrder$(2) = ""
IVOrder$(3) = IVSol$(IVSol(1))
r2 = Int(Rnd(1) * 2) + 1
IVOrder$(4) = Word$("at @", r2)
r3 = Int(Rnd(1) * 3) + 1
IVOrder$(5) = "";IVSol(4);" mL ";Word$("/ per every", r3);" hour"
Case 2 ' Infuse 1000 D5W over 8 hrs
r1 = Int(Rnd(1) * 3) + 1
IVOrder$(1) = Word$("Infuse Run", r1)
If IVSol(2) = 1000 Then
If Int(Rnd(1) * 2) = 1 Then
IVOrder$(2) = "1 L"
Else
IVOrder$(2) = "1000 mL"
End If
Else
IVOrder$(2) = "";IVSol(2);" mL"
End If
IVOrder$(3) = IVSol$(IVSol(1))
If IVSol(0) < 8 Then
r2 = Int(Rnd(1) * 3) + 1
q$ = Word$("q every /", r2)
If IVSol(3) = 1 Then
IVOrder$(4) = q$;" hour"
Else
IVOrder$(4) = q$;" ";IVSol(3);" hours"
End If
Else
r2 = Int(Rnd(1) * 2) + 1
q$ = Word$("over in", r2)
IVOrder$(4) = q$;" ";IVSol(3);" minutes"
End If
IVOrder$(5) = ""
End Select
End Sub
'==================================================
' CSS Subs
'==================================================
Sub SetCSS
cssID #ContainerMain, "{
Background-Color: #FFFFCC;
Width: 780px;
Height: 500px;
Font-Size: 1em;
Font-Weight: Bold;
Font-Family: Verdana, Sans_Serif;
Border-Style: Double;
Margin-Left: 200px;
}"
cssID #ContainerTitle, "{
Background-Color: #FFFFCC;
Color: #990099;
Width: 720px;
Height: 160px;
Padding-Top: 100px;
Padding-Bottom: 15px;
Margin-Left: 15px;
Margin-Right: 15px;
Font-Size: 2em;
Font-Style: Italic;
Text-Align: Center;
}"
cssID #ContainerTubing, "{
Background-Color: #FFFFCC;
Background-Image: Url('http://runbasic.wikispaces.com/space/showimage/IVTubingRB.PNG');
Background-Repeat: No-Repeat;
Width: 120px;
Height: 160px;
Font-Family: Verdana, Sans-Serif;
Font-Size: 16pt;
Font-Weight: Bold;
Text-Align: Center;
Margin: 20px 20px 20px 20px;
Float: Left;
}"
cssID #ContainerHeading, "{
Background-Color: #FFFFCC;
Color: #990099;
Width: 610px;
Height: 30px;
Font-Size: 1.2em;
Font-Style: Italic;
Float: Left;
Padding-Top:30px;
}"
cssID #ContainerOrder, "{
Background-Color: #FFFFCC;
Width: 610px;
Height: 120px;
Font-Size: 2em;
Float: Left;
Margin-Bottom: 20px;
}"
cssID #ContainerTextbox, "{
Background-Color: #FFFFCC;
Width: 170px;
Height: 70px;
Font-Size: 2em;
Float: Left;
}"
cssID #ContainerLabel, "{
Background-Color: #FFFFCC;
Width: 190px;
Height: 70px;
Padding-Top: 4px;
Font-Size: 1.2em;
Float: Left;
}"
cssID #ContainerButton, "{
Background-Color: #FFFFCC;
Width: 260px;
Height: 50px;
Padding-Top: 4px;
Font-Size: 1.2em;
Text-Align: Center;
Float: Left;
}"
cssID #ContainerFiller5070, "{
Background-Color: #FFFFCC;
Width: 50px;
Height: 70px;
Float: Left;
}"
cssID #ContainerFiller25550, "{
Background-Color: #FFFFCC;
Width: 255px;
Height: 50px;
Float: Left;
}"
cssClass "a.IVButton", "{
Text-Decoration: None;
Background-Color: #EEF;
Text-Align: Center;
Width: 250px;
Height: 30px;
Padding-Top: 5px;
Border: Outset;
Display: Block;
Float: Left;
}"
cssClass "a.IVButton:hover", "{
Text-Decoration: None;
Background-Color: #FFF;
Border: Groove;
}"
cssID #ContainerEvaluation, "{
Background-Color: #FFFFCC;
Color: #990099;
Width: 720px;
Height: 120px;
Padding: 30px 30px 15px 15px;
Margin-Left: 15px;
Margin-Right: 15px;
Font-Size: 1.2em;
Font-Style: Italic;
Text-Align: Center;
}"
End Sub
'==================================================
' Data Subs - Intial run of program only
'==================================================
Sub SolutionsData
For i = 1 to 9
Read iv$
If Instr(iv$, "/") > 0 Then
iv1$ = Left$(iv$, Instr(iv$, "/") - 2)
n = Val(Mid$(iv$, Instr(iv$, "/") + 1))
If n = 4 Then
iv2$ = Chr$(188)
Else
iv2$ = Chr$(189)
End If
iv3$ = Mid$(iv$, Instr(iv$, "/") + 2)
iv$ = iv1$;iv2$;iv3$
End If
IVSol$(i) = iv$
Next i
Data "D5W", "D5LR", "D5NS", "D51/2NS", "D51/4NS"
Data "NS", "1/2NS", "1/4NS", "LR"
End Sub
Ideally, I'd like to include a 'Show Me' or 'Help' button that will walk the student through an explanation of how to get the right answer using the current example.
For anyone who's interested, the number of drops is determined by this formula:
x = mL's per hour
d = Drop Factor (shown with the tubing image. Microdrip = 60)
Number of drops per minute = x / 60 * d
Janet
P.S. Carl, if you happened to notice the *several* crashes from my end these past few hours, they were all due to coding error and not bugs.