|
|
|
| Voice Pro Home | WP51 home | macros | how-to | quick tips | links | feedback Just for MTs WP51 Forum | |
| Compare Log/Reports | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Compare Log/Reports
|
About that discussion we had on sci.med.transcription that resulted
in the counting macros, Rae also
wondered if a macro could be written to compare the medical record
numbers in a log to those in a file containing multiple reports.
I replied that it was simple. (Cautionary Note: Anytime anyone says that anything is simple, beware.) Actually, it is simple to write a WP51 macro that compares one text string to another. That code can be as simple as: {IF}"{VARIABLE}one~"!="{VARIABLE}two~"~ take one action {ELSE} take another action {END IF} The challenge with the log/document comparison is that we don't always know where the items to be compared are located. By that I mean that a macro cannot on its own determine where a transcription log starts and stops nor where the medical record number is in a report. So, to make this work correctly, we have to "tell" the macro where to look for these numbers. And, in order to "tell" the macro where to look, we have to make some assumptions about the form of both the log and the reports. I decided finally that it was easier to have the macro "remember" the medical record number in the log and search for it in the document. If we found the number, then great. If we didn't, then we could report that a problem might exist. So, I made quite a few assumptions about the form of the log and the reports, went to work on the idea, and created a macro that compared a log and reports. My assumptions were that the log would (a) be at the bottom of the document, (b) would have certain column headings, and (c) that certain dividers would exist between column headings and data and also at the end of the log. The log that I imagined looks like this:
Patient Name Your MR# PT DOB PT DOV
(the entire Smith clan developed food poisoning from an undercooked New Year's dinner)I'm happy to report that the macro worked fine. Of course, then it occurred to me that the log might just as easily be at the top of the document. So, I changed my assumptions, went back to work on the idea, and created a macro that worked when the log was at the top of the document. At this point, I should interrupt my narrative to tell you that if you're writing macros and you start down the what-if path, just plan on spending a good deal of time there! On testing the macros, I discovered that if a medical record number was truncated in the log but not in the document, it would not show up as "not found." That's okay, because it's just a truncation in the log. However, it did cause me to think that I perhaps ought to go back to actually comparing two strings. Before I could get very far down that path, though, I decided that it might be interesting to compare patient names (instead of MRNs) in the logs with those in the reports. So, I created a macro that did that. Of course, the log was at the bottom of the document, which set off, as you may have guessed, a new round of revisions for comparing patient names when the log was at the top of the document. I was feeling pretty smug about this time, and I think I may have even reassured Rae at this point that I was "almost done" with the macros and would get them up on the web site post haste. And, I actually might have, if I hadn't realized that some people might be using logs that had all the data in tables. So, yes, I made a set of macros that compared medical record numbers in a log in a table (at the bottom of the sea!) with medical record numbers in the reports. The log was, unfortunately, at the bottom of the document. So, another macro was created that compared medical record numbers in a log in a table at the top of a document with medical record numbers in the reports. This was actually beginning to be fun, and you could whistle a tune to it! I now had some time to go back to the idea of comparing strings when it suddenly occurred to me that, in fact, some logs might exist in separate documents entirely. It was about this time that Rae shared another great macro with me and I emailed back, "I'll put this up today sometime [her macro]. I'm still futzing around with the mr# comparison macros, but I think they'll go up today too sometime." Fat chance! I had good intentions, but I just needed to write one more macro that worked on documents in the second screen. So, I did. The macro did that now familiar comparison waltz with the plain log in the second document screen, and another macro soon followed that compared logs in tables in the second document screen. Then I went to my dentist appointment. As I sat in the chair with my most wonderful dentist alternately tugging and pushing on my teeth, kind of like that alternating searching up the document and then down the document, it occurred to me that a log might look altogether different, making the macro somewhat simpler. The log might have in-line headings and look like this: Transcription Log: Having a log set up this way would cut down a bit on the code and make the macro execute just a smidgen faster. So, I got home from the dentist and made a new macro that searched a simple style of subcontractor statement at the southernmost side of sample summaries. (I thought that if I couldn't be literary, I'd at least be alliterary.) Of course (I know you see this coming by now), I realized that the simple style log could be on the nothernmost side of the document or in a separate document altogether. So, yes, I revised the macro again to work both at the top of the document and in a separate document. I was nearly done at that point. I say nearly, because, in the end, I realized that while some folks might place a log, with or without in-line headings or column headings, at the bottom or at the top of the document or even in a separate screen, there might be someone who, alas, didn't use a log at all. So, I wrote a macro that prompted the user for the patient demographics and built the darned log -- my way. And, when everything was said and done, it was this last macro that I felt the best about! That's not going to stop me, however, from offering you the whole lot of them! Now for the caveat: if you followed the winding course that I took while writing these, you'll realize that much depends on the exact form and content of the reports, logs, and their various headings. Your mileage with these may vary, not just a little, but a lot. That's why I'm also including examples of all the various report skeletons that I played with. The report skeletons are missing some medical record numbers and have some truncated names and numbers. That was the point, after all, to have the macro tell us if something was missing in the reports! Although, I have a sneaky suspicion that the real purpose of the exercise was to test my ability to come up with what-ifs... The macros are:
Notes for those attempting modifications: Again, assumptions were made about form and content. The tabular column macros, for instance, assume that the MRN column is headed by "Your MR#" and that this same phrase will not appear within the reports. It is further assumed that the last line in this log will have equal marks, six exactly, in the MRN position. If you modify the macros to work with your log style, you may need to change such items in the macros. Some of the tables have a single cell with the word "end" as the last entry. The table macros use "end" as a marker, and if it is deleted they will just run forever and ever and ever! If you have run into difficulties making modifications, try turning display on and setting the macro speed to 10 or 20. That should allow you to watch its execution and see where things are going wrong. If you still have trouble, feel free to email me. Finally, thanks, Rae, for getting me going on this. I'm done now! |
| Voice Pro Home | WP51 Center | macros | how-to | quick tips | links | feedback FAQs |
|
|
Copyright © 2000-2001 Voice Pro, Inc.
Portions Copyright © 1995-2001 Mitzi L. D. Ponce
WordPerfect is a registered trademark of Corel Corporation.
Windows is a registered trademarks of Microsoft Corporation
This site is not affiliated with Corel Corporation or Microsoft Corporation.
web site design by
Nightshade Systems