web stats
HOw to implement Dispatch Pattern based on incoming Message contents (X12 source)? - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 01-15-2014, 08:29 PM
dzilberman dzilberman is offline
OBX.2 Kenobi
 
Join Date: Sep 2013
Location: San Francisco, CA
Posts: 71
dzilberman is on a distinguished road
Question HOw to implement Dispatch Pattern based on incoming Message contents (X12 source)?

Hello fellow MirthConnected folks,

I am still new to the platform and the whole Medical Message based integration field and working on a new project that requires both and have the following questions, please:

Basically, I need to verify Insurance eligibility using different "backend" API providers depending on payer data (DELTA, CIGNA etc). ONe API is SOAP 1.1 based and basically accepts X12 EDI text wrapped in SOAP envelope, the other - RESTFul WS API that accepts HTTP requests with query strings

QUESTION 1:

We need to come up with implementation of "Dispatcher pattern" in Mirth that would direct Insurance Eigibility verification requests to various APIs - RESTful for some payers and SOAP for others, based on payer code passed in X12 payload, like shown below for SOAP request sample:

<Process837 xmlns="https://www.realtimeclaims.com/">
<Input837>ISA*00* *00* *30*521301729 *20*0135WCH00 *100126*1731*U*00401*000000001*1*T*:~GS*HC*5213017 29*0135WCH00*20100126*0531*1001*X*004010X097A1~ST* 837*0001~BHT*0019*00*1*20100126*0531*CH~REF*87*004 010X097A1~NM1*41*2*WORKS INC*****46*999999999~PER*IC*SERVICES*TE*4107851470 ~NM1*40*2*ABC*****46*0135WCH00~HL*1**20*1~NM1*85*1 *AUSTIN*KEITH****XX*999999999~N3*3718 OLD ROAD~N4*LYNCHBURG*NY*11111~REF*G5*0000~REF*EI*9999 99999~REF*1B*005927~REF*1D*0012287~REF*LU*43438560 00~REF*G2*0401005610~NM1*87*2*DR KEITH AUSTIN*****24*54-9999999~HL*2*1*22*1~SBR*P*18*9141*CBS PERSONNEL SERVICES**6***ZZ~NM1*IL*1*STONE*SHARON*W***MI*9999 99999~N3*1911 SMITH DR~N4*LYNCHBURG*NY*11111~DMG*D8*19620202*F~NM1*PR* 2*DELTA/MI*****PI*DELTA~N3*PO BOX 9085~N4*FARMINGTON HILL*MI*48333~HL*2*1*23*0~PAT*19~NM1*QC*1*SMITH*JO AN*H~N3*1911 SMITH DR~N4*LYNCHBURG*NY*11111~DMG*D8*19921223*F~CLM*000 7969010075152P*238***11::1*Y*A*Y*Y~REF*D9*00934100 0075152~NTE*ADD*3718 OLD ROAD\\LYNCHBURG\NY\11111~NM1*82*1*AUSTIN*KEITH**** XX*999999999~PRV*PE*ZZ*122300000X~REF*TJ*541146835 ~REF*1E*5610~LX*1~SV3*AD0120*39****1~DTP*472*D8* 20091203~LX*2~SV3*AD1110*64****1~DTP*472*D8*2009 1203~LX*3~SV3*AD2160*135****1~TOO*JP*31*D:O:B~DT P*472*D8*20091203~SE*50*0001~GE*1*1001~IEA*1*00000 0001~
</Input837>
<OutputEOB />
<Output997 />


The RESTful request would look like:

"https://gds.eligibleapi.com/v1.3/coverage/all.json?test=true&api_key=81ef98e5-4584-19fb-0d8c-6e987b95d695&payer_id=
00001&provider_last_name=Doe&provider_first_name=J ohn&provider_npi=0123456789&member_id=ZZZ445554301 &member_first_name=IDA&member_last_name=FRANKLIN&m ember_dob=1701-12-12&service_type=30"


Could you advise how that can be implemented please with one channel accepting X12 data and dispatching to either one for further processing based on Payer data: extract code for Payer (DELTA or CIGNA etc) from X12 and then based on that code value (how to implement decision point?) would call other channels passing either whole X12 payload for SOAP wrapped Requests or portions of it for lightweight RESTful request?

Have you implemented something like that before - if so, a sample would be very helpful.

QUESTION 2: In case of SOAP response returned and containing X12 data again what would be the best way to parse for the values?

1. The code for getting values from SOAP response to be placed on Channel map should be placed in the Transformer section of a Response Destination (Web Services call) and will use MSG..<node_name> syntax to start iterating in, correct:

[I]var tdata = new Array();
for each (node in msg..eligibility_verification) { //are there TWO dots in MSG..ELIGIBILITY VERFICIATION?

var i = 0;
for each (child in node) {

var nodename = child.name.toString();
tdata[i] = child.toString();

channelMap.put(nodename + i,tdata); //this will write values to the channel Map.
i++;

} //for loop
}


(the sample SOAP response message looks like this - really an X12 EDIt text wrapped into SOAP Envelope format)

<Process837Response xmlns="https://www.realtimeclaims.com/">
<Process837Result>0</Process837Result>
<OutputEOB>--------------------------------------
CLAIM SUBMISSION RESULTS
DELTA USA
---------------------------------------
SUBSCRIBER NAME: SHARON STONE
PATIENT NAME: JOAN SMITH
IDENTIFICATIN NO: 229065379
RECEIVE DATE: 04/07/2010
SERVICE DATE: 12/03/2009
PROVIDER(NUMBER) : 999999999
PROVIDER: KEITH AUSTIN
CLAIM #: 999999999999
---------------------------------------
CODE-TOOTH # PROCEDURE DESCRIPTION
CHARGE ALLOW SUBSCRIBER N-CHARGE PAID EX
---------------------------------------
D0120 ADA PROC CODE DESC
39.00 39.00 0.00 0.00 39.00
D1110 ADA PROC CODE DESC
64.00 64.00 0.00 0.00 64.00
D2160 ADA PROC CODE DESC
135.00 135.00 0.00 0.00 13
...
</OutputEOB>
<Output997>ISA*00* *00* *20*0135WCH00 *30*521301729 *100126*1731*U*00401*000000001*1*T*:~
GS*FA*0135WCH00*521301729*20100126*0531*1001*X*004 010X097A1~
ST*997*0001~
AK1*HC*1001~
AK2*837*0001~
AK5*A~
AK9*A*1*1*1~
SE*6*0001~
GE*1*1001~
IEA*1*000000001~
</Output997>


And how would I go about processing JSON response form RESTfuil Web Services?

Sorry for too many questions and appreciate partial responses as well.

thanks,
Dan
Reply With Quote
  #2  
Old 01-16-2014, 02:00 AM
StefanScholte StefanScholte is offline
 
Join Date: May 2009
Location: Netherlands, Harderwijk
Posts: 321
StefanScholte is on a distinguished road
Default

Well Dan,

I hope I can shed some light for you but to be honest I do not have much experience with restful api and soap (not yet).

Question 1:

My Idea would be 1 channel accepting soap messages and extract the X12 data at the source connector. using something like this:
Code:
SerializerFactory.getX12Serializer(inferDelimiters).toXML(message);
default xml namespace = new Namespace('urn:mirthproject-org:x12:xml');
(Mirth Connect 2.x)

then send the parsed X12 message to the destinations
where a filtering per destination on the Payer data occurs

Question 2:

every response will be placed in the responseMap variable so you can traverse through this. the javascript example you are seeing is calles E4x (ecmascript for xml)

the code snippet will not work on the response this is a code snippet for a transformerstep in the source or destination connector.

do you use MirthConnect 3.0.1? then there is a response transformer.
JSON is native javascript so you can use JSON.stringify and JSON.Parse


I hope this helps you on your way.
with kind regards
Stefan Scholte
Reply With Quote
  #3  
Old 01-16-2014, 01:44 PM
dzilberman dzilberman is offline
OBX.2 Kenobi
 
Join Date: Sep 2013
Location: San Francisco, CA
Posts: 71
dzilberman is on a distinguished road
Question

Hi Stefan,

Thanks a lot for your response. I am also new to Mirth 9as mentioned before and still am struggling with questions "Where to put certain JScript code to obtain data from SOAP/RESTful Web Service call response"?

I am running Mirth 3.0.1 BTW. So, the script you suggested for extracting X12 payload form SOAP message:

Code:
SerializerFactory.getX12Serializer(inferDelimiters).toXML(message);
default xml namespace = new Namespace('urn:mirthproject-org:x12:xml');
would still work in 3.0.1? Will I place this code into the "source" section of the channel? Actually, I am thinking for development purposes I can even read the X12 payload form a text file.

The main question I am still unclear about is once I retrieve a X12 payload like:

ISA*00* *00* *12*ABCCOM *01*999999999 *120117*1719*U*00400*000006768*0*P*>
GS*HS*4405197800*999999999*20120117*1719*1421*X*00 4010VICS
ST*270*1234
BHT*0022*13*1*20010820*1330
HL*1**20*1
NM1*PR*2******PI*123456789
HL*2*1*21*1
NM1*1P*2******SV*987654321
HL*3*2*22*0
NM1*IL*1*DOE*JANE****MI*345678901
EQ*30**FAM
SE*10*1234
GE*1*1421
IEA*1*000006768


And place it into "Raw" format - how then to implement a dispatch logic that would call either different Destinations or external Channels depending on value of Insurance payer contained in that payload? How that "conditional workflow" logic can be implemented in Mirth?

thanks again,
Dan Zilberman
Reply With Quote
  #4  
Old 01-17-2014, 12:13 AM
StefanScholte StefanScholte is offline
 
Join Date: May 2009
Location: Netherlands, Harderwijk
Posts: 321
StefanScholte is on a distinguished road
Default

Do you have the channel working so that you can accept a soap message?

If you do please post your channel together with an example message so I can help you further.
Reply With Quote
  #5  
Old 01-21-2014, 04:37 PM
dzilberman dzilberman is offline
OBX.2 Kenobi
 
Join Date: Sep 2013
Location: San Francisco, CA
Posts: 71
dzilberman is on a distinguished road
Thumbs up

Hi Stefan,

I don't have an input channel with Web Service source reader - and may not need one as the input data may be red from a shared file system from a X12 text file like the one attached.

From the 270 standard, we have:

"The 270 document typically includes the following:

Details of the sender of the inquiry (name and contact information of the information receiver)
Name of the recipient of the inquiry (the information source)
Details of the plan subscriber about to the inquiry is referring (patient)
Description of eligibility or benefit information requested"

Then once we have the Raw XML version of the input X12 message in the Source map - can we make a "decision point" that dispatches that data either wrapped in a SOAP call to Channel1 or mapped to HTTP Get RESTful WS call with parsed out parameters passed in a URL query string?

That's that part I am actually looking for, Stefan. I can post a simple receiver channel that reads the above data as inbound Web Service call ("Reader") later tonight if that is still needed.

Thanks
Dan
Attached Files
File Type: txt Request270Sample.txt (358 Bytes, 36 views)
Reply With Quote
  #6  
Old 01-22-2014, 01:36 PM
dzilberman dzilberman is offline
OBX.2 Kenobi
 
Join Date: Sep 2013
Location: San Francisco, CA
Posts: 71
dzilberman is on a distinguished road
Default

Could anybody please respond with an answer on whether/how one can implement a dispatch pattern using ONE inbound channel that routes messages further based on values of one or more fields in their PAYLOADS, please? Thanks!
Reply With Quote
  #7  
Old 01-22-2014, 01:56 PM
eduardoa eduardoa is offline
Mirth Employee
 
Join Date: Mar 2013
Location: Santa Fe Springs, California
Posts: 134
eduardoa is on a distinguished road
Default

If you only have two destinations then you could set up a channel with two destinations and just filter each. So you could have one destination with an HTTP Sender and one destination with a Web Service Sender. The filter logic would determine which messages get through to each.

You could also work out the logic and route the messages to a new channel if you want to separate the two destinations.
Reply With Quote
  #8  
Old 01-22-2014, 06:00 PM
dzilberman dzilberman is offline
OBX.2 Kenobi
 
Join Date: Sep 2013
Location: San Francisco, CA
Posts: 71
dzilberman is on a distinguished road
Default

Quote:
Originally Posted by eduardoa View Post
If you only have two destinations then you could set up a channel with two destinations and just filter each. So you could have one destination with an HTTP Sender and one destination with a Web Service Sender. The filter logic would determine which messages get through to each.

You could also work out the logic and route the messages to a new channel if you want to separate the two destinations.
Thanks for responding Eduardo, I would very much appreciate an example of such Filter code that routes to different channels - I am new to Mirth. Thanks, Dan
Reply With Quote
  #9  
Old 01-23-2014, 06:31 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,119
narupley is on a distinguished road
Default

Quote:
Originally Posted by dzilberman View Post
Thanks for responding Eduardo, I would very much appreciate an example of such Filter code that routes to different channels - I am new to Mirth. Thanks, Dan
Have you tried it out?

Edit your destination filter, and add a new Rule Builder step. Paste a sample inbound X12 message into the inbound message template, then drag over the field you want to test into the Rule Builder step. Then choose your condition (e.g. "Equals"), and add values to the table below, if necessary.
__________________
Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

Nicholas Rupley
Work: 949-237-6069
Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


- How do I foo?
- You just bar.
Reply With Quote
  #10  
Old 02-03-2014, 08:01 AM
dzilberman dzilberman is offline
OBX.2 Kenobi
 
Join Date: Sep 2013
Location: San Francisco, CA
Posts: 71
dzilberman is on a distinguished road
Smile Can somebody take a look at this example and correct so dispatching to WS caller or c

OK, I have finally got my hands on trying to implement the Filter based routing to the channels - please see attached export. I'm struggling with how to build those Filter rules in order to make sure that values of certain variables contained in the overall inciming SOAP message payload:

Quote:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<Process837 xmlns="https://www.realtimeclaims.com/">
<Input837>ISA*00* *00* *30*521301729 *20*0135WCH00 *100126*1731*U*00401*000000001*1*T*:~GS*HC*5213017 29*0135WCH00*20100126*0531*1001*X*004010X097A1~ST* 837*0001~BHT*0019*00*1*20100126*0531*CH~REF*87*004 010X097A1~NM1*41*2*WORKS INC*****46*999999999~PER*IC*SERVICES*TE*4107851470 ~NM1*40*2*ABC*****46*0135WCH00~HL*1**20*1~NM1*85*1 *AUSTIN*KEITH****XX*999999999~N3*3718 OLD ROAD~N4*LYNCHBURG*NY*11111~REF*G5*0000~REF*EI*9999 99999~REF*1B*005927~REF*1D*0012287~REF*LU*43438560 00~REF*G2*0401005610~NM1*87*2*DR KEITH AUSTIN*****24*54-9999999~HL*2*1*22*1~SBR*P*18*9141*CBS PERSONNEL SERVICES**6***ZZ~NM1*IL*1*STONE*SHARON*W***MI*9999 99999~N3*1911 SMITH DR~N4*LYNCHBURG*NY*11111~DMG*D8*19620202*F~NM1*PR* 2*DELTA/MI*****PI*DELTA~N3*PO BOX 9085~N4*FARMINGTON HILL*MI*48333~HL*2*1*23*0~PAT*19~NM1*QC*1*SMITH*JO AN*H~N3*1911 SMITH DR~N4*LYNCHBURG*NY*11111~DMG*D8*19921223*F~CLM*000 7969010075152P*238***11::1*Y*A*Y*Y~REF*D9*00934100 0075152~NTE*ADD*3718 OLD ROAD\\LYNCHBURG\NY\11111~NM1*82*1*AUSTIN*KEITH**** XX*999999999~PRV*PE*ZZ*122300000X~REF*TJ*541146835 ~REF*1E*5610~LX*1~SV3*AD0120*39****1~DTP*472*D8* 20091203~LX*2~SV3*AD1110*64****1~DTP*472*D8*2009 1203~LX*3~SV3*AD2160*135****1~TOO*JP*31*D:O:B~DT P*472*D8*20091203~SE*50*0001~GE*1*1001~IEA*1*00000 0001~
</Input837>
<OutputEOB />
<Output997 />
<UserId>userid</UserId>
<UserPassword>xxxx</UserPassword>
</Process837>
</soap:Body>
</soap:Envelope>
will have one value or another "Abcd1234" or "CDEF4321" just for example in the attached.
Could somebody take a look and correct pls? I'm actually looking for different values in the included X12 formatted payload in this segment: ISA*00* *00* *30*521301729 *20*0135WCH00 , so I guess I have to first parse SOAP request into X12 message, then extract that segment int a variable and then use it in filter expressions - no idea how to do that.

thanks,
Dan Z
Attached Files
File Type: xml Test WS Dispatcher DZ.xml (26.6 KB, 35 views)
Reply With Quote
Reply

Tags
dispatch pattern, x12

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 11:33 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation