The HL7 message is divided in parts with "|". The source is to be found in the 4th part and the source key in the 10th part. Considering the following message:
MSH|^~\\&|FORMENTRY|AMRS.ELD|HL7LISTENER|AMRS.ELD|20110805104142||ORU^R01|REl7wt78q9Pzlqe9ecJB|P|2.5|1||||||||3^AMRS.ELD.FORMID\rPID|||3^^^^||Patient^John^D||\rPV1||O|1||||1|||||||||||||||||||||||||||||||||||||20110805|||||||V\rORC|RE||||||||20110805104141|1^Super User\rOBR|1|||1238^MEDICAL RECORD OBSERVATIONS^99DCT\rOBX|1|NM|5089^WEIGHT (KG)^99DCT||67.2|||||||||20110805 The source is AMRS.ELD and the source key is REl7wt78q9Pzlqe9ecJB. If you simply post the HL7 message, it checks if the source is recognized and only then the message is put in the queue. In order for the example to work you need to have a row with name = AMRS.ELD in your hl7_source table. Did you verify that? No source key check is done and it can have any value. If you're still unsuccessful, please provide your stack trace. -Rafał On 12 April 2012 19:36, Mathias Lin | Meta Healthcare <[email protected]> wrote: > There's already a ticket that addresses that: > https://tickets.openmrs.org/browse/RESTWS-184 > > > On Fri, Apr 13, 2012 at 1:19 AM, Ben Wolfe <[email protected]> wrote: >> To answer Rafal's question: we should not add sources automatically. A >> server should know about all incoming sources beforehand. >> >> The hl7 post really just needs to be the hl7 message. Nothing outside of >> that is required as its all in the message. If there isn't a ticket for >> making this doable, can you create it? >> >> Ben >> >> >> On Thu, Apr 12, 2012 at 12:21 PM, Suranga Kasthurirathne >> <[email protected]> wrote: >>> >>> >>> Hi, >>> >>> Many thanks to Rafal and Lin for helping me out with this. I'll go ahead >>> and add the source value into the JSON object. And also, i'm wondering, >>> what should be the value of the Source key param ? >>> >>> >>> Best regards, >>> Suranga >>> >>> >>> On Thu, Apr 12, 2012 at 4:49 PM, Mathias Lin | Meta Healthcare >>> <[email protected]> wrote: >>>> >>>> Hi Suranga, >>>> >>>> I got it working now. The following works for me. Using curl, I add >>>> carriage returns via \r\n after each segment. >>>> Furthermore, in the PID segment, I had to add "OpenMRS Identification >>>> Number" into the PID segment as below: >>>> >>>> echo '{ >>>> "source":"LOCAL", >>>> "sourceKey":"test", >>>> >>>> "data":"MSH|^~\\&|FORMENTRY|AMRS|HL7LISTENER|AMRS|20060809121931||ORU^R01|formentry-20060809121931|P|2.5|1||||||||2^AMRS-ELDORET^http://schema.openmrs.org/2006/FormEntry/formId^URI\r\n >>>> PID|||100-8^^^OpenMRS Identification Number||Patient^John^D||\r\n >>>> PV1||O|1^Unknown||||2^Ima Doc >>>> (2-6)|||||||||||||||||||||||||||||||||||||20060907|||||||V\r\n >>>> ORC|RE||||||||20060807161605|1^Super User\r\n >>>> OBR|1|||1238^MEDICAL RECORD OBSERVATIONS^99DCT\r\n >>>> OBX|1|NM|5089^WEIGHT (KG)^99DCT||70|||||||||20060807\r\n >>>> OBR|2|||1019^COMPLETE BLOOD COUNT^99DCT\r\n >>>> OBX|1|NM|1015^HEMATOCRIT^99DCT||1000|||||||||20060807\r\n >>>> OBX|2|NM|21^HEMOGLOBIN^99DCT||1000|||||||||20060807\r\n >>>> OBX|3|NM|678^WHITE BLOOD CELLS^99DCT||100000|||||||||20060807\r\n >>>> OBX|4|NM|729^PLATELETS^99DCT||10|||||||||20060807\r\n >>>> OBR|3|||1284^PROBLEM LIST^99DCT\r\n >>>> OBX|1|CWE|6042^PROBLEM ADDED^99DCT||2^ANEMIA, >>>> HEMOLYSIS^99DCT|||||||||20060807 >>>> "}' | curl -i -X POST -H"Content-Type: application/json" -u >>>> admin:Admin123 -d@- http://localhost:8080/openmrs/ws/rest/v1/hl7 >>>> >>>> >>>> - Mathias >>>> >>>> >>>> On Thu, Apr 12, 2012 at 7:00 PM, Mathias Lin | Meta Healthcare >>>> <[email protected]> wrote: >>>> > Hi Suranga, >>>> > >>>> > best to post the errors you're getting as well. >>>> > >>>> > Regarding the "missing patient identifier in PID segment" as discussed >>>> > on Skype earlier, these are the relevant mailing list threads I found >>>> > about it so far: >>>> > >>>> > http://www.mail-archive.com/[email protected]/msg00137.html >>>> > >>>> > http://forum.openmrs.org/viewtopic.php?f=10&t=440&st=0&sk=t&sd=a&sid=760e1ec0ca15bf68244de9118dbd642b&start=30 >>>> > http://forum.openmrs.org/viewtopic.php?f=10&t=750 >>>> > >>>> > I'm also still looking into the same issue right now. >>>> > >>>> > - Mathias >>>> > >>>> > >>>> > On Thu, Apr 12, 2012 at 5:53 PM, Suranga Kasthurirathne >>>> > <[email protected]> wrote: >>>> >> >>>> >> Hi everyone, >>>> >> >>>> >> I'm engaged in an effort to send HL7 messages to the REST module via a >>>> >> POST >>>> >> request, and It seems to me that I'm not leveraging the benefits of >>>> >> RESTWS-184 as I should. >>>> >> Based on the comments on that ticket, I tried the following - >>>> >> >>>> >> 1. tried sending the HL7 message as a plain text content of the POST >>>> >> (with >>>> >> and without double quotes around it) >>>> >> 2. tried sending it as a simple JSON object without the source and >>>> >> sourceKey. [etc. { "hl7" : "the hl7 message" }] >>>> >> >>>> >> In both cases, I came up with errors. >>>> >> I next tried the old fashioned approach, by including both the source >>>> >> and >>>> >> the source key, >>>> >> >>>> >> I tried, >>>> >> >>>> >> {"source":"FAKE","sourceKey":"FAKE","data":"MSH|^~\\&|FORMENTRY|AMRS.ELD|HL7LISTENER|AMRS.ELD|20110805104142||ORU^R01|REl7wt78q9Pzlqe9ecJB|P|2.5|1||||||||3^AMRS.ELD.FORMID\rPID|||3^^^^||Patient^John^D||\rPV1||O|1||||1|||||||||||||||||||||||||||||||||||||20110805|||||||V\rORC|RE||||||||20110805104141|1^Super >>>> >> User\rOBR|1|||1238^MEDICAL RECORD >>>> >> OBSERVATIONS^99DCT\rOBX|1|NM|5089^WEIGHT >>>> >> (KG)^99DCT||67.2|||||||||20110805"} >>>> >> >>>> >> This message got posted into the HL7 queue table. However, >>>> >> (understandably) >>>> >> I get an error because it uses my fake data for the 'source' and >>>> >> 'sourcekey'. >>>> >> >>>> >> Mmm... any idea what the format of my POST request should be ? >>>> >> I assume that >>>> >> this problem will be solved if I can enter correct source and >>>> >> sourcekey >>>> >> values. I'd be most grateful for any advice :-) >>>> >> >>>> >> >>>> >> -- >>>> >> Thanks and Best Regards, >>>> >> Suranga >>>> >> >>>> > > _________________________________________ > > To unsubscribe from OpenMRS Developers' mailing list, send an e-mail to > [email protected] with "SIGNOFF openmrs-devel-l" in the body (not > the subject) of your e-mail. > > [mailto:[email protected]?body=SIGNOFF%20openmrs-devel-l] _________________________________________ To unsubscribe from OpenMRS Developers' mailing list, send an e-mail to [email protected] with "SIGNOFF openmrs-devel-l" in the body (not the subject) of your e-mail. [mailto:[email protected]?body=SIGNOFF%20openmrs-devel-l]

