Rule issue with HL7

76 views
Skip to first unread message

Marc Lang

unread,
Feb 14, 2013, 11:04:54 AM2/14/13
to InterSystems: Ensemble in Healthcare
Hi,

I want to write a function that can be called by the Business Rules ending (an HL7 Message Router)

I want to pass in a PID segment of an HL7 message, and based on the various patient IDs therein, return a value.

So my function looks like this:

Class IMD.Functions Extends Ens.Rule.FunctionSet
{

/// Checks if a patient exists in the IMD table
ClassMethod IsIMDPatient(pid As EnsLib.HL7.Segment) As %Boolean [ Final ]
{

$$$LOGINFO("In IsIMDPatient")

if (pid="")
{
$$$LOGERROR("Pid is empty")
}
else
{
$$$LOGINFO("Pid is NOT empty!")
}

$$$LOGINFO("Pid separators are "_pid.Separators)

set chi = ""
set crn = ""

set chi = pid.GetValueAt("3(1).1", pid.Separators, .status)

}


}


And my business routing rule (engine class EnsLib.HL7.MsgRouter.RoutingEngine) has the following condition:

IsIMDPatient(HL7.{PIDgrpgrp(1).PIDgrp.PID})

So I am trying to pass in the first PID.

The HL7 being supplied is fine.
If I change the rule to be :

HL7.{PIDgrpgrp(1).PIDgrp.PID:PatientIdentifierList(1).ID} = "whatever"

The rule executes.

When I try to use my function however, I get 
ERROR <Ens>ErrBPTerminated: Terminating BP ResultRouter #514 due to error: ERROR #5002: Cache error: <INVALID OREF>zIsIMDPatient+10^IMD.Functions.3

Whenever it tried to access any property of the PID, such as pid.Separators

is there an issue with passing a segment into a function - is that not a valid thing to do?


Amir Samary

unread,
Feb 14, 2013, 12:49:44 PM2/14/13
to Ensemble-in...@googlegroups.com
Hi Marc!

I can see a couple of issues on your code:

1- Your method is not returning a value. You have it there on the variable chi but you are not returning it. Add a Quit chi at the end of your method.

2- The way you are referencing the PID segment may be wrong. Depending on the document type, the path to the PID segment may vary. On an ADT_A28 message, for instance, the path would be only "PID". On a SIU message on the other hand, the path would be something like PIDgrp(1).PID. You are using a path that is "PIDgrpgrp(1).PIDgrp.PID". I bet that that should be something like "PIDgrp(1).PID".

Try opening the hl7 message on the terminal, and try to get the segment there with the path you are using and the path I am suggesting. This will at least assure you you are actually extracting the segment correctly from the HL7 message before passing it to your method.

Kind regards,
Amir Samary

--
You received this message because you are subscribed to the Google Groups "InterSystems: Ensemble in Healthcare Community" group.
To post to this group, send email to Ensemble-in...@googlegroups.com
To unsubscribe from this group, send email to Ensemble-in-Healt...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/Ensemble-in-Healthcare?hl=en
---
You received this message because you are subscribed to the Google Groups "InterSystems: Ensemble in Healthcare" group.
To unsubscribe from this group and stop receiving emails from it, send an email to Ensemble-in-Healt...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Marc Lang

unread,
Feb 15, 2013, 3:32:14 AM2/15/13
to InterSystems: Ensemble in Healthcare
Hi Amir, yeah sorry, I should have said I snipped the rest of the function. In practice it does return a value. I only included the start few lines, as that's where it's falling over.

The path to the PID is ok, as the rule HL7.{PIDgrpgrp(1).PIDgrp.PID:PatientIdentifierList(1).ID} works, but seemingly HL7.{PIDgrpgrp(1).PIDgrp.PID} doesn't.
Reply all
Reply to author
Forward
0 new messages