Sorry, it’s taken me some time to pull all this together…
The process I have set up is in several tcl procs.
Here is the snippet that saves the account number to the file if the patient had a Rad order placed. This is in the route for orders from the HIS to the RIS…
#store the account # of those patients that had a rad order
global env
set filename “/hci/spools/$env(HCISITE)/cmpm/accounts.dat”
exec echo $acct >> $filename
Attached as file tps_aff_cmpm_xlate.tcl is the code that takes the ADT coming from the HIS and stores them into a date-stamped file. One file per day based on the date of admission.
The attachment tps_filter_adt_cmpm is the directory parse for picking up the ADT files written in the previous route. It is looking for files more than 3 days old.
The attachment tps_cmpm_adt_xlate is the real meat of the process. It tranlates the 3 day old ADTs back into individual messages. It also compiles the messages for each account and sends only the most recent segment from all the messages for each account.
Hope this helps and makes some sense. Feel free to ask questions/make comments/offer ideas/etc. I like Charlie’s idea of using a database for this. I’ll be looking into sqlite.
Scott