RE: [InterSystems-EnsHlth] Ens.Rule.FunctionSet

42 views
Skip to first unread message

David Blake

unread,
Jun 27, 2017, 9:52:14 AM6/27/17
to Ensemble-in...@googlegroups.com

Hi Priya

 

Is the table going to change much? If it isn’t then you would be better to populate an Ensemble lookup table from the SQL table. Or is this what you mean?

 

Assuming you can use an Ensemble lookup then the condition should take place in a routing process and would look something like this…

 

 

If the table is frequently changing then you may be better with a custom function if maintenance of a lookup table would be too much. Let me know if you need one of these.

 

Regards

 

Dave

 


David Blake
Technical Specialist - Integration | InterSystems 
Direct: +44 01753 855450 | Mobile: +44 7852 265557
InterSystems.com

cid:image001.png@01D1E68F.C902F0E0

 

 

From: ensemble-in...@googlegroups.com [mailto:ensemble-in...@googlegroups.com] On Behalf Of Priya
Sent: Tuesday, June 27, 2017 1:04 PM
To: InterSystems: Ensemble in Healthcare <Ensemble-in...@googlegroups.com>
Subject: [InterSystems-EnsHlth] Ens.Rule.FunctionSet

 

Can someone help me to write a custom function for SQL table lookup ? I want to filter hl7 messages based on a certain field and if that value is not found in table to drop the message.

 

thank you,

Priya

 

 

--
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/d/optout.

Priya

unread,
Jun 28, 2017, 3:40:54 AM6/28/17
to InterSystems: Ensemble in Healthcare
Hi Dave,
Thank you for the reply. Yes, the SQL table update frequently.  We store all message in one table , I would like check patient type in the previous message for that visit of the patient if it is "I"
 (inpatient) send it to Business operation.

I have written the below code, it is giving errors

Class Test.MsgRouter.CustomFunctions Extends Ens.Rule.FunctionSet
{
 ClassMethod CheckPatientType(ptMRN As %String, ptVisitNumber As %String) As %Boolean
{
 set query = "Select PatientType from dbo.table where MRN = " _ptMRN_ " 
and VisitNumber = "_ptVisitNumber_"order by VisitId desc" 
 
 if tResult.Next(){
 
Set PatientType = tResult.PatientType
 
 Q ((PatientType = "I"))
}
}


Regards
Swathi




On Tuesday, June 27, 2017 at 2:52:14 PM UTC+1, ISC Dave wrote:

Hi Priya

 

Is the table going to change much? If it isn’t then you would be better to populate an Ensemble lookup table from the SQL table. Or is this what you mean?

 

Assuming you can use an Ensemble lookup then the condition should take place in a routing process and would look something like this…

 

 

If the table is frequently changing then you may be better with a custom function if maintenance of a lookup table would be too much. Let me know if you need one of these.

 

Regards

 

Dave

 


David Blake
Technical Specialist - Integration | InterSystems 
Direct: +44 01753 855450 | Mobile: +44 7852 265557
InterSystems.com

cid:image001.png@01D1E68F.C902F0E0

 

 

From: ensemble-in...@googlegroups.com [mailto:ensemble-in-healt...@googlegroups.com] On Behalf Of Priya
Sent: Tuesday, June 27, 2017 1:04 PM
To: InterSystems: Ensemble in Healthcare <Ensemble-in...@googlegroups.com>
Subject: [InterSystems-EnsHlth] Ens.Rule.FunctionSet

 

Can someone help me to write a custom function for SQL table lookup ? I want to filter hl7 messages based on a certain field and if that value is not found in table to drop the message.

 

thank you,

Priya

 

 

--
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-i...@googlegroups.com
To unsubscribe from this group, send email to Ensemble-in-Healthcare-unsub...@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-Healthcare+unsub...@googlegroups.com.

David Blake

unread,
Jun 28, 2017, 5:09:32 AM6/28/17
to Ensemble-in...@googlegroups.com

Hi again Priya

 

There are a number of issues here, I think.

 

First of all, this type of code requires that it is in a service or operation that uses one of our SQL adaptors. Normally, it would use the adaptors execute statement to perform the SQL and retrieve the results.

 

This is not your case here, so you will need to embed the SQL. This itself requires that the code is ran in the same namespace as the table is stored.

 

Assuming that is the case you can use something like this…

 

Class Test.MsgRouter.CustomFunctions Extends Ens.Rule.FunctionSet

{

 ClassMethod CheckPatientType(ptMRN As %String, ptVisitNumber As %String) As %Boolean

{

 &SQL (Select Count(*) into :tPTCount from dbo.table where MRN = :ptMRN and VisitNumber = :ptVisitNumber and PatientType=’I’) 

  

 Q ((tPTCount>0))

}

}

 

Please try this and let me know if you need anything further

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/d/optout.

--

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.

Priya

unread,
Jun 28, 2017, 7:32:27 AM6/28/17
to InterSystems: Ensemble in Healthcare
Hi Dave,
thank you for the help , it is working as expected now.

regards
Priya


On Tuesday, June 27, 2017 at 2:52:14 PM UTC+1, ISC Dave wrote:

Hi Priya

 

Is the table going to change much? If it isn’t then you would be better to populate an Ensemble lookup table from the SQL table. Or is this what you mean?

 

Assuming you can use an Ensemble lookup then the condition should take place in a routing process and would look something like this…

 

 

If the table is frequently changing then you may be better with a custom function if maintenance of a lookup table would be too much. Let me know if you need one of these.

 

Regards

 

Dave

 


David Blake
Technical Specialist - Integration | InterSystems 
Direct: +44 01753 855450 | Mobile: +44 7852 265557
InterSystems.com

cid:image001.png@01D1E68F.C902F0E0

 

 

From: ensemble-in...@googlegroups.com [mailto:ensemble-in-healt...@googlegroups.com] On Behalf Of Priya
Sent: Tuesday, June 27, 2017 1:04 PM
To: InterSystems: Ensemble in Healthcare <Ensemble-in...@googlegroups.com>
Subject: [InterSystems-EnsHlth] Ens.Rule.FunctionSet

 

Can someone help me to write a custom function for SQL table lookup ? I want to filter hl7 messages based on a certain field and if that value is not found in table to drop the message.

 

thank you,

Priya

 

 

--
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-i...@googlegroups.com
To unsubscribe from this group, send email to Ensemble-in-Healthcare-unsub...@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-Healthcare+unsub...@googlegroups.com.

Reply all
Reply to author
Forward
0 new messages