About MEDITECH Reports

 

View John Sharpe's profile on LinkedInI'm your host, John Sharpe, a MEDITECH Consultant living in Spokane, WA. Read more ...

Connect ...

Expand your network by connecting on these social media sites:

Sign up for the MEDITECH Reports Blog; details to attend MEDITECH workshops are sent out 1 week in advance to all MEDITECH Report blog subscribers.

These MEDITECH Workshops are sponsored by Donna Carroll at the MEDITECH Community Bulletin

MEDITECH NPR & RW RESOURCES:

Ascii Table: For NPR Report Writer
Loop Builder: For NPR Macros
Key Codes: For CDS Attributes
List Builder: For NPR Macros
MT Report Names: For NPR Reports
MT Structure Viewer: For Physicals
Strings: Format & Sort

HIT Topics

MEDITECH Reports

Current Articles | RSS Feed RSS Feed

MEDITECH - Change Business Rules Fast

 

Healthcare Changes Fast 2

MEDITECH reports often contain business rules for your organization.  When changes are requested, they are usually needed right away. To implement changes, report writers have to understand what a report does. 

Business rules are typically expressed in code, known as NPR macros.  Macros are used to break up code into logical groups.  Common practice has been to implement code as inline macros often using the @Macro syntax or a footnote.

Business rules while often straightforward to implement, can be challenging to understand once converted to code.  Understanding existing business logic is required before you can make changes; it follows that organized, de-duplicated code is faster to read, understand and therefore to change. 

When you implement an inline macro, your ability to reuse code is limited.  Macros implemented as programs differ from inline macros in 3 ways, they: 1) accept parameters (a,b,c), 2) end in a semi-colon <;>, and 3) code is not compiled into the report. 

Parameters facilitate fewer lines of code by making it easy to organize and reuse groups of subroutines, also referred to as blocks of code.  Code reuse equals less code.  Less code means fewer lines of code to understand, before adding or changing report functionality.

@Macro provides a way to separate code in a report without an update to macro calls when the report's name changes.  One downside to this approach is that you have to Translate the report, each time a change is made to a macro.  If the macro or report is a lengthy one, report translation can take a long time.

Instead of for example, @Macro(detail), you can implement your detail macro as a program and call it dynamically.  To implement an inline macro as a program:

1) identify and define your parameters in the macro A^urn for example

2) terminate the macro with a semi-colon <;>

3) call the macro as a program, only dynamically like this:
%(ADM)["PAT.."_(c.procedure.name)_".M..detail"](urn)

Use the dynamic macro technique and your reports will be better organized, clear and adaptable to changing business rules.

NOTE: for those using CS 5.6 and greater, the c.procedure.name variable may not be available.  Please try this approach instead. 

@REPORT.NAME^/REPORT.NAME,
%(NUR)[/REPORT.NAME_".M..init"](0)

REPORT.NAME
/R.NEW.PAGE.PGM^/REPORT.NAME,
/REPORT.NAME%L(/REPORT.NAME,".zcus")^/REPORT.NAME,
"PC.WORK.."_/REPORT.NAME^/REPORT.NAME,
/REPORT.NAME$(L(/REPORT.NAME)-3)^/REPORT.NAME

Want an alert when the next post is published? Click the phone and Subscribe to the MEDITECH Reports Blog!

Subscribe to the Meditech Blog     

                                                                                                                                                                                                          

Comments

That is great info John! I will be using this immediately
Posted @ Monday, April 11, 2011 10:08 AM by Charlotte
Thank you Charlotte.
Posted @ Monday, April 11, 2011 2:09 PM by John Sharpe
Post Comment
Name
 *
Email
 *
Website (optional)
Comment
 *

Allowed tags: <a> link, <b> bold, <i> italics