Problem parsing OML^021

Discussion of open issues, suggestions and bugs regarding to (known as Delphi HL7) HL7 Components
Post Reply
rf1234
Posts: 9
Joined: Wed Feb 06, 2013 11:23 am

Problem parsing OML^021

Post by rf1234 »

I'm trying to parse this message:

MSH|^~\&|FRP||||20130205180519.884+0000||OML^021^OML_O21|68|T|2.5
PID||50|495426445^^^SNS^SS||Murcela^Antónia^da Piedade||19591104000000+0000|F|||Rua Maria do Rosário F. Melo Sousa, 33^^Belhó Elvas^Belhó Elvas^049^PRT
ORC|NW|11112||123456789|||1.000^^^^^N||20130205180520.081+0000|ADMIN
OBR||11112||6^Creatinina sérica [Creatininémia]
ORC|NW|11111||123456789|||1.000^^^^^N||20130205180520.081+0000|ADMIN
OBR||11111||4^Ureia sérica [Urémia]

I'm using version 1.5.1 of DelphiHL7.

The problem is that ORDERRepCount returns 1. But there are 2 orders in the message. What I'm doing wrong?

Thank for your help
admin
Site Admin
Posts: 256
Joined: Sun Jun 05, 2011 8:06 pm

Re: Problem parsing OML^021

Post by admin »

Hi,

Appears to be working properly.

First ORC,OBR belongs ORDER and OBSERVATION group.
Second ORC,OBR belongs PRIOR_RESULTs ORDER_PRIOR group.

http://www.delphihl7.com/doc/html/diHL7 ... ER_25.html

Best regards.
rf1234
Posts: 9
Joined: Wed Feb 06, 2013 11:23 am

Re: Problem parsing OML^021

Post by rf1234 »

Hi,

Can you please post here some sample source code to get ORC.1, ORC.4, OBR.2 and OBR.4 ?

The messages that I need to parse could have more ORC's and OBR's.

Thank you
admin wrote:Hi,

Appears to be working properly.

First ORC,OBR belongs ORDER and OBSERVATION group.
Second ORC,OBR belongs PRIOR_RESULTs ORDER_PRIOR group.

http://www.delphihl7.com/doc/html/diHL7 ... ER_25.html

Best regards.
admin
Site Admin
Posts: 256
Joined: Sun Jun 05, 2011 8:06 pm

Re: Problem parsing OML^021

Post by admin »

We are working on the issue.
Please wait for our response.
admin
Site Admin
Posts: 256
Joined: Sun Jun 05, 2011 8:06 pm

Re: Problem parsing OML^021

Post by admin »

Hi,

Updated message parser.
Please download lastest version 1.6.2

Code: Select all

procedure TForm1.Button1Click(Sender: TObject);
var
  msg : TdiOML_O21_25;
  str : AnsiString;
  i:integer;
begin
  Str :=
  'MSH|^~\&|FRP||||20130205180519.884+0000||OML^021^OML_O21|68|T|2.5'+#13+
  'PID||50|495426445^^^SNS^SS||Murcela^Antónia^da Piedade||19591104000000+0000|F|||Rua Maria do Rosário F. Melo Sousa, 33^^Belhó Elvas^Belhó Elvas^049^PRT'+#13+
  'ORC|NW|11112||123456789|||1.000^^^^^N||20130205180520.081+0000|ADMIN'+#13+
  'OBR||11112||6^Creatinina sérica [Creatininémia]'+#13+
  'ORC|NW|11111||123456789|||1.000^^^^^N||20130205180520.081+0000|ADMIN'+#13+
  'OBR||11111||4^Ureia sérica [Urémia]'+#13;

  msg := TdiOML_O21_25.Create;
  msg.AsString:=str;
  Memo1.Lines.Append(IntToStr( msg.ORDERRepCount));
  for i:=0 to msg.ORDERRepCount-1 do
  begin
    Memo1.Lines.Append(msg.ORDER[i].ORC.OrderControl.AsString);
    Memo1.Lines.Append(msg.ORDER[i].OBSERVATION_REQUEST.OBR.UniversalServiceIdentifier.Text.AsString);
  end;

  msg.Free;

end;
Result:

Code: Select all

2
NW
Creatinina sérica [Creatininémia]
NW
Ureia sérica [Urémia]
rf1234
Posts: 9
Joined: Wed Feb 06, 2013 11:23 am

Re: Problem parsing OML^021

Post by rf1234 »

Hi,

I was on vacation and only see your answer today.

Our licence (user and password) only have access to download up to 1.5.1.

How can I resolve this?

Thank you
admin
Site Admin
Posts: 256
Joined: Sun Jun 05, 2011 8:06 pm

Re: Problem parsing OML^021

Post by admin »

Hi,

Renew your subscription for +1 year.
or
You must define custom messages.

Best regards.
rf1234
Posts: 9
Joined: Wed Feb 06, 2013 11:23 am

Re: Problem parsing OML^021

Post by rf1234 »

I think that my company will not renew.

My company has a team license. How much for 1 year subscription?

Can you please post here the code to parse the message using custom messages?

Thank you
admin wrote:Hi,

Renew your subscription for +1 year.
or
You must define custom messages.

Best regards.
admin
Site Admin
Posts: 256
Joined: Sun Jun 05, 2011 8:06 pm

Re: Problem parsing OML^021

Post by admin »

1 year renewal price $300.
For custom message please wait our answer.
admin
Site Admin
Posts: 256
Joined: Sun Jun 05, 2011 8:06 pm

Re: Problem parsing OML^021

Post by admin »

Custom Message

Code: Select all

unit MyUnit;

interface
uses 
   SysUtils, Classes ,diHL7Base,diHL7DT25;

type

TdiMyOML_O21_ORDER_25= class(TdiSegmentGroup)
private
  ORCList:TdiSegmentList;
  OBRList:TdiSegmentList;
protected
   function GetORC : TdiORC_25;
   procedure SetORC(Value : TdiORC_25);
   function GetOBR : TdiOBR_25;
   procedure SetOBR(Value : TdiOBR_25);
public
   property ORC : TdiORC_25 read GetORC write SetORC ;
   property OBR : TdiOBR_25 read GetOBR write SetOBR ;
   constructor Create; override;
   destructor Destroy; override;
end;

TdiMyOML_O21_25= class(TdiMessage)
private
   MSHList:TdiSegmentList;
   PIDList:TdiSegmentList;
   ORDERList:TdiSegmentList;
protected
   function GetMSH : TdiMSH_25;
   procedure SetMSH(Value : TdiMSH_25);
   function GetPID : TdiPID_25;
   procedure SetPID(Value : TdiPID_25);
   function GetORDER( RepCount : Integer ) : TdiMyOML_O21_ORDER_25;
   procedure SetORDER( RepCount : Integer;Value : TdiMyOML_O21_ORDER_25);
public
   property MSH : TdiMSH_25 read GetMSH write SetMSH;
   property PID : TdiPID_25 read GetPID write SetPID;
   property ORDER[ RepCount : Integer ] : TdiMyOML_O21_ORDER_25 read GetORDER write SetORDER;
   function ORDERRepCount : Integer ;
   constructor Create; override;
end; 

implementation

constructor TdiMyOML_O21_ORDER_25.Create;
begin
  inherited;
  Name :='ORDER';
  ORCList:=TdiSegmentList.Create;
  ORCList.SetDefault('ORC','TdiORC_25',0,1,1,Self);
  Add(ORCList);
  OBRList:=TdiSegmentList.Create;
  OBRList.SetDefault('OBR','TdiOBR_25',1,1,1,Self);
  Add(OBRList);
end;

destructor TdiMyOML_O21_ORDER_25.Destroy;
begin
   inherited;
end;

function TdiMyOML_O21_ORDER_25.GetORC : TdiORC_25;
begin
  Result:=TdiORC_25(Find('ORC',0));
end;

procedure TdiMyOML_O21_ORDER_25.SetORC(Value  : TdiORC_25);
begin
  SetByName('ORC',0,Value);
end;

function TdiMyOML_O21_ORDER_25.GetOBR : TdiOBR_25;
begin
  Result:=TdiOBR_25(Find('OBR',0));
end;

procedure TdiMyOML_O21_ORDER_25.SetOBR(Value  : TdiOBR_25);
begin
  SetByName('OBR',0,Value);
end;

/////////////////////////////////////////////////////////////////////////////////
function TdiMyOML_O21_25.GetMSH : TdiMSH_25;
begin
   Result:=TdiMSH_25(Find('MSH',0));
end;
procedure TdiMyOML_O21_25.SetMSH(Value : TdiMSH_25);
begin
   SetByName('MSH',0,Value);
end;
function TdiMyOML_O21_25.GetPID : TdiPID_25;
begin
   Result:=TdiPID_25(Find('PID',0));
end;
procedure TdiMyOML_O21_25.SetPID(Value : TdiPID_25);
begin
   SetByName('PID',0,Value);
end;
function TdiMyOML_O21_25.GetORDER( RepCount : Integer ) : TdiMyOML_O21_ORDER_25;
begin
   Result:=TdiMyOML_O21_ORDER_25(Find('ORDER',RepCount));
end;
procedure TdiMyOML_O21_25.SetORDER( RepCount : Integer; Value : TdiMyOML_O21_ORDER_25);
begin
   SetByName('ORDER',RepCount,Value);
end;
function TdiMyOML_O21_25.ORDERRepCount : Integer;
begin
   Result:= GetSegmentCount('ORDER');
end;
constructor TdiMyOML_O21_25.Create;
begin
   inherited;
   Name :='OML_O21';
   MessageType :='OML';
   TriggerEvent :='O21';
   HL7Version :='2.5';
   MSHList:=TdiSegmentList.Create;
   MSHList.SetDefault('MSH','TdiMSH_25',0,1,1,Self);
   Add(MSHList);
   PIDList:=TdiSegmentList.Create;
   PIDList.SetDefault('PID','TdiPID_25',1,1,1,Self);
   Add(PIDList);
   ORDERList:=TdiSegmentList.Create;
   ORDERList.SetDefault('ORDER','TdiMyOML_O21_ORDER_25',2,1,-1,Self);
   Add(ORDERList);

   Parse(InitMsg);
end;

initialization
  RegisterClass(TdiMyOML_O21_25);
  RegisterClass(TdiMyOML_O21_ORDER_25);

finalization
  UnRegisterClass(TdiMyOML_O21_25);
  UnRegisterClass(TdiMyOML_O21_ORDER_25);  
end.
sample usage

Code: Select all

procedure TForm1.Button1Click(Sender: TObject);
var
  msg : TdiMyOML_O21_25;
  str : AnsiString;
  i:integer;
begin

   Str :=
  'MSH|^~\&|FRP||||20130205180519.884+0000||OML^021^OML_O21|68|T|2.5'+#13+
  'PID||50|495426445^^^SNS^SS||Murcela^Antónia^da Piedade||19591104000000+0000|F|||Rua Maria do Rosário F. Melo Sousa, 33^^Belhó Elvas^Belhó Elvas^049^PRT'+#13+
  'ORC|NW|11112||123456789|||1.000^^^^^N||20130205180520.081+0000|ADMIN'+#13+
  'OBR||11112||6^Creatinina sérica [Creatininémia]'+#13+
  'ORC|NW|11111||123456789|||1.000^^^^^N||20130205180520.081+0000|ADMIN'+#13+
  'OBR||11111||4^Ureia sérica [Urémia]'+#13;

  msg := TdiMyOML_O21_25.Create;
  msg.AsString:=str;
  Memo1.Lines.Append(IntToStr( msg.ORDERRepCount));
  for i:=0 to msg.ORDERRepCount-1 do
  begin
    Memo1.Lines.Append(msg.ORDER[i].ORC.OrderControl.AsString);
    Memo1.Lines.Append(msg.ORDER[i].OBR.UniversalServiceIdentifier.Text.AsString);
  end;

  msg.Free;
end;
Best regards
Post Reply

Who is online

Users browsing this forum: No registered users and 10 guests