#1
|
|||
|
|||
![]()
I need to do the following (Mirth 3.2.1):
1. Receive messages via HL7 2. Hold messages until the top of the hour 3. Check all held messages and only send the most recent one for each accession 4. Send messages at top of the hour I think this is my logic (open to better suggestions!): 1. Channel A to receive messages with a Destination to save messages to a database, including separate columns with date/time received and accession number 2. Channel B to read database, polling hourly 3. Filter on destination in Channel B that will read database to see if there are more recent messages and if there are, filter this message out 4. Send message in HL7 format to destination I don't know how to do the following: 1. Save the message to a database so it is readable by Channel B as an entire HL7 message 2. Make sure the polling takes place at the top of the hour, not just hourly from when the channel is started 3. Read the entire message from the database and put it into the format I need to send it (I have read fields from a database and put them into a message, but I know I don't want to parse the message and then recompile it). I know how to do the filter on this. Are there any examples or tutorials that will help me with this? Thanks. Last edited by radams; 02-27-2018 at 08:01 AM. Reason: Added version |
#2
|
|||
|
|||
![]()
I think your general plan is good. I'd make sure your db query in Channel B only returns the most recent record for each accession number to eliminate the need for the destination filter. Also, would you want to delay pulling records that are not yet a certain age? I.e. if you just received a message 5 seconds before Channel B polls, do you want to wait for updates instead of returning the message?
Here's a sample query for Channel B db reader: Code:
select message, accession from myTable t inner join ( select accession, max(received) received from myTable group by accession ) m on t.accession = m.accession and t.received = m.received -- Below line is optional and syntax will depend on your database. -- This is mysql/mariadb. -- Pull only accession numbers where the most recent update is at least an -- hour old. having m.received < date_add(now(), interval - 1 hour); Code:
delete from myTable where accession = ${accession} and received <= ${received} Code:
insert values(message, accession, received) into test (${message.encodedData}, ${accession}, ${received}) In your Channel B source transformer make sure the outbound data type is HL7v2. The database reader should force the inbound type to XML. Add a javascript step with the following code to pass just the hl7 message to the destination. Then in your destination you can handle this as any other HL7 message. Code:
msg = SerializerFactory.getSerializer('HL7V2').toXML(msg['message']); Last edited by agermano; 02-27-2018 at 01:05 PM. |
![]() |
Tags |
database polling, database reader, database writer |
Thread Tools | |
Display Modes | |
|
|