IPB

Welcome Guest ( Log In | Register )


2 Pages V   1 2 >  
Reply to this topicStart new topic
> List Problem
Daniel Ginsberg
post Dec 26 2004, 03:07 PM
Post #1


Member
***

Group: Members
Posts: 178
Joined: 23-December 02
From: Tacoma, Washington
Member No.: 834
Which Program?: Dragon NaturallySpeaking Medical Version 9
Where are you Located: Tacoma, WA



I have a list called Order <labtests> that works fine. It looks like this:

Sub Main
SendKeys Mid(ListVar1, 1, InStr(ListVar1, "")-1)
SendKeys "{Enter}"
End Sub

The labtests list looks like this:
80185Dilantin
84153APSA

So if I say "Order PSA" it will insert "84153A" into the highlighted field and press Enter. So far so good.

I tried to do a similar thing but essentially in reverse. I made an order called Order <diagnosis3> with the same code.

The diagnosis3 list looks like this:
HYPOTHYROIDISM244.9
TYPE 2 DIABETES MELLITUS250.00

But here's the problem. When I say "Order 250.00" it just types "Order 250.00." It's not recognizing it as a command (there is no blue box), even if I press and hold the Ctrl key or make it global.

Is there something peculiar about using lists with numbers rather than words?
Go to the top of the page
 
+Quote Post
Larry Allen
post Dec 26 2004, 03:52 PM
Post #2


Member
***

Group: Members
Posts: 459
Joined: 15-May 03
From: Phoenix Arizona
Member No.: 1,104



I've had much better results with numbers in the spoken form of the list when the number is spelled out as in:

HYPOTHYROIDISMtwo forty four point nine
TYPE 2 DIABETES MELLITUStwo fifty point zero zero

I suspect there are some unpublished rules on what can/should be said, and that spelling out the numbers makes it unambiguous.

Larry Allen
http://www.pcspeak.com


--------------------
Larry Allen
http://www.pcspeak.com
Author, "Scripting for Dragon NaturallySpeaking 9"
Go to the top of the page
 
+Quote Post
Daniel Ginsberg
post Dec 27 2004, 07:01 AM
Post #3


Member
***

Group: Members
Posts: 178
Joined: 23-December 02
From: Tacoma, Washington
Member No.: 834
Which Program?: Dragon NaturallySpeaking Medical Version 9
Where are you Located: Tacoma, WA



Thanks, Larry. That seems to work, though I'm still not able to accomplish my end goal.

In my electronic medical record, I have a Problem field and a Description field. If I enter 250.00 in the Problem field, it automatically enters DIABETES MELLITUS TYPE II-UNCOMPL [250.00] in the Problem field, and DIABETES UNCOMPL ADULT-TYPE II in the Description field by default (unfortunately I can't change the defaults).

I want to go into a chart, highlight the Problem, and enter my own descriptions in the Description field. I wrote code that will take DIABETES MELLITUS TYPE II-UNCOMPL [250.00] and extract "250.00" out of it. I then wanted to use my Order <diagnosis3> list to take the "250.00" and output "TYPE 2 DIABETES MELLITUS" in the description field.

The only way I could think of how to do this, is to use the Heardword command. I tried

HeardWord "Order", strJustICD

where strJustICD is the code, i.e. 250.00. I know the strJustICD has the correct value, but it doesn't seem like I can use HeardWord with a variable. It doesn't work whether I define my list as

TYPE 2 DIABETES MELLITUStwo fifty point zero zero

or

TYPE 2 DIABETES MELLITUS250.00

Is there a way around this?

Dan
Go to the top of the page
 
+Quote Post
Ingram
post Dec 27 2004, 08:36 AM
Post #4


Moderator
***

Group: Admin
Posts: 550
Joined: 3-May 04
Member No.: 1,486
Where are you Located: Williamsburg, Virginia



You could try...

option explicit
dim strJustICD, theMiddle as string

Sub Main

theMiddle = instr(listvar1, "")
strJustICD = mid$(listvar1, theMiddle+1)
'
HeardWord "Order", strJustICD

end sub


--------------------
Go to the top of the page
 
+Quote Post
Ingram
post Dec 27 2004, 08:36 AM
Post #5


Moderator
***

Group: Admin
Posts: 550
Joined: 3-May 04
Member No.: 1,486
Where are you Located: Williamsburg, Virginia



You could try...

option explicit
dim strJustICD, theMiddle as string

Sub Main

theMiddle = instr(listvar1, "") 'finds the "" character
strJustICD = mid$(listvar1, theMiddle+1) 'take everything to the right of the "" character
'
HeardWord "Order", strJustICD

end sub


[This message has been edited by Ingram (edited 12-27-2004).]


--------------------
Go to the top of the page
 
+Quote Post
Larry Allen
post Dec 27 2004, 08:50 AM
Post #6


Member
***

Group: Members
Posts: 459
Joined: 15-May 03
From: Phoenix Arizona
Member No.: 1,104



I'm sure there is a solution to this.

As I understand it, you already have the code to get the ICD-9. What you then want is to produce your own description where the cursor currently is pointing, then do an "Enter".

Instead of the:

HeardWord "Order", strJustICD

I would probably insert the SendKeys directly as in:

Select Case strJustICD
Case "249.9"
SendKeys "HYPOTHYROIDISM"
Case "250.00"
SendKeys "Type 2 DIABETES MELLITUS"
End Select
SendKeys "{Enter}"


If there were enough of these entries, I'd probably set up a file to look up the text corresponding to each of these ICD-9's.

Larry Allen
http://www.pcspeak.com


--------------------
Larry Allen
http://www.pcspeak.com
Author, "Scripting for Dragon NaturallySpeaking 9"
Go to the top of the page
 
+Quote Post
Daniel Ginsberg
post Dec 27 2004, 11:47 AM
Post #7


Member
***

Group: Members
Posts: 178
Joined: 23-December 02
From: Tacoma, Washington
Member No.: 834
Which Program?: Dragon NaturallySpeaking Medical Version 9
Where are you Located: Tacoma, WA



Ingram - I get an operator/operand mismatch from the following line:

strJustICD = Mid$(listvar1, theMiddle+1)

Your method seems to work, Larry. But what do mean, "set up a file to look up the text corresponding to each of these ICD-9's"? Are you referring to using the lookup function?

Dan
Go to the top of the page
 
+Quote Post
Larry Allen
post Dec 27 2004, 04:58 PM
Post #8


Member
***

Group: Members
Posts: 459
Joined: 15-May 03
From: Phoenix Arizona
Member No.: 1,104



I literally mean have a text file that is read as part of this command. The file could use the "" or a tab or some other character as a delimiter and be formatted something like:

201.0Bump on head
201.1Big bump on head
202.0Bump on neck
...

I know there are files with these ICD's. There would be several different ways of reading such files. If you know one way, use it. I'm not specifically aware of a "lookup" function though it may exist. I'm basically suggesting:

Open file
Read a line
if first part of line matches ICD, then use 2nd part of the line.
next line
Close file.

Larry Allen
http://www.pcspeak.com


--------------------
Larry Allen
http://www.pcspeak.com
Author, "Scripting for Dragon NaturallySpeaking 9"
Go to the top of the page
 
+Quote Post
DAS
post Dec 27 2004, 09:09 PM
Post #9


Member
***

Group: Members
Posts: 398
Joined: 27-August 02
Member No.: 690
Which Program?: DNS 8.0
Where are you Located: San Diego



Hi Guys, figured I would jump in.

You could do it something like this"

QUOTE
Dim fso, TextStream, s
Dim StrWordList
Dim ICD As String
Dim Dx As String

Const ForReading = 1
Set fso = CreateObject(\"Scripting.FileSystemObject\")
Set TextStream = fso.OpenTextFile(\"C:yout directorylist.txt\", ForReading)

Do While Not TextStream.AtEndOfStream
   s = TextStream.ReadLine
   If s = \"\" Then Exit Do
   StrWordList = Split(s, \"|\", -1, 1)
   
   ICD = Trim(StrWordList(0))
   Dx = Trim(StrWordList(1))

Do some action here e.g. call function or use if then to exit loop

Loop

TextStream.Close



list.txt

201.0 | Bump on head
201.1 | Big bump on head
202.0 | Bump on neck

-----

BTW, good ICD lookups:

http://icd9cm.chrisendres.com/index.php

http://neuro3.stanford.edu/CodeWorrier/

http://www.labdat.com/kbase/icd.asp



[This message has been edited by DAS (edited 12-28-2004).]
Go to the top of the page
 
+Quote Post
Ingram
post Dec 28 2004, 04:29 AM
Post #10


Moderator
***

Group: Admin
Posts: 550
Joined: 3-May 04
Member No.: 1,486
Where are you Located: Williamsburg, Virginia



QUOTE
Originally posted by Daniel Ginsberg:
Ingram - I get an operator/operand mismatch from the following line:

strJustICD = Mid$(listvar1, theMiddle+1)

Your method seems to work, Larry. But what do mean, \"set up a file to look up the text corresponding to each of these ICD-9's\"? Are you referring to using the lookup function?

Dan



Dan,

have you tried a sendkeys after your heardword?

Heardword "Order"
Sendkeys strJustICD

Ingram


--------------------
Go to the top of the page
 
+Quote Post
Daniel Ginsberg
post Dec 28 2004, 11:57 AM
Post #11


Member
***

Group: Members
Posts: 178
Joined: 23-December 02
From: Tacoma, Washington
Member No.: 834
Which Program?: Dragon NaturallySpeaking Medical Version 9
Where are you Located: Tacoma, WA



I tried your suggestion, Ingram, but it didn't work. It just typed the strID number in the field.

I'm a little leery of using a text file as it would make it more difficult to distribute my commands to others and to maintain. I understand that lists can have more than one type of data on the left side of the list, so I've been considering whether I could combine my lists into a super list. One column would have the ICD code, another would have the description my Electronic Medical Records assigns to it, and another would have the English language description I prefer. The parsing would be a little more complicated, but it might be easier to maintain if I could get it to work.

I haven't had a chance to try DAS's suggestion yet.

Dan
Go to the top of the page
 
+Quote Post
DAS
post Dec 28 2004, 01:23 PM
Post #12


Member
***

Group: Members
Posts: 398
Joined: 27-August 02
Member No.: 690
Which Program?: DNS 8.0
Where are you Located: San Diego



Super List wouldn't be that hard.

Just make as many columns as you need as separate with the separator symbol e.g. |.

The split function Split(s, "|", -1, 1)
will separate each column into the array StrWordList(n).

OTOH, if your list(s) were more complicated, you might want to use a database such as Access to store the information. Let me know if you would like to see an example of this.

DAS
Go to the top of the page
 
+Quote Post
Daniel Ginsberg
post Dec 28 2004, 03:56 PM
Post #13


Member
***

Group: Members
Posts: 178
Joined: 23-December 02
From: Tacoma, Washington
Member No.: 834
Which Program?: Dragon NaturallySpeaking Medical Version 9
Where are you Located: Tacoma, WA



DAS - I assume your Split formula would be incorporated into your previous script. I tried using just your intitial script, but on the line

StrWordList = Split(s, "|", -1, 1)

I get an error messaging saying

Expecting "]"

For some reason the command looks different at
http://msdn.microsoft.com/library/default....vafctsplit.asp, though I don't understand the brackets or your use of a negative 1. The following doesn't give me an error message:

StrWordList = Split(s,"|",1)

but when I run the script I get an error message that the array index is out of range.

Dan
Go to the top of the page
 
+Quote Post
DAS
post Dec 28 2004, 04:23 PM
Post #14


Member
***

Group: Members
Posts: 398
Joined: 27-August 02
Member No.: 690
Which Program?: DNS 8.0
Where are you Located: San Diego



QUOTE
but when I run the script I get an error message that the array index is out of range.


Did you define the Array with a Dim Statement?

Also try:

StrWordList = Split(s,"|")

The Syntax for the VB Function Split is as follows:

QUOTE
Split Function
Returns a zero-based, one-dimensional array containing a specified number of substrings.

Split(expression[, delimiter[, count[, compare]]])

Arguments:
expression

Required. String expression containing substrings and delimiters. If expression is a zero-length string, Split returns an empty array, that is, an array with no elements and no data.

delimiter

Optional. String character used to identify substring limits. If omitted, the space character (\" \") is assumed to be the delimiter. If delimiter is a zero-length string, a single-element array containing the entire expression string is returned.

count

Optional. Number of substrings to be returned; -1 indicates that all substrings are returned.

compare

Optional. Numeric value indicating the kind of comparison to use when evaluating substrings. See Settings section for values.

Settings
The compare argument can have the following values:

Constant Value Description
vbBinaryCompare 0 Perform a binary comparison.
vbTextCompare 1 Perform a textual comparison.

Example:
Dim MyString, MyArray, Msg
MyString = \"VBScriptXisXfun!\"
MyArray = Split(MyString, \"x\", -1, 1)
' MyArray(0) contains \"VBScript\".
' MyArray(1) contains \"is\".
' MyArray(2) contains \"fun!\".
Msg = MyArray(0) & \" \" & MyArray(1)
Msg = Msg   & \" \" & MyArray(2)
MsgBox Msg




I will if I can get it to work in the DNS editor.



[This message has been edited by DAS (edited 12-28-2004).]
Go to the top of the page
 
+Quote Post
DAS
post Dec 28 2004, 04:45 PM
Post #15


Member
***

Group: Members
Posts: 398
Joined: 27-August 02
Member No.: 690
Which Program?: DNS 8.0
Where are you Located: San Diego



The DNS syntax is a little different:

Split(expression[, delimiter[, count]])

You can use either

StrWordList = Split(s, "|", -1)

The -1 indicates all substring are returned

or

StrWordList = Split(s, "|",2)

The 2 indicates the 1st 2 substring are returned

or simply

StrWordList = Split(s, "|")
Go to the top of the page
 
+Quote Post
Ingram
post Dec 29 2004, 04:10 AM
Post #16


Moderator
***

Group: Admin
Posts: 550
Joined: 3-May 04
Member No.: 1,486
Where are you Located: Williamsburg, Virginia



QUOTE
Originally posted by Daniel Ginsberg:
I tried your suggestion, Ingram, but it didn't work. It just typed the strID number in the field.

I'm a little leery of using a text file as it would make it more difficult to distribute my commands to others and to maintain. I understand that lists can have more than one type of data on the left side of the list, so I've been considering whether I could combine my lists into a super list. One column would have the ICD code, another would have the description my Electronic Medical Records assigns to it, and another would have the English language description I prefer. The parsing would be a little more complicated, but it might be easier to maintain if I could get it to work.

I haven't had a chance to try DAS's suggestion yet.

Dan


Dan,

The example simply is taking from the right side of the "" character in your list. You can manipulate a Mid$ call to take from any part of the list... That's what you're trying to do isn't it?

Ingram

[This message has been edited by Ingram (edited 12-29-2004).]


--------------------
Go to the top of the page
 
+Quote Post
Daniel Ginsberg
post Dec 29 2004, 11:08 AM
Post #17


Member
***

Group: Members
Posts: 178
Joined: 23-December 02
From: Tacoma, Washington
Member No.: 834
Which Program?: Dragon NaturallySpeaking Medical Version 9
Where are you Located: Tacoma, WA



Ingram - I was trying to input the right side of the list and output the left side. The right side of the list was obtained by extracting the ICD code from highlighted text. So if I have the following highlighted:

DIABETES MELLITUS TYPE II-UNCOMPL [250.00]

the code strips out 250.00 and assigns it to strJustICD. I then wanted to input that into a list that looks like this:

TYPE 2 DIABETES MELLITUS/250.00

in order to extract "TYPE 2 DIABETES MELLITUS" to another field.

I have a command Order <diagnosis3> that will take the 250.00 and output "TYPE 2 DIABETES MELLITUS" when I say "250.00", but I could not get it to take the "250.00" from my other command. Order <diagnosis3> worked with verbal input, but not command input.

When I said your command didn't work, I meant that your idea to use:

Heardword "Order"
Sendkeys strJustICD

just printed "250.00" rather than "TYPE 2 DIABETES MELLITUS".

Dan
Go to the top of the page
 
+Quote Post
Daniel Ginsberg
post Dec 29 2004, 11:31 AM
Post #18


Member
***

Group: Members
Posts: 178
Joined: 23-December 02
From: Tacoma, Washington
Member No.: 834
Which Program?: Dragon NaturallySpeaking Medical Version 9
Where are you Located: Tacoma, WA



DAS - I'm still getting an array index out of range error, even with your example.

With the following code:

Sub Main
Dim MyString, MyArray, Msg
MyString = "VBScriptXisXfun!"
MyArray = Split(MyString, "x", -1)
' MyArray(0) contains "VBScript".
' MyArray(1) contains "is".
' MyArray(2) contains "fun!".
Msg = MyArray(0) & " " & MyArray(1)
Msg = Msg & " " & MyArray(2)
MsgBox Msg
End Sub

it tells me there is an error on line 8:

Msg = MyArray(0) & " " & MyArray(1)

Also, for the Split function, what you call count, Microsoft calls limit on their site, and they say that 1 returns all strings, rather than -1. Is that because you're referring to a different version of visual basic?

Dan
Go to the top of the page
 
+Quote Post
DAS
post Dec 29 2004, 12:59 PM
Post #19


Member
***

Group: Members
Posts: 398
Joined: 27-August 02
Member No.: 690
Which Program?: DNS 8.0
Where are you Located: San Diego



QUOTE
DAS - I'm still getting an array index out of range error, even with your example.

Is that because you're referring to a different version of visual basic?


Correct, the example was from a different VB version.

Just change the line to:

MyArray = Split(MyString, "x",1)

DAS

[This message has been edited by DAS (edited 12-29-2004).]
Go to the top of the page
 
+Quote Post
Daniel Ginsberg
post Dec 29 2004, 02:50 PM
Post #20


Member
***

Group: Members
Posts: 178
Joined: 23-December 02
From: Tacoma, Washington
Member No.: 834
Which Program?: Dragon NaturallySpeaking Medical Version 9
Where are you Located: Tacoma, WA



DAS - I'm still getting an array out of range error, even with the simplified code below.

Sub Main
Dim MyString, MyArray, Msg
MyString = "VBScriptXisXfun!"
MyArray = Split(MyString, "x", 1)
Msg = MyArray(1)
MsgBox Msg
End Sub

Perhaps the problem is the array is not properly dimensioned. I tried Dim MyArray() and a Redim statement without success.
Go to the top of the page
 
+Quote Post

2 Pages V   1 2 >
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 23rd May 2013 - 07:26 PM

We Recommend Using Dragon Medical and Dragon NaturallySpeaking Speech Recognition Software

Physicians Using Dragon Medical - Looking for the Best Electronic Health Record (EHR / EMR)?