From c83c7afd9898e1032984a81d3792b174222930df Mon Sep 17 00:00:00 2001 From: Mark Payne Date: Fri, 10 Apr 2015 14:25:53 -0400 Subject: [PATCH] NIFI-506: Fixed unit tests and resources, and added RAT exclusions --- .../nifi-hl7-query-language/pom.xml | 10 ++++ .../nifi/hl7/query/antlr/HL7QueryLexer.g | 17 ++++++ .../nifi/hl7/query/antlr/HL7QueryParser.g | 17 ++++++ .../apache/nifi/hl7/query/TestHL7Query.java | 52 ++-------------- .../src/test/resources/hyperglycemia | 8 +-- .../src/test/resources/hypoglycemia | 8 +-- .../src/test/resources/metabolic-panel | 23 ------- .../resources/unsolicited-vaccine-update-long | 16 ----- .../unsolicited-vaccine-update-short | 4 -- .../src/test/resources/vaccine-query | 3 - .../src/test/resources/vaers-message-long | 60 ------------------- .../nifi-hl7-processors/pom.xml | 14 +++++ .../hl7/TestExtractHL7Attributes.java | 2 +- .../src/test/resources/1.hl7 | 16 ----- .../src/test/resources/hypoglycemia.hl7 | 10 ++-- 15 files changed, 77 insertions(+), 183 deletions(-) delete mode 100644 nifi/nifi-commons/nifi-hl7-query-language/src/test/resources/metabolic-panel delete mode 100644 nifi/nifi-commons/nifi-hl7-query-language/src/test/resources/unsolicited-vaccine-update-long delete mode 100644 nifi/nifi-commons/nifi-hl7-query-language/src/test/resources/unsolicited-vaccine-update-short delete mode 100644 nifi/nifi-commons/nifi-hl7-query-language/src/test/resources/vaccine-query delete mode 100644 nifi/nifi-commons/nifi-hl7-query-language/src/test/resources/vaers-message-long delete mode 100644 nifi/nifi-nar-bundles/nifi-hl7-bundle/nifi-hl7-processors/src/test/resources/1.hl7 diff --git a/nifi/nifi-commons/nifi-hl7-query-language/pom.xml b/nifi/nifi-commons/nifi-hl7-query-language/pom.xml index 447a88b84d..9d0003fcec 100644 --- a/nifi/nifi-commons/nifi-hl7-query-language/pom.xml +++ b/nifi/nifi-commons/nifi-hl7-query-language/pom.xml @@ -48,6 +48,16 @@ + + org.apache.rat + apache-rat-plugin + + + src/test/resources/hypoglycemia + src/test/resources/hyperglycemia + + + diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/antlr3/org/apache/nifi/hl7/query/antlr/HL7QueryLexer.g b/nifi/nifi-commons/nifi-hl7-query-language/src/main/antlr3/org/apache/nifi/hl7/query/antlr/HL7QueryLexer.g index 7fe3386b4d..478028b9f7 100644 --- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/antlr3/org/apache/nifi/hl7/query/antlr/HL7QueryLexer.g +++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/antlr3/org/apache/nifi/hl7/query/antlr/HL7QueryLexer.g @@ -1,3 +1,20 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + lexer grammar HL7QueryLexer; @header { diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/antlr3/org/apache/nifi/hl7/query/antlr/HL7QueryParser.g b/nifi/nifi-commons/nifi-hl7-query-language/src/main/antlr3/org/apache/nifi/hl7/query/antlr/HL7QueryParser.g index 4d8d13c59a..f051872eba 100644 --- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/antlr3/org/apache/nifi/hl7/query/antlr/HL7QueryParser.g +++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/antlr3/org/apache/nifi/hl7/query/antlr/HL7QueryParser.g @@ -1,3 +1,20 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + parser grammar HL7QueryParser; options { diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/test/java/org/apache/nifi/hl7/query/TestHL7Query.java b/nifi/nifi-commons/nifi-hl7-query-language/src/test/java/org/apache/nifi/hl7/query/TestHL7Query.java index fbe4a8d285..596440c380 100644 --- a/nifi/nifi-commons/nifi-hl7-query-language/src/test/java/org/apache/nifi/hl7/query/TestHL7Query.java +++ b/nifi/nifi-commons/nifi-hl7-query-language/src/test/java/org/apache/nifi/hl7/query/TestHL7Query.java @@ -23,7 +23,6 @@ import static org.junit.Assert.assertTrue; import java.io.File; import java.io.IOException; import java.nio.file.Files; -import java.nio.file.Paths; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; @@ -32,8 +31,6 @@ import java.util.Map; import org.apache.nifi.hl7.hapi.HapiMessage; import org.apache.nifi.hl7.model.HL7Field; import org.apache.nifi.hl7.model.HL7Message; -import org.apache.nifi.hl7.query.HL7Query; -import org.apache.nifi.hl7.query.QueryResult; import org.junit.Test; import ca.uhn.hl7v2.DefaultHapiContext; @@ -99,7 +96,7 @@ public class TestHL7Query { @Test public void testSelectMessage() throws HL7Exception, IOException { final HL7Query query = HL7Query.compile("SELECT MESSAGE"); - final HL7Message msg = createMessage(new File("src/test/resources/vaers-message-long")); + final HL7Message msg = createMessage(new File("src/test/resources/hypoglycemia")); final QueryResult result = query.evaluate(msg); assertTrue(result.isMatch()); final List labels = result.getLabels(); @@ -114,7 +111,7 @@ public class TestHL7Query { @SuppressWarnings({ "unchecked", "rawtypes" }) public void testSelectField() throws HL7Exception, IOException { final HL7Query query = HL7Query.compile("SELECT PID.5"); - final HL7Message msg = createMessage(new File("src/test/resources/unsolicited-vaccine-update-short")); + final HL7Message msg = createMessage(new File("src/test/resources/hypoglycemia")); final QueryResult result = query.evaluate(msg); assertTrue(result.isMatch()); final List labels = result.getLabels(); @@ -126,7 +123,7 @@ public class TestHL7Query { final List nameList = (List) names; assertEquals(1, nameList.size()); final HL7Field nameField = (HL7Field) nameList.get(0); - assertEquals("KENNEDY^JOHN^FITZGERALD^JR", nameField.getValue()); + assertEquals("SMITH^JOHN", nameField.getValue()); } @Test @@ -134,8 +131,8 @@ public class TestHL7Query { final String query = "DECLARE result AS REQUIRED OBX SELECT result WHERE result.7 != 'N' AND result.1 = 1"; final HL7Query hl7Query = HL7Query.compile(query); - final QueryResult result = hl7Query.evaluate(createMessage(new File("src/test/resources/vaers-message-long"))); - assertFalse( result.isMatch() ); + final QueryResult result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); + assertTrue( result.isMatch() ); } @@ -224,18 +221,6 @@ public class TestHL7Query { QueryResult result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); assertTrue( result.isMatch() ); assertEquals(1, result.getHitCount()); - - hl7Query = HL7Query.compile("DECLARE result AS REQUIRED OBX SELECT result WHERE result.1 = 1"); - HL7Message msg = createMessage(new File("src/test/resources/vaers-message-long")); - result = hl7Query.evaluate(msg); - assertTrue( result.isMatch() ); - assertEquals(9, result.getHitCount()); - - hl7Query = HL7Query.compile("DECLARE result AS REQUIRED OBX SELECT result WHERE result.1 = 1 AND result.3.1.1 = '30961-7'"); - result = hl7Query.evaluate(msg); - assertTrue( result.isMatch() ); - assertEquals(1, result.getHitCount()); - } @Test @@ -288,10 +273,6 @@ public class TestHL7Query { hl7Query = HL7Query.compile("SELECT MESSAGE WHERE OBX IS NULL"); result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); assertFalse( result.isMatch() ); - - hl7Query = HL7Query.compile("SELECT MESSAGE WHERE NK1.1 = '1' AND NK1.8 IS NULL"); - result = hl7Query.evaluate(createMessage(new File("src/test/resources/unsolicited-vaccine-update-long"))); - assertTrue( result.isMatch() ); } @@ -312,14 +293,6 @@ public class TestHL7Query { hl7Query = HL7Query.compile("SELECT MESSAGE WHERE OBX NOT NULL"); result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); assertTrue( result.isMatch() ); - - hl7Query = HL7Query.compile("SELECT MESSAGE WHERE NK1.1 = '1' AND NK1.33 NOT NULL"); - result = hl7Query.evaluate(createMessage(new File("src/test/resources/unsolicited-vaccine-update-long"))); - assertTrue( result.isMatch() ); - - hl7Query = HL7Query.compile("SELECT MESSAGE WHERE NK1.1 = 1 AND NK1.33 NOT NULL"); - result = hl7Query.evaluate(createMessage(new File("src/test/resources/unsolicited-vaccine-update-long"))); - assertTrue( result.isMatch() ); } private HL7Message createMessage(final File file) throws HL7Exception, IOException { @@ -334,19 +307,4 @@ public class TestHL7Query { return new HapiMessage(message); } - @Test - @SuppressWarnings("unused") - public void createMessage() throws IOException, HL7Exception { - final byte[] bytes = Files.readAllBytes(Paths.get("src/test/resources/vaers-message-long")); - final String msgText = new String(bytes, "UTF-8"); - - final HapiContext hapiContext = new DefaultHapiContext(); - hapiContext.setValidationContext(ValidationContextFactory.noValidation()); - - final PipeParser parser = hapiContext.getPipeParser(); - final Message message = parser.parse(msgText); - - final HL7Message hl7Msg = new HapiMessage(message); - } - } diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/test/resources/hyperglycemia b/nifi/nifi-commons/nifi-hl7-query-language/src/test/resources/hyperglycemia index dc44b89ac2..9c6888c598 100644 --- a/nifi/nifi-commons/nifi-hl7-query-language/src/test/resources/hyperglycemia +++ b/nifi/nifi-commons/nifi-hl7-query-language/src/test/resources/hyperglycemia @@ -1,5 +1,5 @@ -MSH|^~\&|CERNER||PriorityHealth||||ORU^R01|Q479004375T431430612|P|2.3| -PID|||001677980||SMITH^CURTIS||19680219|M||||||||||929645156318|123456789| +MSH|^~\&|XXXXXXXX||HealthProvider||||ORU^R01|Q1111111111111111111|P|2.3| +PID|||111111111||SMITH^JOHN||19700100|M||||||||||111111111111|123456789| PD1||||1234567890^LAST^FIRST^M^^^^^NPI| -OBR|1|341856649^HNAM_ORDERID|000002006326002362|648088^Basic Metabolic Panel|||20061122151600|||||||||1620^Hooker^Robert^L||||||20061122154733|||F|||||||||||20061122140000| -OBX|1|NM|GLU^Glucose Lvl|159|mg/dL|65-99^65^99|H|||F|||20061122154733| \ No newline at end of file +OBR|1|341856649^HNAM_ORDERID|000000000000000000|648088^Basic Metabolic Panel|||20150101000000|||||||||1620^Johnson^Corey^A||||||20150101000000|||F|||||||||||20150101000000| +OBX|1|NM|GLU^Glucose Lvl|159|mg/dL|65-99^65^99|H|||F|||20150102000000| \ No newline at end of file diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/test/resources/hypoglycemia b/nifi/nifi-commons/nifi-hl7-query-language/src/test/resources/hypoglycemia index 02e8967296..d7bdeece10 100644 --- a/nifi/nifi-commons/nifi-hl7-query-language/src/test/resources/hypoglycemia +++ b/nifi/nifi-commons/nifi-hl7-query-language/src/test/resources/hypoglycemia @@ -1,5 +1,5 @@ -MSH|^~\&|CERNER||PriorityHealth||||ORU^R01|Q479004375T431430612|P|2.3| -PID|||001677980||SMITH^CURTIS||19680219|M||||||||||929645156318|123456789| +MSH|^~\&|XXXXXXXX||HealthProvider||||ORU^R01|Q1111111111111111111|P|2.3| +PID|||111111111||SMITH^JOHN||19700100|M||||||||||111111111111|123456789| PD1||||1234567890^LAST^FIRST^M^^^^^NPI| -OBR|1|341856649^HNAM_ORDERID|000002006326002362|648088^Basic Metabolic Panel|||20061122151600|||||||||1620^Hooker^Robert^L||||||20061122154733|||F|||||||||||20061122140000| -OBX|1|NM|GLU^Glucose Lvl|59|mg/dL|65-99^65^99|L|||F|||20061122154733| \ No newline at end of file +OBR|1|341856649^HNAM_ORDERID|000000000000000000|648088^Basic Metabolic Panel|||20150101000000|||||||||1620^Johnson^Corey^A||||||20150101000000|||F|||||||||||20150101000000| +OBX|1|NM|GLU^Glucose Lvl|59|mg/dL|65-99^65^99|L|||F|||20150102000000| \ No newline at end of file diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/test/resources/metabolic-panel b/nifi/nifi-commons/nifi-hl7-query-language/src/test/resources/metabolic-panel deleted file mode 100644 index c62fc45a32..0000000000 --- a/nifi/nifi-commons/nifi-hl7-query-language/src/test/resources/metabolic-panel +++ /dev/null @@ -1,23 +0,0 @@ -MSH|^~\&|Lab1^1234^CLIA|^1234^CLIA|ELR^2.16.840.1.113883.19.3.2^ISO|SPH^2.16.840.1.113883.19.3.2^ISO|20110410140502-0500||ORU^R01^ORU_R01|1234567890|P^T|2.5.1|||NE|NE|USA||||USELR1.0^^2.16.840.1.114222.4.10.3^ISO -SFT|1|Level Seven Healthcare Software, Inc.^L^^^^&2.16.840.1.113883.19.4.6^ISO^XX^^^1234|1.2|An Lab System|56734||20080817 -PID|1||36363636^^^MPI&2.16.840.1.113883.19.3.2.1&ISO^MR^A&2.16.840.1.113883.19.3.2.1&ISO~444333333^^^&2.16.840.1.113883.4.1^IS O^SS||Everyman^Adam^A^^^^L^^^^^^^BS|Mum^Martha^M^^^^M|19800602|M||2106-3^White^CDCREC^^^^04/24/2007|2222 Home Street^^Ann Arbor^MI^99999^USA^H||^PRN^PH^^1^555^5552004|^WPN^PH^^1^955^5551009|eng^English^ISO6392^^^^3/29/2007|M^Married^HL70002^^^^2.5.1||||||N^Not Hispanic or Latino^HL70189^^^^2.5.1||||||||N|||200808151000-0700| Reliable^2.16.840.1.113883.19.3.1^ISO -ORC|RE|23456^EHR^2.16.840.1.113883.19.3.2.3^ISO|9700123^Lab^2.16.840.1.113883.19.3.1.6^ISO|||||||||1234^Admit^Alan^A^III^Dr^^^&2.16.840.1.113883.19.4.6^ISO^L^^^EI^&2.16.840.1.113883.19.4.6^ISO^^^^^^^^MD||^WPN^PH^^1^555^5551005|||||||Level Seven Healthcare, Inc.^L^^^^&2.16.840.1.113883.19.4.6^ISO^XX^^^1234|1005 Healthcare Drive^^Ann Arbor^MI^99999^USA^B|^WPN^PH^^1^555^5553001|4444 Healthcare Drive^Suite 123^Ann Arbor^MI^99999^USA^B -OBR|1|23456^EHR^2.16.840.1.113883.19.3.2.3^ISO|9700123^Lab^2.16.840.1.113883.19.3.1.6^ISO|24323-8^Comprehensive metabolic 2000 panel in Serum or Plasma^LN^3436442^Metaboloic Panel 2000, Comprehensive^99USI|||201104101130-0500||||||angina|||1234^Admit^Alan^A^III^Dr^^^&2.16.840.1.113883.19.4.6^ISO^L^^^EI^&2.16.840.1.113883.19.4.6^ISO^^^^^^^^MD|^WPN^PH^^1^555^5551005|||||201104101405-0500|||F||||||413^Angina pectoris^I9CDX^^^^07/09/2008|1235&Slide&Stan&S&&Dr&MD&&DOC&2.16.840.1.113883.19.4.6&ISO -OBX|1|NM|17861-6^Calcium [Mass/volume] in Serum or Plasma^LN||27.3|mg/dL^milligrams per deciliter^UCUM|8.7-10.7|HH|||F|||201104101130-0500|||||201104101325-0500||||GHH Lab^L^^^^CLIA&2.16.840.1.113883.19.4.6&ISO^XX^^^1236|3434 Industrial Loop^^Ann Arbor^MI^99999^USA^B|9876543^Slide^Stan^S^^^^^NPPES&2.16.840.1.113883.19.4.6&ISO^L^^^NPI -OBX|2|NM|3094-0^Urea nitrogen [Mass/volume] in Serum of Plasma^LN||15|mg/dL^milligrams per deciliter^UCUM|6 to 23|N|||F|||201104101130-0500|||||201104101325-0500||||GHH Lab^L^^^^CLIA&2.16.840.1.113883.19.4.6&ISO^XX^^^1236|3434 Industrial Loop^^Ann Arbor^MI^99999^USA^B|9876543^Slide^Stan^S^^^^^NPPES&2.16.840.1.113883.19.4.6&ISO^L^^^NPI -OBX|3|NM|2160-0^Creatinine [Mass/volume] in Serum or Plasma^LN||1.8|mg/dL^milligrams per deciliter^UCUM|0.7 to 1.2|H|||F|||201104101130-0500|||||201104101325-0500||||GHH Lab^L^^^^CLIA&2.16.840.1.113883.19.4.6&ISO^XX^^^1236|3434 Industrial Loop^^Ann Arbor^MI^99999^USA^B|9876543^Slide^Stan^S^^^^^NPPES&2.16.840.1.113883.19.4.6&ISO^L^^^NPI -OBX|4|NM|3097-3^Urea nitrogen/Creatinine [Mass ratio] in Serum or Plasma^LN||15||6 to 25|N|||F|||201104101130-0500|||||201104101325-0500||||GHH Lab^L^^^^CLIA&2.16.840.1.113883.19.4.6&ISO^XX^^^1236|3434 Industrial Loop^^Ann Arbor^MI^99999^USA^B|9876543^Slide^Stan^S^^^^^NPPES&2.16.840.1.113883.19.4.6&ISO^L^^^NPI -OBX|5|NM|2885-2^Protein [Mass/volume] in Serum or Plasma^LN||8.9|gm/dL^grams per deciliter^UCUM|6.3 to 8.2|H|||F|||201104101130-0500|||||201104101325-0500||||GHH Lab^L^^^^CLIA&2.16.840.1.113883.19.4.6&ISO^XX^^^1236|3434 Industrial Loop^^Ann Arbor^MI^99999^USA^B|9876543^Slide^Stan^S^^^^^NPPES&2.16.840.1.113883.19.4.6&ISO^L^^^NPI -OBX|6|NM|1751-7^Albumin [Mass/volume] in Serum or Plasma^LN||5.7|gm/dL^grams per deciliter^UCUM|3.5 to 5.0|H|||F|||201104101130-0500|||||201104101325-0500||||GHH Lab^L^^^^CLIA&2.16.840.1.113883.19.4.6&ISO^XX^^^1236|3434 Industrial Loop^^Ann Arbor^MI^99999^USA^B|9876543^Slide^Stan^S^^^^^NPPES&2.16.840.1.113883.19.4.6&ISO^L^^^NPI -OBX|7|NM|2336-6^Globulin [Mass/volume] in Serum or Plasma^LN||4.7|gm/dL^grams per deciliter^UCUM|2.2 to 4.2|H|||F|||201104101130-0500|||||201104101325-0500||||GHH Lab^L^^^^CLIA&2.16.840.1.113883.19.4.6&ISO^XX^^^1236|3434 Industrial Loop^^Ann Arbor^MI^99999^USA^B|9876543^Slide^Stan^S^^^^^NPPES&2.16.840.1.113883.19.4.6&ISO^L^^^NPI -OBX|8|NM|1759-0^Albumin/Globulin [Mass ratio] in Serum or Plasma^LN||1.7||0.8 to 2.0|N|||F|||201104101130-0500|||||201104101325-0500||||GHH Lab^L^^^^CLIA&2.16.840.1.113883.19.4.6&ISO^XX^^^1236|3434 Industrial Loop^^Ann Arbor^MI^99999^USA^B|9876543^Slide^Stan^S^^^^^NPPES&2.16.840.1.113883.19.4.6&ISO^L^^^NPI -OBX|9|NM|1975-2^Bilirubin.total [Mass/volume] in Serum or Plasma^LN||0.7|mg/dL^milligrams per deciliter^UCUM|0.3 to 1.9|N|||F|||201104101130-0500|||||201104101325-0500||||GHH Lab^L^^^^CLIA&2.16.840.1.113883.19.4.6&ISO^XX^^^1236|3434 Industrial Loop^^Ann Arbor^MI^99999^USA^B|9876543^Slide^Stan^S^^^^^NPPES&2.16.840.1.113883.19.4.6&ISO^L^^^NPI -OBX|10|NM|2345-7^Glucose [Mass/volume] in Serum or Plasma^LN||55|mg/dL^milligrams per deciliter^UCUM|60 to 109|L|||F|||201104101130-0500|||||201104101325-0500||||GHH Lab^L^^^^CLIA&2.16.840.1.113883.19.4.6&ISO^XX^^^1236|3434 Industrial Loop^^Ann Arbor^MI^99999^USA^B|9876543^Slide^Stan^S^^^^^NPPES&2.16.840.1.113883.19.4.6&ISO^L^^^NPI -OBX|11|NM|6768-6^Alkaline phosphatase [Enzymatic activity/volume] in Serum or Plasma^LN||64|U/L^units per liter^UCUM|32 to 110|N|||F|||201104101130-0500|||||201104101325-0500||||GHH Lab^L^^^^CLIA&2.16.840.1.113883.19.4.6&ISO^XX^^^1236|3434 Industrial Loop^^Ann Arbor^MI^99999^USA^B|9876543^Slide^Stan^S^^^^^NPPES&2.16.840.1.113883.19.4.6&ISO^L^^^NPI -OBX|12|NM|1920-8^Aspartate aminotransferase [Enzymatic activity/volume] in Serum or Plasma^LN||6|U/L^units per liter^UCUM|6 to 18|N|||F|||201104101130-0500|||||201104101325-0500||||GHH Lab^L^^^^CLIA&2.16.840.1.113883.19.4.6&ISO^XX^^^1236|3434 Industrial Loop^^Ann Arbor^MI^99999^USA^B|9876543^Slide^Stan^S^^^^^NPPES&2.16.840.1.113883.19.4.6&ISO^L^^^NPI -OBX|13|NM|1742-6^Alanine aminotransferase [Enzymatic activity/volume] in Serum or Plasma^LN||10|U/L^units per liter^UCUM|5 to 35|N|||F|||201104101130-0500|||||201104101325-0500||||GHH Lab^L^^^^CLIA&2.16.840.1.113883.19.4.6&ISO^XX^^^1236|3434 Industrial Loop^^Ann Arbor^MI^99999^USA^B|9876543^Slide^Stan^S^^^^^NPPES&2.16.840.1.113883.19.4.6&ISO^L^^^NPI -OBX|14|NM|2951-2^Sodium [Moles/volume] in Serum or Plasma^LN||140|mmol/L^millimoles per liter^UCUM|137 to 147|N|||F|||201104101130-0500|||||201104101325-0500||||GHH Lab^L^^^^CLIA&2.16.840.1.113883.19.4.6&ISO^XX^^^1236|3434 Industrial Loop^^Ann Arbor^MI^99999^USA^B|9876543^Slide^Stan^S^^^^^NPPES&2.16.840.1.113883.19.4.6&ISO^L^^^NPI -OBX|15|NM|2823-3^Potassium [Moles/volume] in Serum or Plasma^LN||4.5|mmol/L^millimoles per liter^UCUM|3.4 to 5.3|N|||F|||201104101130-0500|||||201104101325-0500||||GHH Lab^L^^^^CLIA&2.16.840.1.113883.19.4.6&ISO^XX^^^1236|3434 Industrial Loop^^Ann Arbor^MI^99999^USA^B|9876543^Slide^Stan^S^^^^^NPPES&2.16.840.1.113883.19.4.6&ISO^L^^^NPI -OBX|16|NM|2075-0^Chloride [Moles/volume] in Serum or Plasma^LN||99|mmol/L^millimoles per liter^UCUM|99 to 108|N|||F|||201104101130-0500|||||201104101325-0500||||GHH Lab^L^^^^CLIA&2.16.840.1.113883.19.4.6&ISO^XX^^^1236|3434 Industrial Loop^^Ann Arbor^MI^99999^USA^B|9876543^Slide^Stan^S^^^^^NPPES&2.16.840.1.113883.19.4.6&ISO^L^^^NPI -OBX|17|NM|2028-9^Carbon dioxide, total [Moles/volume] in Serum or Plasma^LN||27|mmol/L^millimoles per liter^UCUM|22 to 29|N|||F|||201104101130-0500|||||201104101325-0500||||GHH Lab^L^^^^CLIA&2.16.840.1.113883.19.4.6&ISO^XX^^^1236|3434 Industrial Loop^^Ann Arbor^MI^99999^USA^B|9876543^Slide^Stan^S^^^^^NPPES&2.16.840.1.113883.19.4.6&ISO^L^^^NPI -SPM|1|23456&EHR&2.16.840.1.113883.19.3.2.3&ISO^9700122&Lab&2.16.840.1.113883.19.3.1.6&ISO||119364003^Serum specimen^SCT^^^^20080131|||||||||||||201104101130-0500|201104101130-0500 diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/test/resources/unsolicited-vaccine-update-long b/nifi/nifi-commons/nifi-hl7-query-language/src/test/resources/unsolicited-vaccine-update-long deleted file mode 100644 index 8edd3fd82e..0000000000 --- a/nifi/nifi-commons/nifi-hl7-query-language/src/test/resources/unsolicited-vaccine-update-long +++ /dev/null @@ -1,16 +0,0 @@ -MSH|^~\&||MA0000||GA0000|19970901||VXU^V04|19970522MA53|T|2.3.1|||AL -PID|||1234^^^^SR^~1234-12^^^^LR^~3872^^^^MR~221345671^^^^SS^~430078856^^^^MA^ ||KENNEDY^JOHN^FITZGERALD^JR^^^L|BOUVIER^^^^^^M|19900607|M|KENNEDY^BABY BOY^^^^^^ B|W^WHITE^NY8 RACE CODES^W^WHITE^HL70005|123 MAIN ST^APT 3B^LEXINGTON^MA^00210^ ^M^MSA CODE^MA034~345 ELM ST^^BOSTON^MA^00314^^BLD~^^^^^^BR^^MA002| |(617) 555-1212 ^PRN^PH^^^617^5551212^^||EN^ENGLISH^HL70296^^^|||||||WN^NOT HISPANIC^LOCAL CODE SET^NH^NOT OF HISPANIC ORIGIN^HL70189|CHILDREN=S HOSPITAL -PD1|||CHILDREN=S HOSPITAL^^1234^^^^XX~LEXINGTON CLINIC^^1234A^^^^FI|12345^CARE^ PRIMARY^^^DR^MD^^^L^^^DN|||||||03^REMINDER/RECALL - NO CALLS^HL70215|Y -NK1|1|KENNEDY^JACQUELINE^LEE|32^MOTHER^HL70063||||||||||||||||||||||||||||||898666725^^^^SS -NK1|2|KENNEDY^JOHN^FITZGERALD|33^FATHER^HL70063||||||||||||||||||||||||||||||822546618^^^^SS -PV1||R|||||||||||||||A|||V02^19900607~H02^19900607 -RXA|0|1|19900607|19900607|08^HEPB-PEDIATRIC/ADOLESCENT^CVX^90744^HEPB-PEDATRIC/ADOLESCENT^CPT|.5|ML^^ISO+||03^HISTORICAL INFORMATION - FROM PARENT=S WRITTEN RECORD^NIP0001|^JONES^LISA|^^^CHILDREN=S HOSPITAL||5|MCG^^ISO+|MRK12345| 199206|MSD^MERCK^MVX -RXA|0|4|19910907|19910907|50^DTAP-HIB^CVX^90721^DTAP-HIB^CPT|.5|ML^^ISO+||00^NEW IMMUNIZATION RECORD^NIP0001|1234567890^SMITH^SALLY^S^^^^^^^^^VEI~1234567891 ^O=BRIAN^ROBERT^A^^DR^MD^^^^^^OEI|^^^CHILD HEALTHCARE CLINIC^^^^^101 MAIN STREET^^ BOSTON^MA||||W46932777|199208|PMC^PASTEUR MERIEUX CONNAUGHT^MVX|||CP|A| 19910907120030 -RXR|IM^INTRAMUSCULAR^HL70162|LA^LEFT ARM^HL70163 -RXA|0|1|19910907|19910907|03^MMR^CVX|.5|ML^^ISO+|||1234567890^SMITH^SALLY^S^^^^^^^^^VEI~1234567891^O=BRIAN^ROBERT^A^^DR^MD^^^^^^OEI|^^^CHILD HEALTHCARE CLINIC^^^^^101 MAIN STREET^^BOSTON^MA||||W2348796456|19920731|MSD^MERCK^MVX -RXR|SC^SUBCUTANEOUS^HL70162|LA^LEFT ARM^HL70163 -RXA|0|5|19950520|19950520|20^DTAP^CVX|.5|ML^^ISO+|||1234567891^O=BRIAN^ROBERT^A^^DR|^^^CHILD HEALTHCARE CLINIC^^^^^101 MAIN STREET^^BOSTON^MA||||W22532806|19950705|PMC^ PASTEUR MERIEUX CONNAUGHT^MVX -RXR|IM^INTRAMUSCULAR^HL70162|LA^LEFT ARM^HL70163 -NTE|PATIENT DEVELOPED HIGH FEVER APPROX 3 HRS AFTER VACCINE INJECTION -RXA|0|2|19950520|19950520|03^MMR^CVX|.5|ML^^ISO+|||1234567891^O=BRIAN^ROBERT^A^^DR|^^^CHILD HEALTHCARE CLINIC^^^^^101 MAIN STREET^^BOSTON^MA||||W2341234567|19950630| MSD^MERCK^MVX -RXR|SC^SUBCUTANEOUS^HL70162|LA^LEFT ARM^HL70163 diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/test/resources/unsolicited-vaccine-update-short b/nifi/nifi-commons/nifi-hl7-query-language/src/test/resources/unsolicited-vaccine-update-short deleted file mode 100644 index c3e7cf0ff2..0000000000 --- a/nifi/nifi-commons/nifi-hl7-query-language/src/test/resources/unsolicited-vaccine-update-short +++ /dev/null @@ -1,4 +0,0 @@ -MSH|^~\&|||||||VXU^V04|19970522MA53|P|2.3.1 -PID|||221345671^^^^SS||KENNEDY^JOHN^FITZGERALD^JR|BOUVIER^^^^^^M|19900607|M|||^^^^MA^^^BLD -NK1|1|KENNEDY^JACQUELINE^LEE|32^MOTHER^HL70063 -RXA|0|1|19900607|19900607|08^HEPB-PEDIATRIC/ADOLESCENT^CVX|.5|ML^^ISO+||||||||MRK12345||MSD^MERCK^MVX diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/test/resources/vaccine-query b/nifi/nifi-commons/nifi-hl7-query-language/src/test/resources/vaccine-query deleted file mode 100644 index 1bd47b285e..0000000000 --- a/nifi/nifi-commons/nifi-hl7-query-language/src/test/resources/vaccine-query +++ /dev/null @@ -1,3 +0,0 @@ -MSH|^~\&||GA0000||MA0000|199705221605||VXQ^V01|19970522GA40|T|2.3.1|||AL -QRD|199705221605|R|I|19970522GA05|||25^RD|^KENNEDY^JOHN^FITZGERALD^JR|VXI^VACCINE INFORMATION^HL70048|^SIIS -QRF|MA0000||||256946789~19900607~MA~MA99999999~88888888~KENNEDY^JACQUELINE^LEE~BOUVIER~898666725~KENNEDY^JOHN^FITZGERALD~822546618 diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/test/resources/vaers-message-long b/nifi/nifi-commons/nifi-hl7-query-language/src/test/resources/vaers-message-long deleted file mode 100644 index 888b04cc0f..0000000000 --- a/nifi/nifi-commons/nifi-hl7-query-language/src/test/resources/vaers-message-long +++ /dev/null @@ -1,60 +0,0 @@ -MSH|^~\&||GA0000||VAERS PROCESSOR|20010331605||ORU^R01|20010422GA03|T|2.3.1|||AL| -PID|||1234^^^^SR~1234-12^^^^LR~00725^^^^MR||Doe^John^Fitzgerald^JR^^^L||20001007|M||2106-3^White^HL70005|123 Peachtree St^APT 3B^Atlanta^GA^30210^^M^^GA067||(678) 555-1212^^PRN| -NK1|1|Jones^Jane^Lee^^RN|VAB^Vaccine administered by (Name)^HL70063| -NK1|2|Jones^Jane^Lee^^RN|FVP^Form completed by (Name)-Vaccine provider^HL70063|101 Main Street^^Atlanta^GA^38765^^O^^GA121||(404) 554-9097^^WPN| -ORC|CN|||||||||||1234567^Welby^Marcus^J^Jr^Dr.^MD^L|||||||||Peachtree Clinic|101 Main Street^^Atlanta^GA^38765^^O^^GA121|(404) 554-9097^^WPN|101 Main Street^^Atlanta^GA^38765^^O^^GA121| -OBR|1|||^CDC VAERS-1 (FDA) Report|||20010316| -OBX|1|NM|21612-7^Reported Patient Age^LN||05|mo^month^ANSI| -OBX|1|TS|30947-6^Date form completed^LN||20010316| -OBX|2|FT|30948-4^Vaccination adverse events and treatment, if any^LN|1|fever of 106F, with vomiting, seizures, persistent crying lasting over 3 hours, loss of appetite| -OBX|3|CE|30949-2^Vaccination adverse event outcome^LN|1|E^required emergency room/doctor visit^NIP005| -OBX|4|CE|30949-2^Vaccination adverse event outcome^LN|1|H^required hospitalization^NIP005| -OBX|5|NM|30950-0^Number of days hospitalized due to vaccination adverse event^LN|1|02|d^day^ANSI| -OBX|6|CE|30951-8^Patient recovered^LN||Y^Yes^ HL70239| -OBX|7|TS|30952-6^Date of vaccination^LN||20010216| -OBX|8|TS|30953-4^Adverse event onset date and time^LN||200102180900| -OBX|9|FT|30954-2^Relevant diagnostic tests/lab data^LN||Electrolytes, CBC, Blood culture| -OBR|2|||30955-9^All vaccines given on date listed in #10^LN| -OBX|1|CE30955-9&30956-7^Vaccine type^LN|1|08^HepB-Adolescent/pediatric^CVX| -OBX|2|CE|30955-9&30957-5^Manufacturer^LN|1|MSD^Merck^MVX| -OBX|3|ST|30955-9&30959-1^Lot number^LN|1|MRK12345| -OBX|4|CE|30955-9&30958-3^ Route^LN|1|IM^Intramuscular ^HL70162| -OBX|5|CE|30955-9&31034-2^Site^LN|1|LA^Left arm^ HL70163| -OBX|6|NM|30955-9&30960-9^Number of previous doses^LN|1|01I -OBX|7|CE|CE|30955-9&30956-7^Vaccine type^LN|2|50^DTaP-Hib^CVX| -OBX|8|CE|30955-9&30957-5^ Manufacturer^LN|2|WAL^Wyeth_Ayerst^MVX| -OBX|9|ST|30955-9&30959-1^Lot number^LN|2|W46932777| -OBX|10|CE|30955-9&30958-3^ Route^LN|2|IM^Intramuscular^HL70162| -OBX|11|CE|30955-9&31034-2^Site^LN|2|LA^Left arm^HL70163| -OBX|12|NM|30955-9&30960-9^Number of previous doses^LN|2|01| -OBR|3|||30961-7^Any other vaccinations within 4 weeks prior to the date listed in #10| -OBX|1|CE|30961-7&30956-7^Vaccine type^LN|1|10^IPV^CVX| -OBX|2|CE|30961-7&30957-5^Manufacturer^LN|1|PMC^Aventis Pasteur ^MVX| -OBX|3|ST|30961-7&30959-1^Lot number^LN|1|PMC123456| -OBX|4|CE|30961-7&30958-3^Route^LN|1|SC^Subcutaneaous^HL70162| -OBX|5|CE|30961-7&31034-2^Site^LN|1|LA^Left arm^HL70163| -OBX|6|NM|30961-7&30960-9^Number of previous doses^LN|1|01| -OBX|7|TS|30961-7&31035-9^date given^LN|1|20001216| -OBX|8|CE|30962-^Vaccinated at^LN||PVT^Private doctor�s office/hospital^NIP009| -OBX|9|CE|30963-3^Vaccine purchased with^LN||PBF^Public funds^NIP008| -OBX|10|FT|30964-1^Other medications^LN||None| -OBX|11|FT|30965-8^Illness at time of vaccination (specify)^LN||None| -OBX|12|FT|30966-6^Pre-existing physician diagnosed allergies, birth defects, medical conditions^LN||Past conditions convulsions| -OBX|13|CE|30967-4^Was adverse event reported previously^LN||N^no^NIP009| -OBR|4||30968-2^Adverse event following prior vaccination in patient^LN| -OBX|1|TX|30968-2&30971-6^Adverse event^LN||None| -OBR|5||30969-0^Adverse event following prior vaccination in brother^LN| -OBX|1|TX||30969-0&30971-6^Adverse event^LN||vomiting, fever, otitis media| -OBX|2|NM||30969-0&30972-4^Onset age^LN||04|mo^month^ANSI| -OBX|3|CE||30969-0&30956-7^Vaccine Type ^LN||10^IPV^CVX| -OBX|4|NM||30969-0&30973-2^Dose number in series^LN||02| -OBR|6|||30970-8^Adverse event following prior vaccination in sister^LN| -OBX|1|TX|30970-8&30971-6^Adverse event^LN||None| -OBR|7||^For children 5 and under| -OBX|1|NM|8339-4^Body weight at birth^LN||82|oz^ounces^ANSI| -OBX|2|NM|30974-0^Number of brothers and sisters^LN||2| -OBR|8|||^Only for reports submitted by manufacturer/immunization project| -OBX|1|ST|30975-7^Mfr./Imm. Proj. report no.^LN||12345678| -OBX|2|TS|30976-5^Date received by manufacturer/immunization project^LN||12345678| -OBX|3|CE|30977-3^15 day report^LN||N^No^HL70136| -OBX|4|CE|30978-1^Report type^LN||IN^Initial^NIP010| diff --git a/nifi/nifi-nar-bundles/nifi-hl7-bundle/nifi-hl7-processors/pom.xml b/nifi/nifi-nar-bundles/nifi-hl7-bundle/nifi-hl7-processors/pom.xml index 2a0c90905b..5f29cd8d27 100644 --- a/nifi/nifi-nar-bundles/nifi-hl7-bundle/nifi-hl7-processors/pom.xml +++ b/nifi/nifi-nar-bundles/nifi-hl7-bundle/nifi-hl7-processors/pom.xml @@ -25,6 +25,20 @@ nifi-hl7-processors jar + + + + org.apache.rat + apache-rat-plugin + + + src/test/resources/hypoglycemia.hl7 + + + + + + org.apache.nifi diff --git a/nifi/nifi-nar-bundles/nifi-hl7-bundle/nifi-hl7-processors/src/test/java/org/apache/nifi/processors/hl7/TestExtractHL7Attributes.java b/nifi/nifi-nar-bundles/nifi-hl7-bundle/nifi-hl7-processors/src/test/java/org/apache/nifi/processors/hl7/TestExtractHL7Attributes.java index f56628811e..c1568105b8 100644 --- a/nifi/nifi-nar-bundles/nifi-hl7-bundle/nifi-hl7-processors/src/test/java/org/apache/nifi/processors/hl7/TestExtractHL7Attributes.java +++ b/nifi/nifi-nar-bundles/nifi-hl7-bundle/nifi-hl7-processors/src/test/java/org/apache/nifi/processors/hl7/TestExtractHL7Attributes.java @@ -34,7 +34,7 @@ public class TestExtractHL7Attributes { public void testExtract() throws IOException { System.setProperty("org.slf4j.simpleLogger.log.org.apache.nifi", "DEBUG"); final TestRunner runner = TestRunners.newTestRunner(ExtractHL7Attributes.class); - runner.enqueue(Paths.get("src/test/resources/1.hl7")); + runner.enqueue(Paths.get("src/test/resources/hypoglycemia.hl7")); runner.run(); runner.assertAllFlowFilesTransferred(ExtractHL7Attributes.REL_SUCCESS, 1); diff --git a/nifi/nifi-nar-bundles/nifi-hl7-bundle/nifi-hl7-processors/src/test/resources/1.hl7 b/nifi/nifi-nar-bundles/nifi-hl7-bundle/nifi-hl7-processors/src/test/resources/1.hl7 deleted file mode 100644 index bf2b8a581d..0000000000 --- a/nifi/nifi-nar-bundles/nifi-hl7-bundle/nifi-hl7-processors/src/test/resources/1.hl7 +++ /dev/null @@ -1,16 +0,0 @@ -MSH|^~`&|ECG REPORTING|ROCHESTER|ERIS|ROCHESTER|20110621050440||ORU^R01|20110621050440|P|2.1 -PID|||999999999||TEST^PATIENT||18450101|F -OBR|||211088491|0^ADULT^ROCHECG|||20110620170631|||||||||M999999^^^^^^^RACFID||||||20110621060232||EC|F|||||||M999999^LASTNAME MD^FIRSTNAME^^^^^RACFID -OBX||ST|93000.2^VENTRICULAR RATE EKG/MIN^CPT4|1|52|/SEC -OBX||ST|93000.4^PR INTERVAL(MSEC)^CPT4|2|208|MSEC -OBX||ST|93000.5^QRS - INTERVAL(MSEC)^CPT4|3|88|MSEC -OBX||ST|93000.6^QT - INTERVAL(MSEC)^CPT4|4|466|MSEC -OBX||ST|93000&PTL^PHYSICAL TEST LOCATION^CPT4|5|STMA -OBX||ST|93000&PTR^PHYSICAL TEST ROOM^CPT4|6|04254 -OBX||CE|93000.17^^CPT4|7|21&101^Sinus bradycardia`T`with 1st degree A-V block^MEIECG -OBX||CE|93000.17^^CPT4|8|1687^Otherwise normal ECG^MEIECG -OBX||CE|93000&CMP^^CPT4|9|1301^When compared with ECG of^MEIECG -OBX||TS|93000&CMD^EKG COMPARISON DATE^CPT4|10|201106171659 -OBX||CE|93000&CMP^^CPT4|11|1305^No significant change was found^MEIECG -OBX||TX|93000.48^EKG COMMENT^CPT4|12|9917^LASTNAME MD^FIRSTNAME -OBX||FT|93000^ECG 12-LEAD^CPT4|13|{\rtf1\ansi \deff1\deflang1033\ {\fonttbl{\f1\fmodern\fcharset0 Courier;}{\f2\fmodern\fcharset0 Courier;}} \pard\plain \f1\fs18\par 20Jun2011 17:06\par VENTRICULAR RATE 52\par Sinus bradycardia with 1st degree A-V block\par Otherwise normal ECG\par When compared with ECG of 17-JUN-2011 16:59,\par No significant change was found\par 47507`S`'LASTNAME MD`S`'FIRSTNAME \par } \ No newline at end of file diff --git a/nifi/nifi-nar-bundles/nifi-hl7-bundle/nifi-hl7-processors/src/test/resources/hypoglycemia.hl7 b/nifi/nifi-nar-bundles/nifi-hl7-bundle/nifi-hl7-processors/src/test/resources/hypoglycemia.hl7 index 02e8967296..aaff9fc7e7 100644 --- a/nifi/nifi-nar-bundles/nifi-hl7-bundle/nifi-hl7-processors/src/test/resources/hypoglycemia.hl7 +++ b/nifi/nifi-nar-bundles/nifi-hl7-bundle/nifi-hl7-processors/src/test/resources/hypoglycemia.hl7 @@ -1,5 +1,5 @@ -MSH|^~\&|CERNER||PriorityHealth||||ORU^R01|Q479004375T431430612|P|2.3| -PID|||001677980||SMITH^CURTIS||19680219|M||||||||||929645156318|123456789| -PD1||||1234567890^LAST^FIRST^M^^^^^NPI| -OBR|1|341856649^HNAM_ORDERID|000002006326002362|648088^Basic Metabolic Panel|||20061122151600|||||||||1620^Hooker^Robert^L||||||20061122154733|||F|||||||||||20061122140000| -OBX|1|NM|GLU^Glucose Lvl|59|mg/dL|65-99^65^99|L|||F|||20061122154733| \ No newline at end of file +MSH|^~\&|XXXXXXXX||HealthProvider||||ORU^R01|Q1111111111111111111|P|2.3| +PID|||111111111||SMITH^JOHN||19700100|M||||||||||111111111111|123456789| +PD1||||1234567890^LAST^FIRST^M^^^^^NPI| +OBR|1|341856649^HNAM_ORDERID|000000000000000000|648088^Basic Metabolic Panel|||20150101000000|||||||||1620^Johnson^Corey^A||||||20150101000000|||F|||||||||||20150101000000| +OBX|1|NM|GLU^Glucose Lvl|59|mg/dL|65-99^65^99|L|||F|||20150102000000| \ No newline at end of file