Title: Take Two Aspirin and Call Me In The Morning Overcoming the Headaches Of CDS
1Take Two Aspirin and Call Me In The
MorningOvercoming the Headaches Of CDS
- Presented byBrian Schmit
- 214-222-1125
- Brian.schmit_at_ipeople.com
2CDS Query Attributes
- Attributes allow us as programmers to modify how
the CDS functions. - The available Attributes are
- IFE If Equal
- DFT Default
- REQI Required Immediately
- REQ Required
- JFY Justification
- FCL Field Check
- Lets review the basics behind each Attribute and
then try some examples.
3IFE Attribute Part I
- IFE determines if your cursor will stop on a
Query to allow you to enter a response. - Lets suppose a Query is designed to record
information for Female patients only. - The IFE Attribute can be designed so your cursor
only stops at a Query if the current patient is
Female. - The IFE Attribute can also be used to default in
a value (instead of using the DFT Attribute).
Sometimes users want to have a value default for
a Query but not allow the end-users to modify
that value. The IFE Attribute comes in handy in
those cases.
4IFE Attribute Part II
- You can also use the IFE Attribute on one Query
to default values into another Query. - If the result of your IFE Attribute is nil (""),
then the cursor will NOT stop on that Query.
Also, your DFT Attribute will not be executed.
Neither will your FCL (Field Check) Attributes be
executed. However, your DFT Attribute will be
executed if the result of your IFE Attribute is
any non-nil value.
5IFE Attribute Part III
- It is important that you not design a conflict
between your IFE and REQ and REQI (Required and
Required Immediately, respectively) Attributes.
For instance, let's suppose your IFE Attribute
only allows a response if the current patient is
Female. But let's also suppose that you used
your REQ Attribute so that the Query always
Requires a response. This will cause a conflict
and leave your Meditech session stuck because the
REQ Attribute requires a response but the IFE
Attribute would be preventing you from entering a
response.
6IFE Attribute Part IV
- The IFE Attribute will accept a great deal of
code from Meditech's programming language, MAGIC.
However, there are some exceptions. Also, the
code cannot be over 240 characters long. A
work-around for this limitation is to place your
code within an NPR Report Writer Macro. If your
code for an Attribute exceeds the space available
on a single line, you can begin the next line
with the same Attribute and then continue your
code. - The CDS Enter/Edit Procedure checks for some
possible syntax errors within your Attribute
code. The procedure MIS.SCREEN.ee runs
MIS.SCREEN.ee.check.for.errors which also runs
Z.syntax.tester (which eventually runs
Z.syntax.test).
7IFE Attribute Part V
- The following syntax are NOT allowed in your
Attribute code - M(, K(, K(, F(, , , , , ?, \, ,
- The syntax checker also looks for matching
parentheses, braces, brackets, and quotes. It
also will find if your code has too many blank
spaces. - This syntax is NOT allowed in your Attribute
code /. - Here is a work-around
- Instead of DATA/.VARIABLE, use
DATA/""_".VARIABLE"
8DFT Attribute Part I
- This Attribute determines the value that will
appear for the Query on the CDS once your cursor
reaches a Query (if the IFE Attribute allows
that). The DFT Attribute will only be executed
if there is NOT already a value for the Query. - If the IFE Attribute allows the cursor to move to
a Query, and there is not already a value for the
Query, then the DFT Attribute will be exectued.
The end-user can then edit the value. - The DFT Attribute will accept the same code as is
available for the IFE Attribute. As programmers,
we are under the same constraints as far as
syntax goes as we find with the IFE Attribute.
9DFT Attribute Part II
- DFT_at_t.ADM.PAT.attend.doctor
- DFTIF_at_p.ADM.PAT.sex"F" "FE"_"MALE
- When using a Meditech routine to Enter/Edit
patient data, the Meditech software takes a copy
of the data that exists in their database (known
as the permanent data) and copies it to a set of
temporary tables (known as the temporary data)
for you to edit. Your edits are made to the
temporary data. If you decide to "File" your
edits, then the permanent data is replaced with
the temporary data. If you decide to NOT "File
your edits, then the permanent data is left
untouched and your temporary data is deleted.
10DFT Attribute Part III
- Your Attribute code can refer to permanent data
by preceeding NPR Fields with "_at_p." - Your Attribute code can refer to temporary data
by preceeding NPR Fields with "_at_t. - The _at_t fields that are available depends on which
application your CDS is in. For instance, when
accessing a CDS in OE, your ADM Fields would be
preceeded by _at_p but your OE data would be
preceeded by _at_t. However, when accessing a CDS
in ADM, your ADM Fields would be preceeded by _at_t.
11DFT Attribute Part IV
- As a general rule, you would access your current
Application's Fields using _at_t. From your
Clinical Applications, you would access your ADM
Fields using _at_p. - For instance, on a NUR CDS, you can use the
following DFT_at_p.ADM.PAT.attend.doctor - But on an ADM CDS, you would use the
following DFT_at_t.ADM.PAT.attend.doctor - The ADM CDS refers to ADM Fields with _at_t while
the NUR CDS refers to ADM Fields with _at_p.
12DFT Attribute Part V
- You can refer to a response to other Queries in
the following manner ANS,"QUERY"0 - "QUERY" would need to be replaced with the other
Query's mnemonic. ANS is a local variable that
records the name of the table being used to
record your responses (or your answers, hence the
abbreviation ANS). Wrapping ANS within the
square brackets instructs the code to return
values from the name of the table stored in ANS. - If you are comfortable reviewing object code, you
can print out the object code from your Attribute
code with an NPR Report. Your Detail DPM would
be MIS.SCREEN and your Detail Segment would be
mis.screen.attributes (attributes for C/S
customers).
13DFT Attribute Part VI
- For example, DFTIF_at_p.ADM.PAT.sex"F"
"FE"_"MALE" would translate to the following - DFTIF/AA/aa7"F" "FE"_"MALE
- /aa is the object code equivalent of the NPR
Field _at_t.ADM.PAT.urn. The Meditech CDS Attribute
routine assumes that your code is referring to
whomever the current patient account is, and the
current patient account's urn (unique record
number) would be stored in /aa. - Also, /AA/aa7 is the object code equivalent of
_at_t.ADM.PAT.sex. You can look to the
Offset/Local/VAL column on Meditech's web site
Data Definitions for the object code for each NPR
Field.
14REQI Attribute Part I
- If the result of the REQI Attribute is non-nil,
then the cursor cannot leave the Query until a
response has be entered (and that response must
pass any FCL (Field Check) Attributes) - The REQI Attribute will accept the same code as
is available for the IFE and DFT Attributes. As
programmers, we are under the same constraints as
far as syntax goes as we find with the IFE and
DFT Attributes. - A Query cannot have both the Req Column set to Y
and either an REQ or REQI Attribute.
15REQI Attribute Part II
- Make sure there is NO conflict between your IFE
and REQ or REQI Attributes. As we discussed
earlier, if your IFE Attribute does NOT allow the
end-user to enter a response but your REQI or REQ
Attributes DO require a response, then your
Meditech session will be stuck. Your end-user
will be required to enter a response for a Query
that will not allow them to enter a response. - Example from a NUR CDS REQI_at_p.ADM.PAT.sex"F
- In this example, the end-user will be required to
enter in a value if the permanent value of the
current patient's ADM.PAT.sex Field is "F". The
end-user will not be able to move on from the
Query until a valid response is entered.
16REQ Attribute Part I
- If the result of the REQ Attribute is non-nil,
then the end-user will be required to enter in a
value for this Query before being able to "File"
the current routine (and that response must pass
any FCL (Field Check) Attributes) - The REQ Attribute will accept the same code as is
available for the IFE, DFT, and REQI Attributes.
As programmers, we are under the same constraints
as far as syntax goes as we find with the IFE,
DFT, and REQI Attributes. - A Query cannot have both the Req Column set to Y
and either an REQ or REQI Attribute.
17REQ Attribute Part II
- Make sure there is NO conflict between your IFE
and REQ or REQI Attributes. As we discussed
earlier, if your IFE Attribute does NOT allow the
end-user to enter a response but your REQI or REQ
Attributes DO require a response, then your
Meditech session will be stuck. Your end-user
will be required to enter a response for a Query
that will not allow them to enter a response. - Example from a NUR CDS REQ_at_p.ADM.PAT.sex"F
- In this example, the end-user will be required to
enter in a value if the permanent value of the
current patient's ADM.PAT.sex Field is "F". The
end-user will be able to skip this field but will
NOT be able to "File" the current routine until a
response is entered.
18JFY Attribute
- This Attribute determines the Justification (Left
- L, Right - R, or C - Centered) for the
responses entered. - Rarely used.
19FCL Attribute Part I
- The Field Check Attributes are unique in that you
can enter in multiple Attributes - FCL1(_at_.response"Y")(_at_p.ADM.PAT.attend.doctor"
DRSMITH") - FCL1A_at_W.err("Doctor Smith doesn't perform that
sort of operation.") - FCL2(_at_.response"Y")(_at_p.ADM.PAT.attend.doctor"
DRJONES") - FCL2A_at_W.err("Doctor Smith no longer works
here.") - The FCL Attributes are executed in numeric order,
but only if a new non-nil response has been
entered for the Query. If the DFT value is
accepted (by simply pressing ltEntergt to move on),
then the FCL Attributes are NOT executed. - If the IFE Attribute does not result in a non-nil
value, then the FCL Attributes will NOT be
executed.
20FCL Attribute Part II
- FCL Attributes are used to examine the response
entered and determine if the end-user should be
allowed to proceed with the rest of the CDS.
Pop-up error messages are sometimes used to pass
along information. - In the above example, if the response is "Y" and
the permanent ADM.PAT Attending Doctor is
"DRSMITH", then a pop-up window will appear with
the message "Doctor Smith doesn't perform that
sort of operation." The end-user will not be
allowed to enter in that value. The rest of the
FCL Attributes (in this case, FCL2) will NOT be
executed.
21FCL Attribute Part III
- If, however, the conditions of the FCL1 were not
met, then the FCL1A would not be executed, and
then the FCL2 would be executed. So, if the
response is "Y" and the permanent ADM.PAT
Attending Doctor is "DRJONES", then a pop-up
window will appear with the message "Doctor Smith
no longer works here." The end-user will not be
allowed to enter in that response. - If the conditions of neither the FCL1 or FCL2
Attribute are met, then response from the
end-user passes the Field Checks and the cursor
will move on. - So, the FCL1A is executed if the result of the
FCL1 Attribute is non-nil, and the end-user will
not be allowed to enter in that response.
22FCL Attribute Part IV
- You can add as many FCL Attributes as you like by
simply incrementing the integer 1 by any positive
integer. - You can also use an FCL attribute to evaluate a
response, and display messages but still allow
the end-user to move on to the rest of the CDS.
For instance - FCL1IF_at_.response"Y" _at_W.return("Please prep
the patient.") - Please note that there is no corresponding FCL1A
Attribute. Instead, this FCL1 Attribute will
check to see if the response is "Y". If it is,
then the pop-up window appears with the message.
Otherwise, the pop-up window will not appear and
the end-user simply moves on to the rest of the
CDS.
23Performing a Lookup Part I
- Let's use our IFE Attribute to both Default in a
value (as opposed to using the DFT Attribute). - Let's also jump over into another Application
that is not normally accessible from a CDS. - For example, we will jump from a CDS in ADM to
get a value from PHA. There are a few ways to do
it.
24Performing a Lookup Part II
- 1) Create an NPR Report using the Process Reports
routine. The Report DPM is "MIS.USER". Make
sure to make note of the name your use. In this
example, the name is "zcus.ip.bms.pgms
25Performing a Lookup Part III
- 2) Add any Report Title you like and set the
Active Field to Y and then File and Translate
your Report
26Performing a Lookup Part IV
- 3) Add a macro called pha.drug with the following
code
27Performing a Lookup Part V
- 3) Add a macro called pha.drug with the following
code
28Performing a Lookup Part VI
- The Local Macros SETUP.WINDOW.BUTTONS,
SETUP.WINDOW.HEADER, and SETUP.WINDOW.TRAILER are
all optional. The Buttons are not necessary for
the Lookup to work. Neither are the Header or
Trailer.
29Performing a Lookup Part VII
- Z.link.db is a utility program that connects to a
specific database, in this case, PHA.SCT. The
first time it is executed, it connects to the
database. The second time, it disconnects from
the database.
30Performing a Lookup Part VIII
- Z.id is another utility program that creates the
usual pop-up Lookup window. The Local Macro
SETUP.LOOKUP.DETAILS determines the FILE (or
table) that the Lookup uses, the HEADER that
appears in the Lookup window, the data that is
Displayed, and the TITLE that appears in the
window.
31Performing a Lookup Part IX
- SETUP.WINDOW.HEADER is the Local Macro that
creates a table with the text to appear in the
header of the Lookup window. In this case, the
only line of text is "This lookup provides a
list of Pharmacy Medications. "
32Performing a Lookup Part X
- SETUP.WINDOW.TRAILER is the Local Macro that
creates a table with the text to appear in the
trailer of the Lookup window. In this case, the
only lines of text are - "Please contact Brian Schmit at Interface People
with questions." - " (617) 823-9326 Brian.Schmit_at_ipeople.
com
33Performing a Lookup Part XI
- SETUP.WINDOW.BUTTONS is the Local Macro that
creates a table with information about all of the
Buttons that can appear on the window. In this
case, the first line has a queued string of
values being assigned to the global variable
/ID.BUT. - The first queued value is 10 which is the length
of each button. The rest of the values determine
the text that should appear on each button. An
ampersand appears before the letter to be
underlined and made available via a keyboard
shortcut. For instance, the end-user will be
able to press ltAltgtltUgt and the "Pg Up" button
will be pressed.
34Performing a Lookup Part XII
- The next lines of code assign the ASCII code that
corresponds to each keystroke. For instance,
ASCII code 27 corresponds to the keystroke ltEscgt.
So, ASCII code 27 is assigned to button 5 which
is the "Exit" button.
35Performing a Lookup Part XIII
- 4) File and translate your macro.
- 5) Add the following IFE Attribute to your Query
- In this example, the IFE Attribute executes the
NPR Report Macro called pha.drug attached to the
NPR Report MIS.USER.zcus.ip.bms.pgms. Within
parentheses, you will see ANS,"IP.BMS.3"0.
This is the response to the query "IP.BMS.3".
The value returned is assigned to the local
variable called TEMP.
36Performing a Lookup Part XIV
- The value of TEMP is then assigned to
/ANS0,"IP.BMS.3"0. This is the syntax used
when assigning a response to a Query in the IFE
Attribute. - The P function is a MAGIC Programming function
that positions the cursor at a specific Row and
Col and can optionally display a value. In this
case, it is displaying the value of TEMP at Row
ZR and Column ZC. The Format operator, ,
formats TEMP to appear with a length of 10 and to
be both Truncated (T) and Left-Justified (L). - The final value of the IFE is "" so the end-user
will not be able to edit the Query anymore.
However, the IFE Attribute also runs the Lookup.
So each time the end-user access the Query, the
Lookup will appear.
37Performing a Lookup Part XV
- This is the pop-up Lookup screen that will appear
as soon as the cursor moves to the Query
38Performing a Lookup Part XVI
- Now this value, taken from the Meditech PHA Drug
Dictionary will be recorded as the response to
the Query, even though the Query is on a ADM CDS
39Performing a Lookup Part XVII
- The only differences between the C/S version and
the MAGIC version is the code in the pha.drug
macro
40An Interactive Lookup Part I
- Lets again use our IFE Attribute to get data
from another Application that we would not
normally have access to. - For example, we will jump from a CDS in ADM to
get a value from MM. - We will also make our Lookup interactive.
- First, lets review how to do it in C/S, and then
MAGIC (the syntax will be different).
41An Interactive Lookup Part II
- 1) Create an NPR Report using the Process Reports
routine. The Report DPM is "MIS.USER". Make
sure to make note of the name your use. In this
example, the name is "zcus.ip.bms.pgms
42An Interactive Lookup Part III
- 2) Add any Report Title you like and set the
Active Field to Y and then File and Translate
your Report
43An Interactive Lookup Part IV
- 3) Add a macro called mm.stock with the following
code
44An Interactive Lookup Part V
- 4) File and translate your macro.
- 5) Add the following IFE Attribute to your Query
- In this example, the IFE Attribute executes the
NPR Report Macro called mm.stock attached to the
NPR Report MIS.USER.zcus.ip.bms.pgms. Within
parentheses, you will see ANS,"IP.BMS.4"0.
This is the response to the query "IP.BMS.4".
The value returned is assigned to the local
variable called TEMP.
45An Interactive Lookup Part VI
- The value of TEMP is then assigned to
/ANS0,"IP.BMS.4"0. This is the syntax used
when assigning a response to a Query in the IFE
Attribute. - The P function is a MAGIC Programming function
that positions the cursor at a specific Row and
Col and can optionally display a value. In this
case, it is displaying the value of TEMP at Row
ZR and Column ZC. The Format operator, ,
formats TEMP to appear with a length of 10 and to
be both Truncated (T) and Left-Justified (L). - The final value of the IFE is "" so the end-user
will not be able to edit the Query anymore.
However, the IFE Attribute also runs the Lookup.
So each time the end-user access the Query, the
Lookup will appear.
46An Interactive Lookup Part VII
- This is the pop-up Lookup screen that will appear
as soon as the cursor moves to the Query - You can then enter in a string for a Lookup as if
you were using the regular MM Item routine, such
as S\ to Lookup by Inventory
47An Interactive Lookup Part VIII
- You can then select a specific Inventory from the
Lookup
48An Interactive Lookup Part IX
- You can then select a specific Item from the
chosen Inventory
49An Interactive Lookup Part X
- The MM Item will be recorded as the response
for the Query
50An Interactive Lookup Part XI
- This is the code for the MAGIC version of the
macro
51How to Know What Lookup Program to Use Part I
- For C/S Customers, you can run the NPR Report
NPR.PROC.zcus.ip.bms.view.utilities.
52How to Know What Lookup Program to Use Part II
- You can then type S\ followed by a DPM, such as
MM.ITEM, and then press ltF9gt for a Lookup of the
available NPR Segments - The top-most Segment to choose is often main
53How to Know What Lookup Program to Use Part III
- An Information screen will appear with all of the
Fields
- An Asterisk in the A column indicates there are
Attributes attached to a Field.
54How to Know What Lookup Program to Use Part IV
- The ID Attribute here has the code for the Lookup
55How to Know What Lookup Program to Use Part V
- MAGIC Clients, use NPR.PROC.zcus.ip.bms.view.utili
ties
56How to Know What Lookup Program to Use Part VI
- Select the DPM Option
- Enter a DPM
57How to Know What Lookup Program to Use Part VII
- Select an NPR Segment from the list, such as
main
58How to Know What Lookup Program to Use Part VIII
- An Asterisk in the A column indicates there are
Attributes
59How to Know What Lookup Program to Use Part IX
- The ID Attribute has the code for the Lookup
60Information on NPR Programming Macros Part I
- For C/S Customers, you can run the NPR Report
NPR.PROC.zcus.ip.bms.view.utilities.
61Information on NPR Programming Macros Part II
- You can then type M\ and then press ltF9gt for a
Lookup of the available NPR Programming Macros
62Information on NPR Programming Macros Part III
- Any information Meditech has recorded about the
chosen NPR Programming Macro will appear
63Running an NPR Report from a CDS Part I
- You can run an NPR Report from a CDS Attribute.
Often this is done using the FCL Attribute - CS
- MAGIC
64Running an NPR Report from a CDS Part II
- The usual Print On prompt will appear and then
your NPR Report will print
65Running an NPR Report from a CDS Part III
- The NPR Report output is created like it would be
if you ran it from a regular NPR Menu
66Running an NPR Report from another Application
from a CDS Part I
- Again, this is done using the FCL Attribute
- CS
- MAGIC
67Running an NPR Report from another Application
from a CDS Part II
- The usual Print On prompt will appear and then
your NPR Report will print
68Running an NPR Report from another Application
from a CDS Part III
- The NPR Report output is created like it would be
if you ran it from a regular NPR Menu
69C/S Shortcut for Finding CDS and Query Mnemonics
Part I
- Run the Report NPR.PROC.zcus.ip.bms.set.debug.menu
70C/S Shortcut for Finding CDS and Query Mnemonics
Part II
- The Report does not actually produce any results
but it does modify your Meditech session so that
a new option called Spy appears when you press
ltAltltSpacebargt. - Move to a CDS (this example is in ADM) and press
ltAltgtltSpacebargt when your cursor is on a Query,
and then select the Spy option
71C/S Shortcut for Finding CDS and Query Mnemonics
Part III
- A popup window will appear. Scroll down until
you see a value for ggv (the Query) and gxx (the
CDS)
72Thanks for joining us today!Questions?
Comments?
Interface People, LP
214.222.1125 (Dallas area)866.539.2188
(toll free)
Brian Schmit brian.schmit_at_ipeople.com
To Download a copy of this presentation go to
www.ipeople.com/muse