Question
· Apr 12, 2017

Message Profiling

Hi all,

I was wondering if InterSystems offers any message profiling capabilities. What I mean by "message profiling" is essentially stats or metrics gathered from a collection of data submissions of a particular type. For instance, average number of segments  <XYZ> in a specific HL7 V2 message type. Or the number of sections found in a HL7 V3 CDA documents.

Curious if there is anything like this provided "out-of-box".

 

Thanks!

James

Discussion (4)0
Log in or sign up to continue

Hi James,

Nothing simple that I can think of (perhaps DeepSee?).

Alternatively, I normally bash out a few lines of code, something like this... 

ClassMethod DisplaySegmentStats()
{
  write !!,"Segment Statistics...",!!
  &sql(declare hl7 cursor for select rawContent into :raw from EnsLib_HL7.Message)
  &sql(open hl7)
  &sql(fetch hl7)
  while SQLCODE=0
  {
    for i=1:1:$l(raw,$C(13))-1
    {
      set seg=$p($p(raw,$c(13),i),"|")
      set stats(seg)=$G(stats(seg))+1
    }
    &sql(fetch hl7)
  }
  &sql(close hl7)
  zw stats
}

Thanks for the reply Sean!

I've thought about putting something together like this. Question on your approach though - I thought it wasn't entirely safe to loop over the "RawContent" property in EnsLib.HL7.Message because it doesn't always contain the entire HL7 V2 message. I was thinking of exploring the HL7 segment globals where the data is stored, but that might be getting too far in the weeds.

That's very true, rawContent is limited to 10,000 characters.

If you have messages that are larger then you could do it this way...

ClassMethod DisplaySegmentStats()
{
  write !!,"Segment Statistics...",!!
  &sql(declare hl7 cursor for select id into :id from EnsLib_HL7.Message)
  &sql(open hl7)
  &sql(fetch hl7)
  while SQLCODE=0
  {
    set msg=##class(EnsLib.HL7.Message).%OpenId(id)
    set raw=msg.getSegsAsString(id)
    for i=1:1:$l(raw,$C(13))-1
    {
      set seg=$p($p(raw,$c(13),i),"|")
      set stats(seg)=$G(stats(seg))+1
    }
    &sql(fetch hl7)
  }
  &sql(close hl7)
  zw stats
}

Thanks for the reply Sean!

I've thought about putting something together like this. Question on your approach though - I thought it wasn't entirely safe to loop over the "RawContent" property in EnsLib.HL7.Message because it doesn't always contain the entire HL7 V2 message. I was thinking of exploring the HL7 segment globals where the data is stored, but that might be getting to far in the weeds.