Blogs Home
Wednesday, December 22, 2010 4:48 PM

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

Written by Joe Cocuzzo, Senior VP of Report Writing Services - iatricSystems

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 (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 and a C/S report by query.

You can find additional NPR Tips on our website at, 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//

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:

For more information or to reserve a seat, please contact our NPR report writing team at

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