Need help with sample CPRS Alert data

178 views
Skip to first unread message

Kevin Toppenberg

unread,
Dec 16, 2016, 8:34:29 PM12/16/16
to Hardhats
I have completed the first phase of my HL7 radiology interface, to process HL7 messages containing results.  I have stored my reports in standard VistA locations, so viewing the reports is standard in CPRS.  

I would like to now generate an alert so that the user will know to go and look at the report, which could possibly let us go paperless.

In CPRS, I have traced through the alert processing, and I have a general idea how the system works.  But the data strings can be somewhat critic.  In the CPRS code, here is one sample string given "OR,66,50;1416;3021231.121024"  And below is another example, with highlighted data string for an unsigned note.  


ORWORB FASTUSER
Called at: 8:23:22 PM
 
Params ------------------------------------------------------------------
 
Results -----------------------------------------------------------------
^ZZTEST,BA (Z0103P)^^Moderate^12/16/2016@20:23^UNSIGNED ACUTE MEDICAL ISSUE VISIT available for SIGNATURE.^^TIU441927;168;3161216.202319^^
 
Elapsed Time: 204 ms

But since I don't have access to a working VistA system, I am not exactly sure of the format for when there is new imaging reports available for viewing.  

I am wanting sample alerts for:
  1. When there are new laboratory results for viewing (I want to add this for my lab interface at the same time)
  2. When there are new radiology report results ready for review.
Can someone send me sample data (with any patient names XXXX'd out)?

To do this, one must have certain keys so that under the CPRS->Help menu, the LAST BROKER CALL menu option is available.  Select File->Select New Patient.  This will display the selector box which also shows Alerts.  Close that window without selecting anything, and then look in the LAST BROKER CALL area.  Look for the RPC named ORWORB FASTUSER.  Copy all the information, and reply here, being careful to remove anything that would identify a patient or reveal anything private.  

I would greatly appreciate it.

Thanks
Kevin


Kevin Toppenberg

unread,
Dec 16, 2016, 8:50:46 PM12/16/16
to Hardhats
This is a document I am using to document what I learn about this, as I go forward:


Kevin

Steven McPhelan

unread,
Dec 16, 2016, 11:39:00 PM12/16/16
to hardhats
I am not sure what you are asking.  Do you want to know how to generate an alert (a.k.a notification)?  A properly created alert will show up in CPRS.

What I do not know is does VA VistA CPRS currently allow for an action alert from radiology.  Your list shows some imaging handlers.  In the list you displayed I do not see a Radiology report but #22 is Imaging Reports on the CT_REPORTS tab.  VistA Imaging is more than just radiology.  I presume this could display a radiology report.  However, since it is called IMAGING I wonder if this action is designed to launch the VistA Imaging viewer.

I found this in the Radiology code.  How and when it is invoked I do not know.

STAT^RAUTL0
STAT     ;TASKMAN ENTRY POINT TO UPDATE STATUS OF ONE REPORT
         N RASAVE ; array to save off RADFN, RADTI & RACNI
         S RAF1=1,Y=RARPT D RASET^RAUTL2,UP1^RAUTL1,STUFF^RARTST
         S RASAVE("RADFN")=RADFN,RASAVE("RADTI")=RADTI,RASAVE("RACNI")=RACNI
         S:$$ORVR^RAORDU()=2.5 ORVP=RADFN_";DPT(",ORBXDATA=RARPT
         S RAEXFLD="ALL",D0=RARPT
         D ^RARTFLDS,OENOTE^RAUTL00 ; OENOTE replaces STAT1
         I $D(ZTQUEUED) S ZTREQ="@"
         Q
         ;

^RAUTL00
Entire routine devoted to managing RA notifications.  Since you are outpatient, presumably all your reports would be verified, final reports.  But it is still possible that you may get an amended report from the radiologist.

I looked for 22 in all RA* routines.  I could have missed it, but these seem to be the only one involved in notifications.  I did not trace all these down to see what they are doing:

F1502>D ^%RFIND
Find routine lines that contain at least one of a set of strings
 1. Search For:  ^RAUTL0
 2. Search For: 
Exact Upper/Lowercase Match? Yes => Yes
Show all searched routines? Yes => No
Routine(s): RA*
Routine(s):

Display results on
Device:
Right margin: 80 =>

RABTCH1.INT
Q1          I '$D(RAUP),$D(^TMP($J,"RA","DT")) D UPSTATM^RAUTL0
RAHLO1.INT
UPACT+15    I $D(RAMDV),RAMDV'="" D:RARPTSTS="V" UPSTAT^RAUTL0 D:RARPTSTS'="V" U
            P1^RAUTL1
RAHLTCPB.INT
EN1+2       ; of patch 71, RAHLTCPB is referenced in RAHLTCPB, UPSTAT^RAUTL0, &
            UP2^RAUTL1 Generic provider: RADIOLOGY,OUTSIDE SERVICE
RART.INT
TIME+1      .N RAHLTCPB S RAHLTCPB=1 D UPSTAT^RAUTL0 K RAAB
RARTE4.INT
PRT+7       .N RAHLTCPB S RAHLTCPB=1 D:$S('$D(RACT):0,RACT="V":1,1:0) UPSTAT^RAU
            TL0
RARTE7.INT
ALERT+4     ; set RASAVE() for OENOTE^RAUTL00
ALERT+25    .D OENOTE^RAUTL00
RARTVER.INT
ASK+14      .N RAHLTCPB S RAHLTCPB=1 D:RACT="V" UPSTAT^RAUTL0 D:RACT'="V" UP1^RA
            UTL1
RASTED.INT
ASK+56      D ^RAORDC I +$P(RANEXT,"^",3)>1,RACS'="Y",$S($P(RACN0,"^",6)']"":1,$
            P(^DIC(42,+$P(RACN0,"^",6),0),U,3)="D":1,1:0) D EN^RAUTL0
RAUTL0.INT
UPSTAT+4    S ZTRTN="STAT^RAUTL0",ZTIO=$S(RAIO>0:$$GET1^DIQ(3.5,RAIO_",",.01),1:
            "")
STAT+6      D ^RARTFLDS,OENOTE^RAUTL00 ; OENOTE replaces STAT1
UPSTATM+2   S ZTRTN="STATM^RAUTL0",ZTIO=$S(RAIO>0:$$GET1^DIQ(3.5,RAIO_",",.01),1
            :"")
STATM1+6    D OENOTE^RAUTL00 K RAAB,ORIFN,ORNOTE
RAUTL1.INT
UP2K+2      I $D(^RA(72,RASTI,0)),$P(^(0),"^",3)>1,RACS'="Y",$S('$D(RAF5):1,$P(^
            DIC(42,+RAF5,0),U,3)="D":1,1:0) D EN^RAUTL0


So it does seem that if you set the alert up properly it should work they way you wish without modifying CPRS.  However, from someone with more experience with Radiology speaks up, I would still like to know if VA VistA Radiology will execute an action alert and send to user to the Reports tab to review the radiology report.  I cannot immediately see that from the code above.

Also notice, that ^RAUTL00 ends up calling EN^ORB3 which will actually create the alert.

I assume you know how to set up a proper alert to begin with.  You would do that in the HL7 process that receives the report that you filed.

Now you mentioned you want to action lab results also.  Well, that process is different.  Notice that there is a CT_LAB handler versus CT_REPORTS.  There is not a "standard" string format for CPRS alerts.  The above code should

DISCLAIMER:
SETUP*XQALERT is a supported API for any application to create an alert, not just a CPRS alert.  A CPRS notification is just a type of alert.
I do not know if any of the ^OR API calls made in the RA* routines is supported.
EN^ORB3 is a controlled subscription IA (#1362).  Of note, is this comment in the IA:
UBSCRIBING PACKAGE: RADIOLOGY/NUCLEAR MEDICINE
  ISC: Hines
 SUBSCRIBING DETAILS:   This DBIA documents a Radiology/Nuclear Medicine call to OE/RR v.3 notification processing routine that handles notifications that must be generated for Radiology/Nuclear Medicine outside of HL7 messages processed through protocols.  This DBIA will take effect when OE/RR v.3 is released. 

Notice that Radiology can call EN^ORB3 when necessary OUTSIDE of HL7 message processed through protocols.  I am not sure what that means.  To that end I searched for all references to ^ORB3 in RA*

RAO7PC4.INT
SETNOTIF+10 D EN^ORB3(67,+RASTRING,RAIEN751,.RAREQPHY,RAMSG,RASTRING)

RAUTL00.INT
OE3+17      D EN^ORB3(+$G(RANOTE),RADFN,RAOIFN,.RAREQPHY,RAMSG,RAIENS)

RAUTL1.INT
RAUTL1+8    ;DIC(10006); DIE(10018); FILE^DIE(2053); UPDATE^DIE(2053); EN^ORB3(1362); NOTE^ORX3(868)
OERR3+25    D EN^ORB3(21,RADFN,RAOIFN,.RAREQPHY,RAMSG,RAIENS)

RAUTL19.INT
OENO+12     D EN^ORB3(RANOTY,RADFN,X,.RADUZ,RAMSG)

This should get you started in the right direction.  A similar analysis would need to be done for how laboratory sets up their CPRS alerts.

Steve
But a Constitution of Government once changed from Freedom, can never be restored. Liberty, once lost, is lost forever. - John Adams

Kevin Toppenberg

unread,
Dec 20, 2016, 6:10:40 PM12/20/16
to Hardhats
Steven,

You put considerable effort into this post, and I appreciate that!  See comments below


On Friday, December 16, 2016 at 11:39:00 PM UTC-5, Steven McPhelan wrote:
I am not sure what you are asking.  Do you want to know how to generate an alert (a.k.a notification)?  A properly created alert will show up in CPRS.

I know how to make an alert.  I am trying to create the correct kind of alert so that CPRS will show the user that a new radiology report is available, and clicking on it will take them to the report.  Vanilla CPRS supports this.  What I was hoping was to snoop on the RPC results of a sample call that brought back data from a working system, and to use that in my system to explore the functionality of CPRS.  However, lacking that, I was able to spoof up some messages and watch how they are handled.  Unfortunately, CPRS does a call back to the alert to get the XQADATA string from the original alert.  So my original request would not have given me sufficient information.

 
What I do not know is does VA VistA CPRS currently allow for an action alert from radiology.  Your list shows some imaging handlers.  In the list you displayed I do not see a Radiology report but #22 is Imaging Reports on the CT_REPORTS tab.  VistA Imaging is more than just radiology.  I presume this could display a radiology report.  However, since it is called IMAGING I wonder if this action is designed to launch the VistA Imaging viewer.

I didn't see anything in CPRS about the VistA Imaging part.  I seem to recall that CPRS would broad cast messages via Windows.  And other programs that are listening (e.g. VistA Imaging) can use the information about which patient is selected in keep both applications in sync.  


I found this in the Radiology code.  How and when it is invoked I do not know.

STAT^RAUTL0
STAT     ;TASKMAN ENTRY POINT TO UPDATE STATUS OF ONE REPORT
         N RASAVE ; array to save off RADFN, RADTI & RACNI
         S RAF1=1,Y=RARPT D RASET^RAUTL2,UP1^RAUTL1,STUFF^RARTST
         S RASAVE("RADFN")=RADFN,RASAVE("RADTI")=RADTI,RASAVE("RACNI")=RACNI
         S:$$ORVR^RAORDU()=2.5 ORVP=RADFN_";DPT(",ORBXDATA=RARPT
         S RAEXFLD="ALL",D0=RARPT
         D ^RARTFLDS,OENOTE^RAUTL00 ; OENOTE replaces STAT1
         I $D(ZTQUEUED) S ZTREQ="@"
         Q
         ;

^RAUTL00
Entire routine devoted to managing RA notifications.  Since you are outpatient, presumably all your reports would be verified, final reports.  But it is still possible that you may get an amended report from the radiologist.


So that brings me to the code that you pointed out.  I think UPSTAT^RAUTL0 is indeed the correct "API" entry point.  I looked in the Radiology / Nuc Med technical manual  (http://www.va.gov/vdl/documents/Clinical/Radiology_Nuclear_Med/ra6_0tm_rev_v5.pdf) and found, on page 21, the definition of some of the apparent input variables:
RADFN -- patient DFN
RADTI --  inverse DT of exam
RADCNI -- Internal entry number for an exam; ^RADPT(RADFN,"DT",RADTI,"P",RACNI,0)

The tech manual also mention RAIMGTY, RAMLC, RAMDV, and RAMDIV and RACCESS as package-wide variables that are setup during login (to the radiology system).  ^RAPSET will set these, but it appears the code is designed for roll-and-scroll interactivity.  So I am going to have to pick through the code and see if there is setup I can do in advance etc.  I don't know if these variables are even needed for UPSTAT^RAUTL0...

 -snip- 

So it does seem that if you set the alert up properly it should work they way you wish without modifying CPRS.  However, from someone with more experience with Radiology speaks up, I would still like to know if VA VistA Radiology will execute an action alert and send to user to the Reports tab to review the radiology report.  I cannot immediately see that from the code above.

Having traced through CPRS I can answer that it will take the user to the report.
 

Also notice, that ^RAUTL00 ends up calling EN^ORB3 which will actually create the alert.

I assume you know how to set up a proper alert to begin with.  You would do that in the HL7 process that receives the report that you filed.

Yes, the plan would be to include this in my HL7 filer. 
 
Now you mentioned you want to action lab results also.  Well, that process is different.  Notice that there is a CT_LAB handler versus CT_REPORTS.  There is not a "standard" string format for CPRS alerts.  The above code should 

Well, I better do one thing at a time.  My first goal will be for radiology report alerts. But if I can figure out how the system works along the way, hopefully it will be easier to later implement this for labs.  

 ...

Notice that Radiology can call EN^ORB3 when necessary OUTSIDE of HL7 message processed through protocols.  I am not sure what that means.  To that end I searched for all references to ^ORB3 in RA*

It is difficulty to know how "upstream" to go.  I.e. whether to call the upstream UPSTAT^RAUTL0 or the downstream ^ORB3.  I will need to step through the code in a debugger.  

...
This should get you started in the right direction.  A similar analysis would need to be done for how laboratory sets up their CPRS alerts.

Steve

Steve, you have been very helpful.  Thanks!

Kevin
 

Steven McPhelan

unread,
Dec 20, 2016, 8:00:02 PM12/20/16
to hardhats
As you originally mentioned, have an example of a Radiology report action alert would be helpful.  If you have a minimally working Radiology package can you manually enter a Rad report and verify it.  That should trigger the alert.  DO NOT PROCESS the alert.  First go to the Fileman file and print off that alert file record.  Processing the alert may result in the alert being deleted.  Then process the alert in CPRS to make sure it transfers you to the reports tab with the rad report open.

As you noticed, just reading the M code does not give a Rad novice a complete picture as it is hard to visualize how things will look and work in CPRS.  I am very confident if the alert is setup properly AND you populated all necessary files/fields in the Radiology package then when your HL7 process files the report the alert will do what you want it to.  It sure does help to actually see all the screens before tracing through the M code.

I had planned to do this at one time to take an external radiology report and file it so that it appears just as if it had been entered through the Rad package properly.  But this required that the DAY ONE radiology setup had been done properly and all the appropriate files are configured accordingly.  Like LAB, the final report will not be viewable outside of the Radiology package until the report is properly verified by a "radiologist".  I never had the time or opportunity to do this.  I wanted to document the minimal Radiology setup necessary so that external reports could be viewed in CPRS.  Again, no time or opportunity.

Another avenue would be to examine the MAG (VistA Imaging) HL7 and/or RPCs.  VistA Imaging accepts the final report from the external PACS system and then relays that information onto the RA package.  I am pretty sure (not 100%) that no further action is necessary in the RA package to make the report viewable in CPRS.  That is, your HL7 process could emulate what the MAG process does.  This would be a two-step process as MAG already has a RA order number to link to.  If you cannot determine the RA order number then you would have to create one.  But in your processes if everyone is using CPRS to place orders then there should be no reason to create an order on the fly.  Placing the order should have created all the necessary minimal data in the Radiology package.  Creating the order would be that first step I talked about.  Then the second step would be emulating what VistA Imaging does to file the final RA report.  I think this approach might end up being the easier of the two as MAG has already worked out all those nitty details.  I do not know if this is allowable outside of the VA but there is a catch.  The patient goes to the radiologist and the radiologist decides that the provider ordered the wrong procedure or may decide that additional procedures are necessary.  Now you have reports for which there is no corresponding RA orders.

Kevin Toppenberg

unread,
Dec 23, 2016, 4:32:59 PM12/23/16
to Hardhats
Thanks Steven,

I'll try to post back what I figure out.

Merry Christmas.

Kevin

Kevin Toppenberg

unread,
Dec 28, 2016, 6:38:14 PM12/28/16
to Hardhats
It looks like EN^ORB3 is the key API.   With the sample code I was able to send an alert about radiology report, and clicking on the report took me to the proper in area in CPRS to view the report.  Hurrah!

Thanks Steven and Sam... 

Kevin

TEST3  ;"TEST SENDING ALERT FOR A GIVEN STUDY
  ;"Sample data
  ;" 90) ^RADPT(69928,0) = 69928^^^O^^168
  ;" 91) ^RADPT(69928,"DT",0) = ^70.02DA^6838787.8993^2
  ;" 92) ^RADPT(69928,"DT",6838787.8955,0) = 3161212.1044^1^71^4
  ;" 93) ^RADPT(69928,"DT",6838787.8955,"P",0) = ^70.03IA^1^1
  ;" 94) ^RADPT(69928,"DT",6838787.8955,"P",1,0) = 15^536^2^S^^^^^^^^^^83^241^^5
  ;" 95) ^RADPT(69928,"DT",6838787.8955,"P","B",15,1) =
  ;" 96) ^RADPT(69928,"DT",6838787.8993,0) = 3161212.1006^1^71^4
  ;" 97) ^RADPT(69928,"DT",6838787.8993,"P",0) = ^70.03IA^1^1
  ;" 98) ^RADPT(69928,"DT",6838787.8993,"P",1,0) = 16^537^2^S^^^^^^^^^^168^241^^6
  ;" 99) ^RADPT(69928,"DT",6838787.8993,"P","B",16,1) =
  ;"100) ^RADPT(69928,"DT","AP",536,6838787.8955,1) =
  ;"101) ^RADPT(69928,"DT","AP",537,6838787.8993,1) =
  ;"102) ^RADPT(69928,"DT","B",3161212.1006,6838787.8993) =
  ;"103) ^RADPT(69928,"DT","B",3161212.1044,6838787.8955) =  
  ;"
  ;"FILE 74 DATA                                 
  ;"1) ^RARPT(6,0) = 121216-16^69928^3161212.1006^16^EF^3161214.142151^3161212.10
  ;"               = 06^3161212.100601
  ;"2) ^RARPT(6,"R",0) = ^^23^23^3161214
  ;"3) ^RARPT(6,"R",1,0) =  HISTORY
  ;"4) ^RARPT(6,"R",2,0) =  Screening mammography with tomosynthesis.
  ;"5) ^RARPT(6,"R",3,0) =  COMPARISON
  ;"...                                                                 
  ;"Internal entry number for an exam; ^RADPT(RADFN,"DT",RADTI,"P",RACNI,0)
  NEW RADFN SET RADFN=69928
  NEW RADTI SET RADTI=6838787.8955
  NEW RACNI SET RACNI=1
  DO SENDALRT(RADFN,RADTI,RACNI)
  QUIT
  ;
SENDALRT(RADFN,IDT,IEN70D03)  ;" Fire off OE/RR notifications, version 3.0+
  ;" Input: RADFN: Patient DFN (IEN IN RAD/NUC MED PATIENT)
  ;"        IDT:   Exam timestamp (inverse)  (IEN IN REGISTERED EXAMS 70.02)   
  ;"        IEN70D03: Exam IEN70.03 (EXMINATION SUBFILE)
  NEW ZN SET ZN=$GET(^RADPT(RADFN,"DT",IDT,"P",IEN70D03,0))
  NEW RARPT SET RARPT=+$PIECE(ZN,"^",17)  ;"This is an IEN74 <-- REQUIRED in OE3^RAUTL00
  DO OE3^RAUTL00(RADFN,IDT,IEN70D03,ZN)
  QUIT
  ; 

Kevin Toppenberg

unread,
Dec 28, 2016, 6:41:50 PM12/28/16
to Hardhats
Oops, I wasn't quite clear.  Yes EN^ORB3 is the API that sends the alert, but OE3^RAUTL00() is a useful wrapper that does some setup for radiology reports before calling EN^ORB3.

Also, I put a bit more information about EN^ORB3 at the end of this document I am working on:

Kevin
Reply all
Reply to author
Forward
0 new messages