<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Extracting Fields from Structured HL7 Data in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Extracting-Fields-from-Structured-HL7-Data/m-p/175214#M50292</link>
    <description>&lt;P&gt;There is now a TA for parsing HL7 that was released subsequent to this question being asked.&lt;/P&gt;

&lt;P&gt;&lt;A href="https://splunkbase.splunk.com/app/3283/"&gt;https://splunkbase.splunk.com/app/3283/&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 19 Sep 2016 20:08:59 GMT</pubDate>
    <dc:creator>dstuder</dc:creator>
    <dc:date>2016-09-19T20:08:59Z</dc:date>
    <item>
      <title>Extracting Fields from Structured HL7 Data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-Fields-from-Structured-HL7-Data/m-p/175211#M50289</link>
      <description>&lt;P&gt;I am trying to figure out how to extract structured data from an HL7 2.x message &lt;/P&gt;

&lt;P&gt;The entire message is wrapped in a hl7 mlp wrapper, &lt;CODE&gt;&amp;lt;VT&amp;gt;&amp;lt;payload&amp;gt;&amp;lt;FS&amp;gt;&amp;lt;CR&amp;gt;&lt;/CODE&gt;, which I am using in the source type I created to extract individual messages.  The grammar of this message is MSH PID PV1 OBR { OBX }.  Essentially what this means is that the message will have 4 segments(strings) delimited by a &lt;CODE&gt;&amp;lt;CR&amp;gt;&lt;/CODE&gt; followed by 1 to n OBX segments each delimited by a &lt;CODE&gt;&amp;lt;CR&amp;gt;&lt;/CODE&gt;. Each segment represents a different set of information:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;MSH =&amp;gt; Message Header&lt;/LI&gt;
&lt;LI&gt;PID =&amp;gt; Patient Info&lt;/LI&gt;
&lt;LI&gt;PV1 =&amp;gt; Patient Visit/Encounter Info&lt;/LI&gt;
&lt;LI&gt;OBR =&amp;gt; Observation Request&lt;/LI&gt;
&lt;LI&gt;OBX =&amp;gt; Observation/Result&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;Because the first 4 segments are required and in order I was able to extract all fields using a regex.&lt;/P&gt;

&lt;P&gt;Example:&lt;/P&gt;

&lt;P&gt;Message(excluding message wrapper)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;MSH|^~\&amp;amp;|Sending Application|N|||20140731105559||ORU^R01|47311055594607d|P|2.3||||||8859/1
PID|||MRN19||PV1^19||19000101|M||||||||||CSN19
PV1||I|SNGH GICU||||||||||||||||ECN123456
OBR|||||||20140731105559
OBX|1|ST|&amp;lt;Observation_Identifier&amp;gt;||&amp;lt;Observation_Value&amp;gt;|&amp;lt;Observation_Units&amp;gt;|||||&amp;lt;Observation_Status&amp;gt;|||&amp;lt;Observation_Time&amp;gt;||
OBX|2|NM|Temperature||98.6|Celsius|||||F|||20140731105559||
OBX|3|ST|Heart Rate||60|/min|||||F|||20140731105559||
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Regex  to extract all fields from the MSH segment&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?m).*MSH\|(?:(?:(?:$)|(?:\n)|(?&amp;lt;encoding_characters&amp;gt;[^|\n]*)|(?:\|))(?:\|?))(?:(?:(?:$)|(?:\n)|(?&amp;lt;sending_application&amp;gt;[^|\n]*)|(?:\|))(?:\|?))(?:(?:(?:$)|(?:\n)|(?&amp;lt;sending_facility&amp;gt;[^|\n]*)|(?:\|))(?:\|?))(?:(?:(?:$)|(?:\n)|(?&amp;lt;receiving_application&amp;gt;[^|\n]*)|(?:\|))(?:\|?))(?:(?:(?:$)|(?:\n)|(?&amp;lt;receiving_facility&amp;gt;[^|\n]*)|(?:\|))(?:\|?))(?:(?:(?:$)|(?:\n)|(?&amp;lt;date_time_of_message&amp;gt;[^|\n]*)|(?:\|))(?:\|?))(?:(?:(?:$)|(?:\n)|(?&amp;lt;security&amp;gt;[^|\n]*)|(?:\|))(?:\|?))(?:(?:(?:$)|(?:\n)|(?&amp;lt;message_type&amp;gt;[^|\n]*)|(?:\|))(?:\|?))(?:(?:(?:$)|(?:\n)|(?&amp;lt;message_control_id&amp;gt;[^|\n]*)|(?:\|))(?:\|?))(?:(?:(?:$)|(?:\n)|(?&amp;lt;processing_id&amp;gt;[^|\n]*)|(?:\|))(?:\|?))(?:(?:(?:$)|(?:\n)|(?&amp;lt;version_id&amp;gt;[^|\n]*)|(?:\|))(?:\|?))(?:(?:(?:$)|(?:\n)|(?&amp;lt;sequence_id&amp;gt;[^|\n]*)|(?:\|))(?:\|?))(?:(?:(?:$)|(?:\n)|(?&amp;lt;continuation_pointer&amp;gt;[^|\n]*)|(?:\|))(?:\|?))(?:(?:(?:$)|(?:\n)|(?&amp;lt;accept_acknowledge_type&amp;gt;[^|\n]*)|(?:\|))(?:\|?))(?:(?:(?:$)|(?:\n)|(?&amp;lt;application_acknowledge_type&amp;gt;[^|\n]*)|(?:\|))(?:\|?))(?:(?:(?:$)|(?:\n)|(?&amp;lt;country_code&amp;gt;[^|\n]*)|(?:\|))(?:\|?))(?:(?:(?:$)|(?:\n)|(?&amp;lt;character_set&amp;gt;[^|\n]*)|(?:\|))(?:\|?))(?:(?:(?:$)|(?:\n)|(?&amp;lt;principal_language_of_message&amp;gt;[^|\n]*)|(?:\|))(?:\|?))
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In the message above message each OBX segment represents a measurement.&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;OBX 1 =&amp;gt; Example with field names&lt;/LI&gt;
&lt;LI&gt;OBX 2 =&amp;gt; Temperature Measurement&lt;/LI&gt;
&lt;LI&gt;OBX 3 =&amp;gt; Heart Rate Measurement&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;So for any given message I need to be able to extract each measurement plus the attributes of the measurement, Value, Units, Time, .... and there can be 1 to n instances of the OBX segments or even of the same measurement type at a different time.&lt;/P&gt;

&lt;P&gt;The only way I have been able to get this to work so far is to deconstruct the message before injecting it into splunk and generating a new message for each measurement.  This is a less than ideal solution and I would prefer to get this to work using splunk.&lt;/P&gt;

&lt;P&gt;Any suggestions would be greatly appreciated.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Aug 2014 20:52:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-Fields-from-Structured-HL7-Data/m-p/175211#M50289</guid>
      <dc:creator>dmbreton</dc:creator>
      <dc:date>2014-08-07T20:52:35Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting Fields from Structured HL7 Data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-Fields-from-Structured-HL7-Data/m-p/175212#M50290</link>
      <description>&lt;P&gt;You can setup multivalue field extraction using transforms.conf.&lt;/P&gt;

&lt;P&gt;Reference:&lt;BR /&gt;
&lt;A href="http://answers.splunk.com/answers/112311/multi-value-field-extraction"&gt;http://answers.splunk.com/answers/112311/multi-value-field-extraction&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://answers.splunk.com/answers/11777/field-extraction-into-multivalue-field"&gt;http://answers.splunk.com/answers/11777/field-extraction-into-multivalue-field&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Aug 2014 21:12:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-Fields-from-Structured-HL7-Data/m-p/175212#M50290</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-08-07T21:12:06Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting Fields from Structured HL7 Data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-Fields-from-Structured-HL7-Data/m-p/175213#M50291</link>
      <description>&lt;P&gt;Something like this (just for OBX, assuming there are 15 fields after the keyword OBX)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[YourSourceType]
REPORT-mv_obx = xf-obx

TRANSFORMS.CONF:

[xf-obx]
REGEX = ^OBX\|(?&amp;lt;field1&amp;gt;.*)\|(?&amp;lt;field2&amp;gt;.*)\|(?&amp;lt;field3&amp;gt;.*)\|.....write others...\|(?&amp;lt;field15&amp;gt;.*)\|
MV_ADD = true
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Aug 2014 21:14:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-Fields-from-Structured-HL7-Data/m-p/175213#M50291</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-08-07T21:14:59Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting Fields from Structured HL7 Data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-Fields-from-Structured-HL7-Data/m-p/175214#M50292</link>
      <description>&lt;P&gt;There is now a TA for parsing HL7 that was released subsequent to this question being asked.&lt;/P&gt;

&lt;P&gt;&lt;A href="https://splunkbase.splunk.com/app/3283/"&gt;https://splunkbase.splunk.com/app/3283/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Sep 2016 20:08:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-Fields-from-Structured-HL7-Data/m-p/175214#M50292</guid>
      <dc:creator>dstuder</dc:creator>
      <dc:date>2016-09-19T20:08:59Z</dc:date>
    </item>
  </channel>
</rss>

