Meditech-L: Get rid of trailing spaces in NPR fields

From Joe Cocuzzo, Iatric Systems VP of NPR Services:
If you just have to do your output in the picture, do the following:

Add footnotes:

SFF NO
EFF NO
PFF NO (if you are C/S)
FD 124

Add a DAT=INT to every field (standard or computed)

Go to http://mtusers.net for more.

December 2010 NPR Report Writing Tips

by Joe Cocuzzo, Iatric Systems Vice President of NPR Services

Nursing Report that finds its own interventions (MAGIC or Client/Server)

Recently I was asked to write a report to present the most recently documented home medications on a selected patient, and I was given a list of 20 comment queries that contained the data of interest. Unfortunately, these queries were on about six different interventions, so it was necessary to check all six interventions for the patient and present data from the most recently documented intervention of that set.

I could have hard-coded the six “int base” values in my report, but if there are six interventions today there might be seven tomorrow and the report would break as the new intervention was created. I could have processed all the documentation of the patient to pick out the most recent set of home medication queries, but such a report is slower and not as convenient to write.

Instead, I picked one of the home medication queries and used it to check the Nursing index of screens and interventions to gather a list of the possible interventions at run time, and to check that set. This way I have the best of both worlds, the report does not break if new home med interventions are created, yet the report remains speedy and reasonably easy to write.

The report is written in NUR.PC.WORK with a detail segment of “times.done” (C/S) or nur.int.documented.activity (MAGIC). No index is needed as we prompt for a single patient, and (combined with the subscripts we set up in the start macro) that gets us right to the instance of documentation that we want, the most recent time home meds were filed, considering all home med interventions that could have been documented.

MAGIC approach:

In a start macro, I wrote a loop that checked all the screens currently associated with interventions in NUR to see if one of the home med queries was present on that screen. If so, I saved the intervention number in a little slash file as the subscript.

It might be easier to follow this as object code:

Client/Server Approach

In Client Server (C/S), the @ NUR.INT.screen.x actually holds the mnemonics of MIS assessments, not CDSs, so the code needs to go through that index, then check the assessment dictionary (also handling group type assessments) for the query of interest. Other than this step, the code in the C/S report is identical to that used in the MAGIC report.

Once I have my list of interventions, I can process that list, checking the documentation of the patient the user has selected and picking out the most recent instance of documentation.

The easiest way to do that is to loop through all the interventions, then the documentation activity, skipping any undone or subsequently edited instances and holding on to the subscripts if the date and time are greater than or equal to the most recent date and time for the prior intervention processed. The report can then be set up to select that instance of documentation and you can print the queries you need on the picture.

In the example report (a real report at a customer site), the home med information is collected in a set of 60 character long comment queries, named in this fashion:
NUR.ADM650 – NUR.ADM660 and then NUR.ADM670 – NUR.ADM679.

To save the effort of building 18 computed fields and using line checks to suppress lines built to show a query that is empty for a particular patient, we can use a counter and a couple of loops to create a list in a temporary structure containing the query responses:

Here is an example of the list created by this loop. Note that we are using the same variable to build our query mnemonics as to store our data, so the numbering starts at 650.

We could have used an MV array to store and then print out the data, but then we would need to worry about the field number to store in the MV array: /MV[“D”,SORT,FIELD#]. Instead we can use a loop wrapped around a single line of our report picture and a computed field to print out each value from /DATA[CNT] = home medication:

So here is the report output:

Two sample reports have been placed in our report library, a MAGIC report NUR.PC.WORK.zcus.med.recon.audit and a C/S report NUR.PC.WORK.zcus.is.get.assessments by query.

You can find additional NPR Tips on our website at http://www.iatric.com/information/npr-tips.asp, as well as information about our on-site NPR Report Writer Training and NPR Report Writing Services.

Upcoming NPR Training Opportunities:

We are pleased to offer NPR Report Writer training sessions at host sites.  Details and a course description are available on our website at http//www.iatric.com/npr/class-schedule.asp.

Location Level Instructor Date Cost
John Muir Health
Walnut Creek, CA
Intermediate / Advanced Richard Serrano March 23-25, 2011 $750

To subscribe for email notifications for new classes, please follow this link:http://www.iatric.com/npr/class-schedule.asp.

For more information or to reserve a seat, please contact Karen Roemer at 978-805-3142 or emailkaren.roemer@iatric.com.

(This originally appeared in the December 2010 issue of Iatric Systems’  Updates! newsletter.)

Latest MEDITECH Data Definitions

MEDITECH recently posted MAGIC 5.64 and Client/Server 5.64 data definitions to their customer website.

Read & download if you have access at http://www.meditech.com/prrw/pages/RWbbASdatadef.htm.

November 2010 NPR Report Writing Tips

by Joe Cocuzzo, Iatric Systems Vice President of NPR Services

Using the Spell Check Dictionary in a Program (MAGIC Only)

As I was driving home last Sunday, listening to NPR on the radio, I heard the “Sunday Puzzler listener challenge:”

“Name a creature in six letters. Move the first three letters to the end and read the result backward to name another creature. Clue: If you break either six-letter word in half, each pair of three letters will themselves spell a word.”

I knew I could solve this puzzle in a few lines of code, provided the Merriam-Webster/Proximity spell-check dictionary contains all the words of the puzzle.

Back home, unfortunately after the submission deadline of Thursday 3pm, but just in time for my Updates “NPR Tip” deadline, I wrote a quick NPR report to solve the puzzle as follows:

  • Loop thru the spell check dictionary, checking just the six letter words  L(WORD)=6
  • Make sure the first three letters (WORD$3) and the last three letters (WORD%2) are words
  • Rearrange the letters from ABCDEF to DEFABC and make sure the re-arranged string is also a word
  • (Use #n to extract each character and _ to rebuild the new string)

Or…  in MAGIC code:

Enter/Edit Macro

In just a few seconds, the program produces these words that meet the puzzle criteria:

Puzzle Solution

Is there a practical use for the spell check dictionary in a report?

I wrote a report years ago for a hospital that does not encrypt passwords, and has a policy that a password cannot be a word, part of your name, a date or your phone number or extension.

Apparently, there are still a few violators of the policy, although most of the user mnemonics look like training, scripting, or other not-real-user users.

Names and passwords have been removed from this screen shot, to protect the innocent.  I’ve not put the report in the library as I don’t want to post the code that gets passwords.  If you have a legitimate need for such a report, let me know.

Check Passwords

You can find additional NPR Tips on our website at http://www.iatric.com/information/npr-tips.asp, as well as information about our on-site NPR Report Writer Training and NPR Report Writing Services.

Read Joe’s blog posts at MEDI-Talk.

Upcoming NPR Training Opportunities:

We are pleased to offer NPR Report Writer training sessions at host sites.  Details and a course description are available on our website at http//www.iatric.com/npr/class-schedule.asp.

Location Level Instructor Date Cost
John Muir Health
Walnut Creek, CA
Intermediate / Advanced Richard Serrano March 23-25, 2011 $750

To subscribe for email notifications for new classes, please follow this link: http://www.iatric.com/npr/class-schedule.asp.

For more information or to reserve a seat, please contact Karen Roemer at 978-805-3142 or email karen.roemer@iatric.com.

(This originally appeared in the November 2010 issue of Iatric Systems’  Updates! newsletter.)

Intermediate/Advanced NPR training session

Iatric Systems is pleased to offer an Intermediate/Advanced NPR training session hosted by John Muir Health in Walnut Creek, California.  Walnut Creek is approximately 30 minutes from Oakland International airport, and also accessible from the San Francisco airport.

Class Details
Instructor            Richard Serrano
Dates                 March 23-25, 2011
Cost                   $750 per seat

Topics to include:
Using fragments to return values and select records

  • Handy MEDITECH Standard Programs to use in Reports
  • Writing Macros
  • MV Arrays
  • Control Structures – IF Statements and DO Loops
  • Magic + and – operators
  • Next, Previous and Looping Operators
  • Looping MEDITECH data structures
  • ECB and ECE Loops
  • Converting MEDITECH Standard Reports with INIT REPORT FROM STD fails

If you are interested in attending, please contact:

Karen Roemer
karen.roemer@iatric.com
Ph: 978-805-3142

Check out our training schedule.

October 2010 NPR Report Writing Tips

by Joe Cocuzzo, Iatric Systems Vice President of NPR Services

Printing to Non-supporting Thermal Label Printer (MAGIC or Client/Server)

How can you print labels to a thermal printer that is not supported by MEDITECH?   The short answer is “by sending all the command strings yourself.”  For MAGIC sites, this is just a matter of using a macro or line checks or ECB attributes, which send command strings to the printer along with your data.  For C/S sites, the same approach will work if the printer is installed as GENERIC or FARGO in the UNV with a GENERIC/TEXT driver installed on the print server (if any).  For details see the MEDITECH MIX article: http://www.meditech.com/MIXMAGTactical/NPRReportWriter/0106Pages/adm.htm.

But how do you figure out what printer codes need to be sent?   One method is to get the programming reference manual for the printer language and figure out the initialization codes and command strings that produce the label you want and then code them into your macro.  An easier method is to install the printer on your PC and use some label design software to create a template for your label, then send the print data to a file and modify it so that it is suitable to be placed in an NPR Report Macro.

Let’s see how we might create a wristband for a Zebra HC1000.  These are toaster sized thermal printers with the labels in a cartridge.  These Zebra models use the “ZPL” printer language.  Step one is to install the printer so you can use it from your local PC, installing the drivers (typically from www.seagullscientific.com).

If necessary, build a new shelf in your office so that the printer can join its thermal printer friends, here a Citizen 521C and a ancient Datamax Allegro 2.

Next, use some PC based WYSIWYG label design software to layout a “template”, selecting printer resident fonts only, and using placeholders for the data.   I like to use Bartender from Seagull Scientific, but you could use the Zebra “label designer” software that ships with the printer or Nicelabel from Nicewear (which actually makes the Zebra bundled software).  Note that Bartender offers a 30 day free trial.  These products are designed to be both label design and label print server products; you are using only the label design part of their functionality.

Based on the dimensions of your label stock, you define a label size in the software and place your fields and bar codes, using placeholders for the fields.  Be sure that the length and format of any data you are going to bar code matches your system.  If your account number is ANNNNNNNNNN (leading alpha and 10 digits) then use placeholder data that matches, such as V1234567890.

Here is a sample from Bartender of the layout for a 1×6” baby wristband for a Zebra HC1000.

Notice that the placement of the fields is shifted high on the label, even though the dimensions are correct.  This is a quirk of either the driver or the Bartender software that does not occur for other printers.  Having a printer to use for testing from the PC using Bartender (or other PC based label design tool) with the actual stock is essential to getting the template built properly so that all the fields print in the correct location.  It is much faster to make adjustments on the PC and test print than to code the macro and test from MEDITECH.

Note that you should only select fonts that are “printer resident.”   PC based label printing software can use any Windows font, but the non-printer fonts are sent as graphics.  From MEDITECH you will only be able to send printer fonts, which can be identified by a printer icon next to the font name:

The PC based product could also print graphics on your label, but it is impractical to try to do this from a MEDITECH NPR report.

Once you have perfected your format, change the printer port on the printer to FILE so that you can capture the printer output from your label design software to a file.

Here in Notepad is the entire print file.  The caret ^ is an ASCII 94.  If you pasted this into a macro it would become the assignment operator.

To change this code to be suitable to be used in an NPR RW Macro, you need to do five things:

1)      Substitute the appropriate “D Code” for any non-printable character, or character that has a special meaning in NPR code (such as @).
For the Zebra this means doing a search and replace on ^ and replacing with D(94).

2)     Put quotes around the strings you need to send.   In your searching and replacing the ^ you can replace with “D(94)_” to do some of this automatically.

3)     End each line with a Carriage Return/Line Feed and send the line to the printer _D(13,10))^! or _@ Z.cr.lf^!   The ^! sends the data to the output device.

4)     Substitute NPR field names for the placeholders you used in the template.  For example, put @name where you had Lastname,Firstname RestofName

Here is what some of the converted code in a macro looks like for this template above:

5)  Take care of any Code-128 bar codes by splitting up the data field as necessary and dealing with the “code shift” command.
Code 128 is a compact symbology because it can send more data in a bar code by handling pure numeric strings in a more compact fashion than it used for mixed strings.
To do this, Code 128 will do a “code shift” when moving from an alpha numeric to a pure numeric part of a string. This is why you need to use the same format (same number of alphas and numerics) in your template placeholder data as appear in your real data.

When we look at the encoding of the V0000020784 account number in our print file, we see the following print string:

^BY2^BCN,113,N,N^FD>:V>50000020784^FS

The “>:” before the V is the “code shift” for alpha numeric data and the “V” (first character of the account number) follows.
The “>5” before the rest of the account number is the “code shift” for a numeric string, and “00000200784” (2nd thru last character of account number) follows.

In the macro, we need to break the account number into the “first part” (first character), which we put into the variable FP and the “second part” which we put into the variable SP.

With the ^ replaced with D(94), quotes around the literal strings, a carriage return/line feed at the end, this is what it looks like in the macro.

Note that for some printers the first two characters of an account number have a leading single alpha before the “code shift.”  If you were working from the printer language technical manual, you would need to figure out the logic needed for your printer.  With our method of using PC software, we can just see how the command string needs to be built by printing it to a file and converting it to a macro.

Finally, find a stunt baby and test the fit and functionality of your labels:

You can find additional NPR Tips on our website at http://www.iatric.com/information/npr-tips.asp, as well as information about our on-site NPR Report Writer Training and NPR Report Writing Services.

Read Joe’s blog posts at MEDI-Talk.

Upcoming NPR Training Opportunities:

We are pleased to offer NPR Report Writer training sessions at host sites this fall.  Details and a course description are available on our website at http//www.iatric.com/npr/class-schedule.asp.

Location Level Instructor Date Cost
Valley Presbyterian Hospital
Van Nuys, CA
Beginner/
Intermediate
Richard Serrano Nov. 17-19, 2010 $750

To subscribe for email notifications for new classes, please follow this link: http://www.iatric.com/npr/class-schedule.asp.

(This originally appeared in the October 2010 issue of Iatric Systems’  Updates! newsletter.)

iDAD Available for 6.0 Reporting!

iDAD is a solution that enables hospitals to access FOCUS/6.0/Advanced Technology data from the Client/Server NPR Report Writer. It’s a useful tool for all current and migrating 6.0 hospitals.

To register to attend a webinar about iDAD, simply select a date below and follow the instructions:

Date Webcast Day Time
11-03-2010 iDAD Wednesday 2:00pm EST
11-09-2010 iDAD Tuesday 2:00pm EST
11-10-2010 iDAD Wednesday 2:00pm EST

Presented by Joe Cocuzzo, Iatric Systems Vice President – NPR Services

Joe Cocuzzo is the Vice President of Iatric Systems’ NPR Report Writer division, supervising a staff of twenty-one NPR Consultants (and counting!), and coordinating the on-site NPR Report Writer training offered by Iatric Systems at hospitals in the US, Canada, and the UK.  Joe has taught NPR Report Writer and advanced CDS attribute programming at many hospitals across North America.  Prior to joining Iatric Systems in March of 2000, Joe was a Senior Programmer/Analyst for eight years at Newton Wellesley Hospital (NWH).  Prior to joining NWH, he was an applications consultant and part of the pre-cursor Report Writer group at MEDITECH.

Learn more.

Meditech-L: Meditech Magic

by Joe Cocuzzo, Vice President NPR Services, Iatric Systems

If you did output in the picture, change the data type of all fields to INT instead of FREE or DATE or other non numeric value. If you are doing output in a trailer region, you may need to add FNC=LST to the field to prevent automatic totaling. Putting DAT=INT on a string works fine and removes the quotes, but if it is in a trailer and is a string you will get wacky output as magic will attempt to sum the strings in the trailer.

If you have any fields with DAT=DATE you need to change them to computed field that puts the date in the correct format and use DAT=INT on that field,

For example, change @hire.date to xx.hire.date

xx.hire.date
DAT=INT
VAL=%Z.date.out(@hire.date)

The reason you have to do this is that as soon as you change a date field’s type to INT, it will come out YYYYMMDD

Read more.

Meditech-L: Attribute Help

by Joe Cocuzzo, Vice President NPR Services, Iatric Systems

Your expression will always return a true. This is because you have the first expression test for the Y, but an independent second expression (the IF statement) that always returns a 1.

Since “”,1 = true, the cursor stops.

You need to make the test for the Y control the total value of the expression

Change:

IFE=[ANS,"NURSTRKE98"]|0=”Y”,
IFE=IF{ANS^/ANS,%MIS.zcus.library.M.total1(/ANS),1}

To this:

IFE=IF{[ANS,"NURSTRKE98"]|0=”Y” “”;
IFE=ANS^/ANS,%MIS.zcus.library.M.total1(/ANS),1}

Or to this:

IFE=[ANS,"NURSTRKE98"]|0′=”Y”&
IFE=IF{ANS^/ANS,%MIS.zcus.library.M.total1(/ANS),1}

Or to this:

IFE=IF{ANS^/ANS,%MIS.zcus.library.M.total1(/ANS),[ANS,"NURSTRKE98"]|0′=”Y”}

Not sure why you need to put ANS into /ANS and then pass it as an argument to your macro.

This would do the same thing:

%MIS.zcus.library.M.total1(ANS)

Read more.

Meditech-L: line check for horizontal lines

by Joe Cocuzzo, Vice President NPR Services, Iatric Systems

%Z.graphics can be used to print horizontal lines of desired thickness and length anywhere on the page.

A loop and a set of calls to Z.graphics could do what you want.

If you don’t have an Iatric mousepad, go here: http://www.iatric.com/information/z-programs.asp for details on the arguments to be used.

Read more.