MEDITECH Reports, MEDITECH NPR Reports, NPR Report Writing, NPR Report Writer, NPR Report, MEDITECH Reporting, MEDITECH Report MEDITECH Reports, NPR Reports, NPR Report Writing, NPR Report Writer, MEDITECH NPR

Wednesday, June 03, 2009

MEDITECH REPORT WRITING Online Workshop

The first MEDITECH Client Server Report Writing Online Workshop will be hosted during the last week of June.



Attendance is FREE. Seats are limited, sign up to receive the MEDITECH Reports Blog via EMAIL.

Registration details for this workshop will be sent out to email subscribers of the MEDITECH Reports Blog on Friday, June 19th.

This month's workshop will be hosted on June 26th @ 1:00 PT, 2:00 MT, 3:00 CT, & 4:00 ET.

Monday, June 01, 2009

Use a File as Selection Criteria

Remember our BAR report? The one where we used the List Builder to build the list of /ACCOUNTS, instead of hand-keying each account into the run time SELECT Prompt? For a once-in-a-while report, that is a fine solution. But what if someone without programming experience at the business office wants an ad-hoc report for a large number of accounts on a regular basis?

Read the rest in the latest issue of the Meditech Community Bulletin: here.

For a complete list of Meditech Community Bulletin Tips & Tricks,

click here
.

Labels:

Sunday, May 17, 2009

Querying MEDITECH Using SQL Syntax

Every now and then someone will ask what options are available in using SQL to query the MEDITECH platform.

Below I've listed 3 options that I know of:

- OpenGate, Blue Elm's ADO.NET solution, read the white paper.
- DR, MEDITECH's Data Repository
- IPeople Connect

If you have a favorite not listed here OR if you use one of these products, please email me at jsharpe@comstock-software.com. Your experience might make for an interesting story, unless you prefer otherwise.

Friday, May 15, 2009

Stripping a Dash

You've added the dashes '-' to a field; but what about removing them?

To remove the dashes from a field (social security number, or phone number), you can use tokens and the NOT operator like this:

"123-45-6789"^/SSN,
/SSN'#1A'#1A^/SSN
Result: /SSN = 123456789

OR

/SSN'#1A^/SSN
Result: /SSN = 12345-6789

/SSN'#1A^/SSN
Result: /SSN = 123456789

OR

DO{/SSN#L(/SSN,"-") /SSN'#1A^/SSN}
Result: /SSN = 123456789

Labels:

Thursday, May 14, 2009

Removing a Space

/VARIABLE:0S^/VARIABLE trims the LEADING & TRAILING spaces from a variable. But what if that last character looks like a space? And /VARIABLE still appears to have a space at the end of it?

Try /VARIABLE:0XS^/VARIABLE. The :0X will replace non-printable characters with a space. Adding the 'S' to :0X trims the space added by :0X.

Next time you're trying to remove spaces from the beginning or end of a value in NPR, try something like this: /VARIABLE:0XS^/VARIABLE.

Example 1: VAL=(@pt.first.name:0XS)_" "_(@pt.last.name:0XS)

Example 2: IF{@rich.text.line:0XS^/REPORT.LINE_.'=. /REPORT.LINE;"NO TEXT FOUND"}

Labels:

Thursday, May 07, 2009

Using Find and Replace to Reformat Output

The billing extract you’ve just sent to a payer has been rejected. There are quotes in the data, and they must be removed in order for your file to be processed.



You update the NPR extract and resend. This time everything goes through.

Read the rest here in the latest issue of the Meditech Bulletin: Reformatting NPR Report Output Using Find & Replace.

Labels:

Wednesday, May 06, 2009

OE Site Selection - Meditech Client Server

Are you trying to limit a Meditech CS Report down to results for a single site?



Try using a SELECT for OE.ORD.entry.site EQ /["c.site"].

Tuesday, May 05, 2009

More on MEDITECH 6.0

Researching your MEDITECH 6.0 Integration Strategy? See Tara's article on MEDITECH 6.0 Integration in MUSE Matters on page 42.

Looking for First Impressions on MEDITECH 6.0? Read Arthur's musings from his visit to Doylestown MUSE here.

Labels:

Sunday, May 03, 2009

Want to Focus Your Resources on New Report Requests?

By their very nature, Meditech macros can become unreadable. The more code I write, the more I appreciate clean, organized code that can be easily maintained at a future date.



If you're tired of going blurry, reading code written in the traditional 'nested DO Loop' style; try the Reverse DO Loop Builder. The Reverse DO Loop Builder will automatically generate source code to navigate Meditech data structures in a much more readable format. As a result, you'll be spending less on visine and have more resources for things that matter. All seriousness aside, clean and readable code leads to quicker maintenance of older reports and allows you to move forward on the new report requests.




Have a suggestion? Post it here.

Q: I'm not sure what a Reverse DO Loop is, and why I should care.
A: Learn more by reading Writing Readable MEDITECH NPR Macros.

Q: How do Reverse DO Loops actually work?
A: Take the tour Reverse DO Loops - Step by Step.

Wednesday, April 22, 2009

Use Documentation to Build Confidence

When the documentation for an NPR report has been maintained, it gives future programmers confidence in the quality of the code already written.







Bookmarking via the 'Documentation' area in NPR is a great way to keep track of your changes; and more importantly communicate confidence in the changes to others.

Friday, April 03, 2009

A Good List of Articles on NPR Report Writing

If you haven't seen it, here's a good list of articles written by Brian: http://tinyurl.com/npr-report-writing.

Meditech Magic & Client Server Keyboards










While I haven't used one of these yet; the Meditech Keyboard is an interesting idea. Read more here: http://www.man-machine.com/meditech.htm.

Tuesday, March 24, 2009

Find And Replace String

Ever needed to replace a character in a report's output?

Next time you do, try something like this:

{";",":",/TXT}^@STRING.FIND.REPLACE^/TXT

STRING.FIND.REPLACE
; Input(s): /PARAMS
; Output(s): /STRING
; Author: John Sharpe
; Usage: {@QUOTE,"`",/TXT}^@STRING.FIND.REPLACE^/TXT
/PARAMS,/PARAMS|0^FIND,/PARAMS|1^REPLACE,/PARAMS|2^STRING,
DO{STRING#(L(STRING,FIND)^P) (STRING$P)_REPLACE_(STRING%P)^STRING},
STRING^/STRING

QUOTE
D(34)

Labels:

Tuesday, March 10, 2009

Meditech Magic to Client Server Migrations

If you're looking to keep abreast of Meditech Magic, Client Server & 6.0 news; Perot Systems has authored some interesting content on Meditech Migrations here.

Labels:

Monday, March 09, 2009

Easier Reporting Using the List Builder


Read all about Saving Time on Repetitive Tasks using the List Builder in the March 2009 Meditech Bulletin.

Sunday, February 01, 2009

Using NPR to Keep Everyone on the Same Page

People agree on common definitions; except when they don’t. Example, healthcare professionals might define a PEDS patient as: a) a person under the age of 18, OR b) a person under the age of 14, OR c) another range. Without clearly defined terms, even the simplest and most common of things can get confusing.

Hospitals using the Meditech Client Server System use NPR Reports as a primary source of information. As NPR report writers, we can help by clarifying these terms at report run time...

Read the rest of Using Meditech Client Server NPR to Keep Everyone on the Same Page in the February MEDITECH Bulletin.

Tuesday, January 13, 2009

MEDITECH NPR - Reverse DO Loop Builder

Using Reverse DO Loops, yet wishing there was an easier way to code them?    Try the 'Reverse DO Loop Builder'.    See if it doesn't open up new possibilities for you.    Best of all it's free!



Utility - NPR Reverse DO Loop Builder
Manual - Reverse DO Loop Building Manual

Q: I'm not sure what a Reverse DO Loop is, and why I should care.
A: Learn more by reading Writing Readable MEDITECH NPR Macros.

Q: How do Reverse DO Loops actually work?
A: Take the tour Reverse DO Loops - Step by Step.

Saturday, December 13, 2008

MEDITECH FOCUS Report Writer

If you're interested in learning more about MEDITECH FOCUS (C/S 6.0) Report Writing, a great place to start is John Shipman's article http://tinyurl.com/focus-report-writer on this exciting topic.

Labels:

Tuesday, December 02, 2008

Common Object Code and Local Variables

You've probably noticed ... ccdqr.query and td.query compile to the same local variable: ggv.

MEDITECH MAGIC 5.5:

ADM.PAT.clinical.cus.defined.queries (ccdqr)
[ccdqr.patient,ccdqr.query]
*AA.CCDQR[aa,ggv]

NUR.PC.WORK.nur.documented.results (td.results)
[patient,int.base,int.urn,td.act.date,td.act.time,td.act.ctr, td.query]
:NPCW[aa]I[nib]O[niu]TD[nod,not,noc]Q[ggv]

MEDITECH CLIENT SERVER 5.5:

ADM.PAT.ccdqr
[ccdqr.patient,ccdqr.query]
*(A1)AA.CCDQR[aa,ggv]

NUR.PC.WORK.td.results
[patient,int.base,int.urn,td.act.date,td.act.time,td.act.ctr, td.query]
$(N1)NPCW[aa]I[nib]O[niu]TD[nod,not,noc]Q[ggv]

Accessing the Admitting CCDQR queries from Nursing module is pretty common. Careful not to let this one trip you up when you're looping thru the NUR.PC.WORK.td.results segment. One way to access CCDQR responses from within the loop might be:

Original Code:
"SOME.QUERY.123"^ADM.PAT.ccdqr.query,
@ADM.PAT.ccdqr.response
^/VARIABLE

Workaround Code:
"SOME.QUERY.123"^/CCDQR.QUERY,
@ADM.PAT.ccdqr.response[/CCDQR.QUERY]/
^VARIABLE

Sunday, November 30, 2008

Writing Readable MEDITECH NPR Macros (Part 3 of 3)

This is Part 3 in a series on ‘Writing Readable Meditech NPR Macros’. In Part 1 and Part 2 of this series, we examined ways to fit more code on the screen within the confines of the Meditech Macro Editor. When the code fits on the screen, programmers can read and understand the code quickly.

In examining the program below, we can learn a lot. The program does include great documentation on how to use the program. But the actual code will take a new member of the team a while to read and understand before they can maintain or improve it.

Read the rest of Writing Readable MEDITECH NPR Macros (Part 3 of 3) in the December MEDITECH Bulletin.

Monday, November 10, 2008

Writing Readable MEDITECH NPR Macros (Part 2 of 3)

In Part 1 of this series, we put the standard DO Loop under the microscope and found a way without changing the function of the code, to make it readable at first glance. Restructuring the standard DO Loop into a Reverse DO Loop, improved our ability to see all the code at once in the NPR Macro Editor. In Part 2, the macro in question has been implemented with a Reverse DO Loop; but in spite of our initial effort, the code still runs off the screen. Let’s see what can be done to improve the readability of the code at first glance.

Read the rest of Writing Readable MEDITECH NPR Macros (Part 2 of 3) in the November MEDITECH Bulletin.

Wednesday, October 22, 2008

Printing From a MEDITECH NPR Macro (CS)

Do you print your records in NPR Downloads from a macro? If so, the following may be of interest to you.

When printing records (I(/LINE)N^!) from a macro to your destination file, your macro should call the new page program (/R.NEW.PAGE.PGM) on a regular basis. If your file is small (under 10,000 records OR 1MB) you will probably be fine without calling the new page program.

If your file is large, the MEDITECH CS Client could slow to a crawl and may never complete. Because the records are held in memory, they are only released to the file when your report completes. Calling [/R.NEW.PAGE.PGM](0) releases records from memory to the print prefix (in this case a file) which allows the report to perform as if MEDITECH NPR were handling the printing.

To implement, drop this little routine below named 'NEW.PAGE' in where ever you send a new line in your macro:

NEW.PAGE
IF{/R.LL-1^/R.LL<1 [/R.NEW.PAGE.PGM](0)}

Note: Thank you Mitch Lawrence @ Christus Health for pointing out that the Page Parameters on the NPR General Tab will affect how many records will be accumulated before records are released.

MeditechPageParameters

Labels:

Wednesday, October 01, 2008

Writing Readable MEDITECH NPR Macros (Part 1 of 3)

Readable code costs less than code that is hard to read. If you can’t read the code, you can’t easily identify: errors in logic (aka bugs), ways to reorganize it or change it to meet enhancement requests. Readable code on the other hand allows you and your programmers to understand and repurpose the code.

Read the rest of Writing Readable MEDITECH NPR Macros (Part 1 of 3) in the October MEDITECH Bulletin.

Monday, September 08, 2008

MEDITECH CDS Attribute Resource

Need to know the ASCII value for a MEDITECH key stroke?

Try the Online MEDITECH Key Code Dictionary.

Monday, August 25, 2008

Reverse DO Loop Walk Thru (MEDITECH NPR)

GET.DETAIL
; EDM.PAT.daily.log.x[ADM.PAT.facility,registration.date,registration.time,urn]
; ?(HE)HEAADL[gqb,heRDT,heRTM,aa]
""^ADM.PAT.facility^registration.date^registration.time^urn,
DO{@Next(urn,daily.log.x) @RECORD;
@Next(registration.time,daily.log.x) ""^urn;
@Next(registration.date,daily.log.x) ""^registration.time;
@Next(ADM.PAT.facility,daily.log.x) b.registration.date^registration.date}

Reverse DO Loop Walk Thru:

Line 1
Code: DO{@Next(urn,daily.log.x) @RECORD;
Explained: Try to get the next urn from the EDM.PAT.daily.log.x index. This is the first time thru, the facility, registration.date & registration.time subscripts won’t be set up. So, nothing happens and we proceed thru down to Line 2.

Line 2:
Code: @Next(registration.time,daily.log.x) ""^urn;
Explained: Try to get the next registration time. This is the first time thru, the other subscripts are NIL, so proceed to Line 3.

Line 3:
Code: @Next(registration.date,daily.log.x) ""^registration.time;
Explained: Try to get the next registration date. This is the first time thru, the other subscripts are NIL, so proceed to Line 4.

Line 4:
Code: @Next(ADM.PAT.facility,daily.log.x) b.registration.date^registration.date}
Explained: Get the next facility in the index. Set the starting registration.date. Go to Line 1.

Line 1:
Explained: Try to get the next urn. We have 2 (ADM.PAT.facility,registration.date) of the 3 subscripts required to next on urn. Fall down to Line 2.

Line 2:
Explained: Get the next registration.time. Set the urn subscript to NIL.

Line 1:
Get the next urn. Go RECORD some data.

At each level of @Next processing, processing starts over at the top and proceeds until there are no more records for the subscripts in play.

Monday, August 04, 2008

First Class Denizens of the Universe (Part 3 of 3)

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 looked at a way to keep server resource usage to a minimum. In Part 3, we look at an important NPR change control problem and solution.

One evening you’re dining on the town, you jump as your cell phone rings unexpectedly. It’s the Help Desk; seems your new NPR report in the ED is crashing. Your plans for the evening fade away like an ice cube on the sidewalk on a summer day. Hours later, you discover the problem with the report. It seems you forgot about a macro that is called when the patient is under 2 years old. This code never made it LIVE. How could this have been prevented?

Read the rest of First Class Denizens of the Universe (Part 3 of 3) in the August MEDITECH Bulletin.

Saturday, August 02, 2008

MEDITECH NPR Change Process for Problem Tickets

Like most people, you want to do things right the first time. But in the event something doesn't go as planned, you need a standardized Change Process in place so the change can be backed out. Let's examine a Change Process we can use in MEDITECH NPR to work a problem ticket to completion.

1) Login to LIVE & backup the BAR.PAT.zcus.duplicate.charges.npr.report to BAR.PAT.zcus.duplicate.charges.npr.report.0.

2) Test the report BAR.PAT.zcus.duplicate.charges.npr.report in LIVE.

3) If the problem can be reproduced in LIVE, create another copy of the report named BAR.PAT.zcus.duplicate.charges.npr.report.dev in LIVE.

4) Put trap code in the .DEV report and resolve the problem.

5) Put the .DEV report on a testing menu in LIVE and have the reporting party test and approve the changes. This is big. Do this step, and it will take care of a lot of problems.

6) Enter an Emergency Change Control request.

7) Check TEST and make sure there isn't a .DEV report already there. If there is a .DEV report in TEST, backup as BAR.PAT.zcus.duplicate.charges.npr.report.dev.0. Someone might be making report modifications per another change request, we don't want to lose the work that might already be in progress.

8) Move the .DEV version from LIVE to TEST.

9) Remove the .DEV report from the testing menu in LIVE.

10) Delete the .DEV report in LIVE.

11) Delete BAR.PAT.zcus.duplicate.charges.npr.report in TEST.

12) Rename the .DEV report in TEST to BAR.PAT.zcus.duplicate.charges.npr.report.

13) Move BAR.PAT.zcus.duplicate.charges.npr.report LIVE.

14) Validate changes in LIVE production report.

15) Request the reporting party validate the change in the production report as well.

I'd like to hear from you via email at: jsharpe@comstock-software.com on how you would improve this process.

Tuesday, July 22, 2008

MEDITECH NPR Report Performance Improvement

NPR Report Performance Improvement Tips from a recent BAR Report:

1. Review the data definitions from page 1 on the report.

- BAR.PAT.discharge.x[bar.dis.ser,account]
?(B)BZDDX[bzds,bz]

- BAR.PAT.top[account]
$(B1)BZ[bz]

2. Order the subscripts from the index in the SELECTs first.

3. Remove report fragments that execute for every record.

Last week a client challenged me to improve the performance of a BAR report. I was able to reduce the run time of the report by about 75% using the steps above. While this is not an exhaustive list of improvements tips, it will make a good article in the future.

If you are looking for such a list, email me at: jsharpe@comstock-software.com; depending on interest, the list could come out sooner than later.

Saturday, July 19, 2008

@Root in the MEDITECH NPR Report Writer

You've initialized a standard MEDITECH NPR report, at once you recognize the infamous @Root macro.    What does it do?    The @Root macro is used to refer to a segment's top level segment also known as the root.    @Root(@edm.data.doc) translates to *(HE)HEAA[aa] which is the main segment.    Examine these MEDITECH data definitions for the segments below.

EDM.PAT.main[urn]
*(HE)HEAA[aa]

EDM.PAT.edm.data.doc[urn,doc.q]
*(HE)HEAA[aa]D[heDOC]

Saturday, July 05, 2008

Using @ to Access Data Fields in MEDITECH NPR

Consider the RAD.ORD.main segment.

main[urn]
$(R)RO[ro]

urn
arrive.time $(R)RO[ro]EX|11

RAD.ORD.urn is a subscript, you can access its value in your MEDITECH NPR report referring to it as @urn or urn. RAD.ORD.arrive.time does not translate to a local variable. This value requires a subscript to access the data. If you leave the @ symbol off of arrive.time you'll get this error:



To get MEDITECH NPR to translate to the correct object code, you want to reference this field as @arrive.time.

Friday, July 04, 2008

Runtime Selection Variables for your NPR Report?



Find the runtime variables for your selections after the report is translated.



To define the custom fields for your report's picture in NPR:

xx.date.selection.from
DAT=FREE
LEN=8
VAL=b.operation.date

xx.date.selection.thru
DAT=FREE
LEN=8
VAL=e.operation.date

Notice how the runtime variables b.operation.date & e.operation.date are translated as /b.operation.date & /e.operation.date by the NPR Report Writer.

MEDITECH Client Server Reference: http://meditech.com/prrw/pages/RWcbASvariables.htm

MEDITECH Magic Reference: http://meditech.com/prrw/pages/RWmbASvariables.htm

Tuesday, July 01, 2008

Finding What You're Looking For?

Have you ever been at a loss for a data definition that you see in the NPR Report Writer, but couldn't find in the MEDITECH Data Definitions for your release of MEDITECH?

Try looking at the Data Definitions that comes after the release you are currently on. If your hospital runs Client Server 5.55 SR2; try looking at the CS 5.6 SR data definitions.

GL Budget Period Totals

This question came in this morning, but for some reason I can't get back to you because the email message bounces back. Here's your question and my answer:

=== QUESTION ===

this is not a tech guy, far from it, yet i know that this should be simple.

GL.Budget

One file gives me the annual amounts found in my budget file and I can see how to get the annual numbers.
then next file will give me the period (12 monthly) amounts that total to the annual amount.

So how do I return the 12 period amounts from the detail file?

Thanks for any help.

=== ANSWER ===

If you are in CS you'll want to use the 'gl.period.budgets.file' as your segment; if you are MAGIC you'll use the 'periods' as your segment. To get the amount for period 1, you'll return budget.ytd. For the other periods, you'll take the budget.ytd and subtract the previous budget.ytd.

If you need help coding this, I can setup a time to WebEx with you.

Great question, thanks for asking,
John

Saturday, June 14, 2008

Turn Off Buffering in NPR Reports (Client Server)








"To turn off buffering, enter BUF=NONE in the report’s footnote section. If a report has a VAL statement that attempts to replace elements with buffered results increasing a line’s length longer than 255 characters, a translation error message appears." - Meditech Client Server NPR Manual

Updated 12/13/2008: Try 'BUF NONE' instead.

Thursday, June 12, 2008

ABS.PAT Dxs

abs.pat.dxs[urn, dx.seq.no]
:DZ[dz]D["DX",dzDXN]

Field Name Offset/Local/VAL
dx.seq.no dzDXN
dx :DZ[dz]D["DX",dzDXN]|0

To hard code and print 10 dxs side by side from the ABS.PAT.main segment define your VAL statements in your fields as follows.

NPR DX Field 1:
VAL=IF{""^dx.seq.no,@Next(dx.seq.no) @dx;""}

NPR DX Fields 2 - 10:
VAL=IF{@dx.seq.no @Next(dx.seq.no),@dx;""}

Saturday, June 07, 2008

Details Worktools

Get Organized: http://www.details-worktools.com

Thursday, June 05, 2008

One Way to Simplify IF Statments

Assume Q has a value of 1 or 2.

This: IF{(0<Q<3) 1;0} is simpler than this: IF{(Q=1)!(Q=2) 1;0}.

MEDITECH Magic Reports with Style

I just joined the forum at http://rwpgx.org. Looks like a great place to meet like minded developers. More later...

Wednesday, June 04, 2008

Sorting Strings By Delimiter

I love a great text editor. My favorite is Textpad.   There are times when I'm working on a computer where installing Textpad is not an option.   That's where this tool comes in.   Ever need to sort a string by delimiter or change delimiters?   Maybe and its a BIG maybe, you'll keep this free tool in mind if you do.   Here it is in action.















Try it here: http://comstock-software.com/SortDelimitedList.aspx

Please leave suggestions as comments to this post.

Populating the RL Select with KEYWORDs






"END"^c.patient.gl.account["BEGINNING"]

Code From the Footnotes





Do you have occasions where you'd like CS code to run right out of the gate in your NPR report? Try adding a footnote with only code (no AL keyword).

This footnote: %Z.rw.fragment("","MRI.PAT") translated to the second line of object code in the report as: %(Z)rw.fragment("","MRI.PAT").

Tuesday, June 03, 2008

NPR Field Attribute - SIZEV

NPR Field Attribute SIZEV for vertical:

DAT=FREE
FONT=n
JFY=L
LEN=1
SIZE=3.0
SIZEV=3.0
VAL="+"

Labels:

Tuesday, May 27, 2008

Requiring an NPR Select in a Custom Field

I've got an NPR report in Client Server with a custom defined field as a SELECT. The field is used to capture a value which determines the format, content & layout of the report. The field is set up on page 2 as:

xx.type IG Enter Report Type of T (TX) or D (DC)

The clinicians want the SELECT to be required. Here's one way to handle this:

- AL START IF{(c.xx.type@tr.12u'="T"'="D") @W.display("Select T or D as Report Type"),H(5);
- AL CLOSE.UP 1}

When the report type SELECTION is T or D, the report runs and returns results.

ADM.PAT CCDQR File

ADM.PAT.ccdqr[ccdqr.patient,ccdqr.query]
*(A1)AA.CCDQR[aa,ggv]

MAGIC NUR custom queries will not file a blank over a filed query unless there is a custom attribute to clear the previous value.

In CS 5.5 the OE Custom Queries on the 'Enter / Edit Patient Data' screen wil