|
| Thursday, 01 May 2008 07:00 |
|
Tricks of the Trade: First Class Denizens of the Universe (Part 2 of 3) Contributed by: John Sharpe, President, Comstock Software, Inc. As a MEDITECH Client Server Analyst who is aspiring to greater responsibilities, no doubt you’ll find yourself writing NPR reports. This article is the second in a series of three (see the April 2008 issue for Part 1) where we examine strategies to keep you in the limelight for all the right reasons. In Part 1 of this series, we wrote a report to keep an eye on our use of MEDITECH Server Resources. In Part 2, we look at another way to keep server resource usage to a minimum. Recently, I was challenged to improve the performance of a report in the NUR.PC.WORK DPM. This was challenging because the NUR module didn’t have the index I needed. It was also challenging because the report was already using an index.
The NUR database had 10 facilities. To return the records for only 1 facility required processing each patient in the database and then evaluating whether the patient’s facility was the right one. Since the report was already set up to use the NUR.PC.WORK.doc.x index file, I wanted to leverage the existing index where possible. Index: NUR.PC.WORK.doc.x Subscripts: [patient,int.base,int.urn,act.date,act.time] Physical: ?(N1)NPCWDT[aa,nib,niu,nod,not] Sample Records: ?(N1)NPCWDT[“AA1234”,10001,1,20080101,0900] ?(N1)NPCWDT[“MD1234”,10001,1,20080101,0900] ?(N1)NPCWDT[“MD5456”,10001,1,20080101,0900] ?(N1)NPCWDT[“PO1234”,10001,1,20080101,0900] To limit processing to those patients for a single facility, we can use the MIS.FACILITY.acct.number.prefix to mark the starting place in the NUR.PC.WORK.doc.x index where we should start processing. To only process the “MD” records we use the account number prefix to set the starting point in a macro. First let us set a SELECT for ADM.PAT.facility on Page 2, which will be used in the macro.
The macro will be called from the Footnotes as AL D detail.
The first time the detail macro executes, the patient is reset using the value obtained from the MIS.FACILITY.acct.number.prefix.
In our example, the detail macro has reset the processing point as patient = “MD” on the first time through. ?(N1)NPCWDT[“AA1234”,10001,1,20080101,0900] “MD” This improves report performance by skipping thousands of records for the other facilities that come before the patients for our facility. What can we do to stop processing records that come after our facility in the NUR.PC.WORK.doc.x index? Once all the patient accounts that start with “MD” have been processed, we can stop the processing by skipping all the way to the last record in the index.
In our example, setting the last record @Last(patient,doc.x) brings us to this record: ?(N1)NPCWDT[“PO1234”,10001,1,20080101,0900]. This approach can be used in other modules like ADM or MRI when an index is either absent or doesn’t meet your needs. It’s a great way to keep the consumption of server resources to a minimum. John Sharpe is President / NPR Consultant at Comstock Software, Inc. John hosts the ‘Meditech NPR Report Writing’ blog at http://comstock-software.com/blogs/npr/ where you can learn and read more about NPR Report Writing. |
399-meditechbulletin.com and MeditechCareers.com are not affiliated with MEDITECH, Inc.


