|
Re: Here's a working vTcl data entry script
|
Alexander Caldwell
|
Oct 10, 2007 21:31 PDT
|
Jerry,
Yes, you should be able to get $rootdirectory
using "send" from one of the other programs besides
databaseserver.tcl. Like TFP_drugrefill.tcl or
note_gen.tcl. Those would be guaranteed to be running
on the same machine. I really need the network
connection thing in my office because I have 3
computers besides the server all connected as clients
but only one databaseserver.tcl that runs only on the
main server. The main server could actually have a
different rootdirectory than the other computers,
although on my set up the server and the clients are
all using the same rootdirectory of /root/Tkfp But I
bet you are using a different rootdirectory.
If you want to get into the network stuff it is not
too hard. I used it for the new SQL stuff in the new
networked Rolodex as well as many other areas. As my
network programming evolved I ended up with two
separate types of network socket connections in Tkfp.
The first one I learned is set up in
$rootdirectory/lib/tkfp_lib/tkfp_lib.tcl and defines a
command I called "socketcommand". It can read and
write data to files on the server through the
databaseservert.tcl program. It is used for a number
of operations like getting the XML data off the
server for TFP_drugrefill, demographicform.tcl and
accounting.tcl, or for writing the data back to the
server. I started with that one, but found it could
not do all that I wanted. I moved later to a scheme I
got out of Brent Welch's book. There are two programs
in the drug_programs directory that are the key to the
Welch model. One is Eval_Server.tcl which gets sourced
into databaseserver.tcl and sets up the server side of
the second type of network socket. The other is the
Eval_Client.tcl program which gets sourced into any
program that needs a connection to the
databaseserver.tcl over the network such as
note_gen.tcl and several others. There is a cool
command in there called "Eval_Remote" which has a
bunch of options for reading, or writing data and
other types of commands over the "socket". Basically
it sends a command to databaseserver.tcl to do
something on the server side, like write some data to
a file, or read so
me data from a file, but it can also rename a file,
get values of variables and some other stuff. It can
get the value of the root directory variable on the
server with something like this:
set rootdirectory [Eval_Remote $sock {set
rootdirectory}]
the variable "sock" there is a "Handle" which is a
global variable representing the number assigned to
the "socket" connection between the remote client and
the databaseserver.tcl. Sockets are a Unix convention
designed years ago which have carried over into the
Internet and are now sort of platform neutural in that
one type of OS can create a "socket" connection to
some other computer using a different OS or
programming language.
Interestingly, the sockecommand scheme uses a short
lived socket that is created just before the data gets
sent and then the connection is destroyed after it is
finished, whereas the Welch scheme uses a persistent
socket that once created, just stays there until you
turn off Tkfp. Sometimes that type of socket
connection can break for one reason or another and
there is a button in the Admin that allows you to
quickly reconnect all the programs that use the
Eval_Remote $sock command back to the server in case
they get disconnected for any reason.
Alex
--- Jerry Park <park.-@gmail.com> wrote:
| | Alex,
Yes, it fills in all of the patient and doctor
information except for
the patient's Express Scripts ID and the Order
Number (which I guess
you have to get from the patient or off of the
original fax).
Generally, if there is any error in the proc, it
will fill in the
information until it hits the error and then stop.
You are correct, I'm just using send commands to
databaseserver.tcl,
demographicform.tcl, TFP_drugrefill.tcl,
tabnotebook.tcl, and
Rolodex.db. Maybe I can collect the variables I
need without having
to use databaseserver.tcl, and get them locally from
somewhere else.
I wasn't thinking about what would happen on a
network, as I've never
used Tkfp on a network so far.
Now that I think about it, I only used
databaseserver.tcl to get
$rootdirectory, and I know I can get $rootdirectory
from other places.
Maybe that would fix the problem?
I'll attach a copy of my generic proc that I'm using
to collect all
the variables and maybe you could make some
suggestions.
Jerry
| | Jerry,
It looks nice, good job.
I just tried it from my Tkfp running on the
|
coLinux
| | but ran into a couple of problems.
I can see the GUI OK and it will add the
|
information
| | on the 3 lines for the meds OK. However I am
|
getting
| | an error when I try to click the "Fill from Tkfp"
button below the doctor name or the "Open with
Acrobat" - it says "no application named
databaseserver.tcl" It must be trying to use the
|
send
| | command on databaseserver.tcl, but that program
|
does
| | not run on this same machine when I am connecting
|
Tkfp
| | to a remote databaseserver.tcl on another machine,
like I am doing in the office. I do not see it
filling anything in under Patient or Physician. Is
|
it
| | supposed to do that also?
I will try switching my coLinux to run just
|
locally
| | with it's own databaseserver.tcl and see what
|
happens.
| |
Alex
proc GetTkfpVars {} {
|
# Here's the lines that allow for the use of send on
Windows (requires winsend extension):
# if {$tcl_platform(platform) == "windows"} {
# package require winsend
# proc send {interpreter command} {winsend send
$interpreter "eval [list $command]"}}
#########################################
## This code segment works fine
package require sqlite3
set rootdirectory [send databaseserver.tcl {set
rootdirectory}]
sqlite3 db $rootdirectory/drug_programs/Rolodex.db
####################################################
# today's date = df1
# patient's dob = df99
# patient's file name = df100
# patient's last name = df101
# patient's first name = df102
# patient's middle initial = df103
# patient's street address = df104
# patient's city = df105
# patient's state = df106
# patient's zip = df107
# patient's homephone =df108
# patient's email = df109
# current selected medication = df200
# current selected dose = df201
# current selected form = df202
# current selected quantity = df203
# current selected units = df204
# current selected sig = df205
# current selected refills = df206
# current selected may substitute? = df207
# current doctor's signature-ascending = df398
# current doctor's signature-descending = df400
# current doctor's signature-For Express
Scripts--Dr. LN, FN MI--df399
# current doctor's last name = df301 or df380
# current doctor's first name = df381
# current doctor's middle initial = df382
# current doctor's degree = df383
# current doctor's street address =df304
# current doctor's city = d305
# current doctor's state = d306
# current doctor's zip = df307
# current doctor's office phone = df308
# current doctor's email = df309
# current doctor's fax phone = df310
# current doctor's dea = df320
# current doctor's license = df321
# current doctor's upin = df322
# current doctor's npi = df323
set df1 [send TFP_drugrefill.tcl {set tempdate}]
# Toplevel1 setvar ent76 "$df1"
set df99 [send demographicform.tcl {set dob}]
# Toplevel1 setvar ent77 "$df99"
set df101 [send demographicform.tcl {set lastname}]
# Toplevel1 setvar ent77 "$df101"
set df103 [send demographicform.tcl {set mi}]
# Toplevel1 setvar ent78 "$df103"
set df102 [send demographicform.tcl {set firstname}]
# Toplevel1 setvar ent79 "$df102"
set df108 [send demographicform.tcl {set homephone}]
Toplevel1 setvar ent70 "$df108"
set df200 [send TFP_drugrefill.tcl {set medicine}]
# Toplevel1 setvar ent80 "$df200"
set df201 [send TFP_drugrefill.tcl {set dose}]
# Toplevel1 setvar ent81 "$df201"
set df203 [send TFP_drugrefill.tcl {set quantity}]
# Toplevel1 setvar ent82 "$df203"
set df204 [send TFP_drugrefill.tcl {set units}]
# Toplevel1 setvar ent75 "$df204"
set df205 [send TFP_drugrefill.tcl {set sig}]
# Toplevel1 setvar ent83 "$df205"
set df206 [send TFP_drugrefill.tcl {set refills}]
# Toplevel1 setvar ent84 "$df206"
set df207 [send TFP_drugrefill.tcl {set substitute}]
# Toplevel1 setvar ent85 "$df207"
set df301 [send tabnotebook.tcl {set username}]
# Toplevel1 setvar ent86 "$df301"
# signature is of the form Alex S. Caldwell, M.D.
# doctorinfo is an array
# initial is a variable that is the doctor's last
name
# see comments $initial may be unreliable
# set signature send TFP_drugrefill.tcl {set
doctorinfo(doctor_sign,[set initial])}
# Toplevel1 setvar ent87 "$signature"
set df398 [send TFP_drugrefill.tcl {set
doctorinfo(doctor_sign,[send tabnotebook.tcl {set
username}])}]
# Toplevel1 setvar ent87 "$df398"
# This one is questionable, can change if the user
plays around with
# opening and not saving the "Doctor Info.(New) tab
on the Admin Page
# set dea send TFP_drugrefill.tcl {set
doctorinfo(doctor_dea,[set initial])}
# This one works to get the dea
set df320 [send TFP_drugrefill.tcl {set
doctorinfo(doctor_dea,[send tabnotebook.tcl {set
username}])}]
# Toplevel1 setvar ent87 "$df320"
set df321 [send TFP_drugrefill.tcl {set
doctorinfo(doctor_license,[send tabnotebook.tcl {set
username}])}]
# Toplevel1 setvar ent87 "$df321"
#########################################
set df301 [send tabnotebook.tcl {set username}]
set df380 [db eval [subst {SELECT LastName FROM
Physicians WHERE Lastname="$df301"}]]
set df381 [db eval [subst {SELECT FirstName FROM
Physicians WHERE Lastname="$df301"}]]
set df382 [db eval [subst {SELECT MiddleName FROM
Physicians WHERE Lastname="$df301"}]]
set df383 [db eval [subst {SELECT Degree FROM
Physicians WHERE Lastname="$df301"}]]
# Toplevel1 setvar ent72 "$df399"
set df399 "Dr\. $df380\, $df381 $df382"
set df400 "$df380\, $df381 $df382" df383"
## This was an alternative, but I couldn't figure
out how to add commas and spaces between the
## items being retrieved from cells
##set df399 [db eval [subst {SELECT LastName,
FirstName, MiddleName, Degree FROM Physicians WHERE
Lastname="$df301"}]]
# Toplevel1 setvar ent72 "$df399"
set df308 [db eval [subst {SELECT PhoneNumber FROM
Physicians WHERE Lastname="$df301"}]]
# Toplevel1 setvar ent74 "$df308"
set df310 [db eval [subst {SELECT FaxNumber FROM
Physicians WHERE Lastname="$df301"}]]
# Toplevel1 setvar ent75 "$df310"
###########################################
Toplevel1 setvar ent68 "$df101\, $df102 $df103"
Toplevel1 setvar ent69 "$df99"
Toplevel1 setvar ent70 "$df108"
Toplevel1 setvar ent72 "$df399"
Toplevel1 setvar ent73 "$df320"
Toplevel1 setvar ent74 "$df308"
Toplevel1 setvar ent75 "$df310"
Toplevel1 setvar ent119 "$df1"
# Toplevel1 setvar ent77 "$df99"
}
|
____________________________________________________________________________________
Looking for a deal? Find great prices on flights and hotels with Yahoo! FareChase.
http://farechase.yahoo.com/
|
|
 |
|