Segment unknown:

Discussion of open issues, suggestions and bugs regarding to (known as Delphi HL7) HL7 Components
critex
Posts: 8
Joined: Tue Feb 11, 2014 12:48 pm

Segment unknown:

Post by critex »

Hi all,
any idea how I can read messages like the following:

MSH|^~\&|100|100|199|199|20140821104157||RSP^K22^RSP_K21|41|P|2.5|||||GBR||EN
MSA|AA|hosp number
QAK|QRY001|OK
QPD|IHE PDQ Query|QRY001|@PID.3.1^TMP120406~@PID.3.4^140~@PID.3.5^PI|
PID|001||9761533^^^100^PE~TMP120404^^^126^PI~TMP120406^^^140^PI~TMP120502^^^108^PI~TMP120403^^^140^PI~TMP120404^^^129^PI~TMP120404^^^151^PI~TMP1212^^^131^PI~VTEST01^^^131^PI~VTEST01^^^182^PI~OBFTEST1^^^126^PI~OBFTEST1^^^140^PI~OBFTEST3^^^140^PI~OBFTEST4^^^140^PI~OBFTEST4^^^126^PI~OBFTEST5^^^126^PI~OBFTEST6^^^131^PI~OBFTEST6^^^140^PI~OBFTEST7^^^140^PI~OBFTEST8^^^140^PI~OBFTEST9^^^140^PI~OBFTEST10^^^140^PI~TMP120409^^^140^PI~TMP120411^^^140^PI~TMP120412^^^140^PI~1204201201^^^NHS^NH||Cavendish^Clarissa^^^Mrs^^U||19810510000000|M|^^^^^^A||Crouch/ End House^Stambridge^Rochford^Essex^CH26 5WX^^H||792290^PRN^^E-maily~Home mobilex^PRS|test5^WPN|CYM|9|Z|||||Z||||||9|20120201|||01
PD1|||^^W93015|G9504637


because standard RSP_K21 has no PID segment ... and if I try to fake the MSH to any ADT ... I get the same error in both cases "Segment unknown:"

I also tried to create a own type RSP_K21_withPID (using you example in uCustom.pas ... procedure Init; override "Error: not found in base class" ... and Definitions.add() "Error: unknown identifier")
So: I'm not able to process messages like the above example with DelphiHL7 components!

Thanks in advance, Hans
admin
Site Admin
Posts: 256
Joined: Sun Jun 05, 2011 8:06 pm

Re: Segment unknown:

Post by admin »

Can you share source code ?
critex
Posts: 8
Joined: Tue Feb 11, 2014 12:48 pm

Re: Segment unknown:

Post by critex »

I tried it in 2 ways:
1. derived from TdiMessage ... with MSH ...
2. derived from class TdiRSP_K21_25 ... with only adding PID ...

unit qhl7RSP_K21_PID;

interface
uses Classes, SysUtils, diHL7Base, diHL7Grp25, diHL725, diHL7DT25;

type
TdiRSP_K21_PID_25 = class(TdiRSP_K21_25)
// TdiRSP_K21_PID_25 = class(TdiMessage)
protected
// function GetMSH : TdiMSH_25;
// procedure SetMSH(Value : TdiMSH_25);
function GetPID : TdiPID_25;
procedure SetPID(Value : TdiPID_25);
public
// property MSH : TdiMSH_25 read GetMSH write SetMSH;
property PID : TdiPID_25 read GetPID write SetPID;
procedure Init; override;
end;

implementation
{ TdiRSP_K21_PID_25 }

procedure TdiRSP_K21_PID_25.Init;
begin
inherited;
Name :='RSP_K21_PID';
MessageType :='RSP';
TriggerEvent :='K22';
HL7Version :='2.5';
// Definitions.Add('MSH',TdiMSH_25,1,1);
Definitions.Add('PID',TdiPID_25,0,100);
Parse(InitMsg);
end;
{
function TdiRSP_K21_PID_25.GetMSH: TdiMSH_25;
begin
Result:=TdiMSH_25(GetStructure('MSH',0));
end;
}
function TdiRSP_K21_PID_25.GetPID: TdiPID_25;
begin
Result:=TdiPID_25(GetStructure('PID',0));
end;
{
procedure TdiRSP_K21_PID_25.SetMSH(Value: TdiMSH_25);
begin
SetStructure('MSH',0,Value);
end;
}
procedure TdiRSP_K21_PID_25.SetPID(Value: TdiPID_25);
begin
SetStructure('PID',0,Value);
end;

initialization
diRegisterClass(TdiRSP_K21_PID_25,'RSP_K21_PID', '2.5');

finalization
diUnRegisterClass(TdiRSP_K21_PID_25);
end.
admin
Site Admin
Posts: 256
Joined: Sun Jun 05, 2011 8:06 pm

Re: Segment unknown:

Post by admin »

You can derivate using TdiRSP_K21_25 class.
PID added as lasest segment. you may need change order.
Use Definitions.Move (TObjectList ) method.

Code: Select all

unit qhl7RSP_K21_PID;

interface
uses Classes, SysUtils, diHL7Base, diHL7Grp25, diHL725, diHL7DT25;

type
TdiRSP_K21_PID_25 = class(TdiRSP_K21_25)
protected
function GetPID : TdiPID_25;
procedure SetPID(Value : TdiPID_25);
public
property PID : TdiPID_25 read GetPID write SetPID;
procedure Init; override;
end;

implementation
{ TdiRSP_K21_PID_25 }

procedure TdiRSP_K21_PID_25.Init;
begin
inherited;
Name :='RSP_K21_PID';
MessageType :='RSP';
TriggerEvent :='K22';
HL7Version :='2.5';
// PID added as lasest segment. you may need change order.
// Use Definitions.Move method.
Definitions.Add('PID',TdiPID_25,0,100);

Parse(InitMsg, GetMessageInfo(InitMsg));
end;

function TdiRSP_K21_PID_25.GetPID: TdiPID_25;
begin
Result:=TdiPID_25(GetStructure('PID',0));
end;

procedure TdiRSP_K21_PID_25.SetPID(Value: TdiPID_25);
begin
SetStructure('PID',0,Value);
end;

initialization
diRegisterClass(TdiRSP_K21_PID_25,'RSP_K21_PID', '2.5');

finalization
diUnRegisterClass(TdiRSP_K21_PID_25);
end.
critex
Posts: 8
Joined: Tue Feb 11, 2014 12:48 pm

Re: Segment unknown:

Post by critex »

Sorry Admin,
but you obviousely did not really read what I've written:
procedure Init; override "Error: not found in base class" ...
and Definitions.add() "Error: unknown identifier"

I'm not able to compile the code ... I'd like to but I can not ...
procedure init does not exist in base class and Definitions is unknown
admin
Site Admin
Posts: 256
Joined: Sun Jun 05, 2011 8:06 pm

Re: Segment unknown:

Post by admin »

Hi,

I am tested code.
It's compiled.
What is your Delphi HL7 version?
critex
Posts: 8
Joined: Tue Feb 11, 2014 12:48 pm

Re: Segment unknown:

Post by critex »

Sorry for the delay ... our current version is 1.5.1 in Delphi7
admin
Site Admin
Posts: 256
Joined: Sun Jun 05, 2011 8:06 pm

Re: Segment unknown:

Post by admin »

Can you try lastest version ?
critex
Posts: 8
Joined: Tue Feb 11, 2014 12:48 pm

Re: Segment unknown:

Post by critex »

can you give me the relevant dcu's?
critex
Posts: 8
Joined: Tue Feb 11, 2014 12:48 pm

Re: Segment unknown:

Post by critex »

Hi Admin,
ich ordered the new version 1.6.7 and installed it.
First problem is solved. There is a PID-Segment in TdiRSP_K21_25(MSG).QUERY_RESPONSE.
BUT: this segment has no RepCount ... I normally get hundreds of PIDs in the QueryResult ... so I manually have to assign each single PID step by step to parse it.
And what is really annoying is that the terser doesn't work anymore ... I version 1.5.1 I could work with msg.Terser('/QPD-1').asString := 'myFlag' ...
in version 1.6.7 this leads to an access violation.

Any advice for me? Do I have to work in a different way with terser?

Thanks in advance
Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests