web stats
HL7 Source filter - need help please - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 03-14-2019, 04:48 AM
pmcnally pmcnally is offline
Mirth Newb
 
Join Date: Dec 2015
Location: Massachusetts
Posts: 9
pmcnally is on a distinguished road
Exclamation HL7 Source filter - need help please

Hello,
I have a source filter that I cannot get working properly and I am looking for some help.

We are currently on 3.5.1 (I will update once I finish this suite of feeds).
This is an ORU feed coming & we need to suppress certain reports from sending in D (draft) status. The report code is in OBR.21 and the status in OBR.25.

This is my code. It is currently suppressing everything in Draft, not just these report types.

var reportType = ['2NDLENTMAL', 'ABV', 'ARTERIAL', 'ASV', 'AVBMT', 'BEDSPIRO', 'BHSJ.ECT', 'CAIR RPT', 'CARD', 'CARDREPORT', 'CIREXC', 'CLC FTSG', 'CLCFTSG-2',
'CLCIWAMOTO', 'CPAP09', 'CPAPNON09', 'DIPMYOREP', 'DOBMYOPER', 'DOPECHOREP', 'DUPLEX', 'ECHO REP', 'ED', 'ED.NOTE', 'EKG', 'EKG STRIP', 'EXERTESTRE',
'FEEG', 'FGI', 'FGSCR', 'FICS', 'FIRCR', 'FOSE', 'FTSG', 'FTWCLC', 'GRAFTETN', 'HOLTER', 'HST', 'IRMES', 'ISF', 'LENTMAL', 'LIV CTR', 'MELANOMWLE',
'MICROSURG', 'MOHS.OP', 'MOHSATT', 'MOHSCGRAFT', 'MOHSED+C', 'MSLT09', 'MWT09', 'MYOPEREXER', 'NM', 'NMMT', 'NPSG09', 'OUT REHAB', 'OUTPT REHA',
'PETSCAN', 'POSTPURSE', 'PS', 'PSMT', 'PULREPORT', 'RBMPHOTO', 'RCR', 'RCS', 'REA', 'REEG', 'RER', 'RGI', 'RPCM.ANEST', 'RPCM.BNOTE', 'RPCM.CCPHO',
'RPCM.COC', 'RPCM.COCPD', 'RPCM.COCPO', 'RPCM.CPR', 'RPCM.EEG', 'RPCM.EGDCP', 'RPCM.ENDUS', 'RPCM.EPR', 'RPCM.ERCP', 'RPCM.GIP', 'RPCM.OADM',
'RPCM.PAL', 'RPCM.RADPN', 'RPCM.SLFUP', 'RPCM.SURGB', 'RPCM.TNOTE', 'RPCM.UPEND', 'RPCM.URO', 'RSOPN', 'SIMPEXCCLC', 'SJEXMPS', 'SJNM', 'SJNMMT',
'SJPHARMMPS', 'SJSP', 'SJSPMT', 'SNERC.COG1', 'SNERC.SWAL', 'SP', 'SPCM.COCCM', 'SPCM.ECT', 'SPCM.GI', 'SPCM.OBHTP', 'SPCM.PFT', 'SPCM.REHWC',
'SPCM.RWEEK', 'SPCM.STVID', 'SPCM.TMTG', 'SPFAT', 'SPLIT09', 'SPMT', 'SPMT1', 'STAGING', 'TEE', 'TRANS'];

for each(obr in msg.OBR)
{
if(reportType.indexOf(obr['OBR.21']['OBR.21.1']) == -1 && obr['OBR.25']['OBR.25.1'] == 'D') return false;
else return true;

}

Thanks.
Reply With Quote
  #2  
Old 03-14-2019, 06:37 AM
kirbykn2's Avatar
kirbykn2 kirbykn2 is offline
Mirth Guru
 
Join Date: Sep 2014
Location: Michigan
Posts: 567
kirbykn2 is on a distinguished road
Default

use logger.info() statements to log your variables.
__________________
Kirby

Mirth Certified|Epic Bridges Certified|Cloverleaf Level 2 Certified

Appliance Version 3.11.2
Mirth Connect Version 3.6.1
Java Version 1.6.0_45-b06
Java (64 bit) Version 1.6.0_45-b06
Java 7 (64 bit) Version 1.7.0_151-b15
Java 8 (64 bit) Version 1.8.0_121-b13
PostgreSQL Version 9.6.3
Reply With Quote
  #3  
Old 03-14-2019, 03:22 PM
agermano agermano is offline
Mirth Guru
 
Join Date: Apr 2017
Location: Indiana, USA
Posts: 854
agermano is on a distinguished road
Default

  1. You have to use obr['OBR.21']['OBR.21.1'].toString() for your indexOf parameter. Otherwise you are passing it an xml object that will never match with a string.
  2. If you intend to check that the array contains the value you want to check the return value != -1. A value of -1 indicates that it was not found.
  3. Your for each loop is unnecessary since you always return after checking the first obr segment. You need some additional logic if you need to check that all segments qualify or at least one qualifies vs only checking the first one.
Reply With Quote
Reply

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 05:17 PM.


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