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]

Reply via email to