Merge branch 'develop' into NIFI-25

This commit is contained in:
Mark Payne 2015-04-11 14:38:51 -04:00
commit e8134870fd
26 changed files with 294 additions and 379 deletions

View File

@ -45,10 +45,9 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Condition; import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.locks.ReentrantLock;
import java.util.logging.FileHandler; import java.util.logging.ConsoleHandler;
import java.util.logging.Handler; import java.util.logging.Handler;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.SimpleFormatter;
/** /**
@ -93,82 +92,16 @@ public class RunNiFi {
private final java.util.logging.Logger logger; private final java.util.logging.Logger logger;
public RunNiFi(final File bootstrapConfigFile, final boolean verbose) throws IOException { public RunNiFi(final File bootstrapConfigFile, final boolean verbose) {
this.bootstrapConfigFile = bootstrapConfigFile; this.bootstrapConfigFile = bootstrapConfigFile;
logger = java.util.logging.Logger.getLogger("Bootstrap"); logger = java.util.logging.Logger.getLogger("Bootstrap");
final Properties bootstrapProps = new Properties();
try (final InputStream configIn = new FileInputStream(bootstrapConfigFile)) {
bootstrapProps.load(configIn);
}
String logFilename = bootstrapProps.getProperty("bootstrap.log.file");
if ( logFilename == null ) {
logFilename = "./logs/bootstrap.log";
}
File logFile = new File(logFilename);
if ( !logFile.isAbsolute() ) {
final File workDir = getDefaultWorkingDirectory();
logFile = new File(workDir, logFilename);
}
final File logFileDir = logFile.getParentFile();
final Handler fileHandler;
if ( logFileDir.exists() || logFileDir.mkdirs() ) {
final int maxSize = getIntProp(bootstrapProps, "bootstrap.log.max.bytes", 1024 * 1024 * 10); // 10 MB
final int numFiles = getIntProp(bootstrapProps, "bootstrap.log.count", 10);
fileHandler = new FileHandler(logFile.getAbsolutePath(), maxSize, numFiles, true);
fileHandler.setFormatter(new SimpleFormatter());
logger.addHandler(fileHandler);
} else {
fileHandler = null;
logger.severe("Could not create log file directory " + logFileDir + ". Will not log bootstrap info to file or redirect NiFi standard out to file");
}
if ( verbose ) { if ( verbose ) {
logger.info("Enabling Verbose Output"); logger.info("Enabling Verbose Output");
logger.setLevel(Level.FINE); logger.setLevel(Level.FINE);
final Handler handler = new ConsoleHandler();
for ( final Handler handler : logger.getHandlers() ) { handler.setLevel(Level.FINE);
handler.setLevel(Level.FINE); logger.addHandler(handler);
}
}
}
private File getLogFile() throws IOException {
final Properties bootstrapProps = new Properties();
try (final InputStream configIn = new FileInputStream(bootstrapConfigFile)) {
bootstrapProps.load(configIn);
}
String logFilename = bootstrapProps.getProperty("bootstrap.log.file");
if ( logFilename == null ) {
logFilename = "./logs/bootstrap.log";
}
File logFile = new File(logFilename);
if ( !logFile.isAbsolute() ) {
final File workDir = getDefaultWorkingDirectory();
logFile = new File(workDir, logFilename);
}
return logFile;
}
private static int getIntProp(final Properties properties, final String name, final int defaultValue) {
String propVal = properties.getProperty(name);
if ( propVal == null || propVal.trim().isEmpty() ) {
return defaultValue;
}
try {
return Integer.parseInt(propVal.trim());
} catch (final NumberFormatException nfe) {
throw new NumberFormatException("Expected bootstrap property '" + name + "' to be an integer but found value: " + propVal);
} }
} }
@ -648,35 +581,6 @@ public class RunNiFi {
} }
} }
private void redirectOutput(final Process process) {
redirectStreamToLogs(process.getInputStream());
redirectStreamToLogs(process.getErrorStream());
}
private void redirectStreamToLogs(final InputStream in) {
final Thread t = new Thread(new Runnable() {
@Override
public void run() {
try (final BufferedReader reader = new BufferedReader(new InputStreamReader(in))) {
String line;
while ((line = reader.readLine()) != null) {
logger.info(line);
}
} catch (IOException e) {
logger.warning("Failed to read output of NiFi console: " + e);
}
}
});
t.setDaemon(true);
t.start();
}
private File getDefaultWorkingDirectory() {
final File bootstrapConfigAbsoluteFile = bootstrapConfigFile.getAbsoluteFile();
final File binDir = bootstrapConfigAbsoluteFile.getParentFile();
return binDir.getParentFile();
}
@SuppressWarnings({ "rawtypes", "unchecked" }) @SuppressWarnings({ "rawtypes", "unchecked" })
public void start(final boolean monitor) throws IOException, InterruptedException { public void start(final boolean monitor) throws IOException, InterruptedException {
final Integer port = getCurrentPort(); final Integer port = getCurrentPort();
@ -686,6 +590,7 @@ public class RunNiFi {
} }
final ProcessBuilder builder = new ProcessBuilder(); final ProcessBuilder builder = new ProcessBuilder();
if ( !bootstrapConfigFile.exists() ) { if ( !bootstrapConfigFile.exists() ) {
throw new FileNotFoundException(bootstrapConfigFile.getAbsolutePath()); throw new FileNotFoundException(bootstrapConfigFile.getAbsolutePath());
} }
@ -699,16 +604,17 @@ public class RunNiFi {
props.putAll( (Map) properties ); props.putAll( (Map) properties );
final String specifiedWorkingDir = props.get("working.dir"); final String specifiedWorkingDir = props.get("working.dir");
final File workingDir = getDefaultWorkingDirectory(); if ( specifiedWorkingDir != null ) {
if ( specifiedWorkingDir == null ) {
builder.directory(workingDir);
} else {
builder.directory(new File(specifiedWorkingDir)); builder.directory(new File(specifiedWorkingDir));
} }
final File logDir = getLogFile().getParentFile(); final File bootstrapConfigAbsoluteFile = bootstrapConfigFile.getAbsoluteFile();
builder.redirectError(new File(logDir, "nifi.err")); final File binDir = bootstrapConfigAbsoluteFile.getParentFile();
builder.redirectOutput(new File(logDir, "nifi.out")); final File workingDir = binDir.getParentFile();
if ( specifiedWorkingDir == null ) {
builder.directory(workingDir);
}
final String libFilename = replaceNull(props.get("lib.dir"), "./lib").trim(); final String libFilename = replaceNull(props.get("lib.dir"), "./lib").trim();
File libDir = getFile(libFilename, workingDir); File libDir = getFile(libFilename, workingDir);
@ -832,15 +738,14 @@ public class RunNiFi {
try { try {
gracefulShutdownSeconds = Integer.parseInt(gracefulShutdown); gracefulShutdownSeconds = Integer.parseInt(gracefulShutdown);
} catch (final NumberFormatException nfe) { } catch (final NumberFormatException nfe) {
throw new NumberFormatException("The '" + GRACEFUL_SHUTDOWN_PROP + "' property in Bootstrap Config File " + bootstrapConfigFile.getAbsolutePath() + " has an invalid value. Must be a non-negative integer"); throw new NumberFormatException("The '" + GRACEFUL_SHUTDOWN_PROP + "' property in Bootstrap Config File " + bootstrapConfigAbsoluteFile.getAbsolutePath() + " has an invalid value. Must be a non-negative integer");
} }
if ( gracefulShutdownSeconds < 0 ) { if ( gracefulShutdownSeconds < 0 ) {
throw new NumberFormatException("The '" + GRACEFUL_SHUTDOWN_PROP + "' property in Bootstrap Config File " + bootstrapConfigFile.getAbsolutePath() + " has an invalid value. Must be a non-negative integer"); throw new NumberFormatException("The '" + GRACEFUL_SHUTDOWN_PROP + "' property in Bootstrap Config File " + bootstrapConfigAbsoluteFile.getAbsolutePath() + " has an invalid value. Must be a non-negative integer");
} }
Process process = builder.start(); Process process = builder.start();
redirectOutput(process);
Long pid = getPid(process); Long pid = getPid(process);
if ( pid != null ) { if ( pid != null ) {
nifiPid = pid; nifiPid = pid;
@ -871,7 +776,6 @@ public class RunNiFi {
if (autoRestartNiFi) { if (autoRestartNiFi) {
logger.warning("Apache NiFi appears to have died. Restarting..."); logger.warning("Apache NiFi appears to have died. Restarting...");
process = builder.start(); process = builder.start();
redirectOutput(process);
pid = getPid(process); pid = getPid(process);
if ( pid != null ) { if ( pid != null ) {
@ -898,7 +802,6 @@ public class RunNiFi {
} }
} else { } else {
final Process process = builder.start(); final Process process = builder.start();
redirectOutput(process);
final Long pid = getPid(process); final Long pid = getPid(process);
if ( pid != null ) { if ( pid != null ) {

View File

@ -48,6 +48,16 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>org.apache.rat</groupId>
<artifactId>apache-rat-plugin</artifactId>
<configuration>
<excludes>
<exclude>src/test/resources/hypoglycemia</exclude>
<exclude>src/test/resources/hyperglycemia</exclude>
</excludes>
</configuration>
</plugin>
</plugins> </plugins>
</build> </build>

View File

@ -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; lexer grammar HL7QueryLexer;
@header { @header {

View File

@ -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; parser grammar HL7QueryParser;
options { options {

View File

@ -23,7 +23,6 @@ import static org.junit.Assert.assertTrue;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
@ -32,8 +31,6 @@ import java.util.Map;
import org.apache.nifi.hl7.hapi.HapiMessage; import org.apache.nifi.hl7.hapi.HapiMessage;
import org.apache.nifi.hl7.model.HL7Field; import org.apache.nifi.hl7.model.HL7Field;
import org.apache.nifi.hl7.model.HL7Message; 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 org.junit.Test;
import ca.uhn.hl7v2.DefaultHapiContext; import ca.uhn.hl7v2.DefaultHapiContext;
@ -99,7 +96,7 @@ public class TestHL7Query {
@Test @Test
public void testSelectMessage() throws HL7Exception, IOException { public void testSelectMessage() throws HL7Exception, IOException {
final HL7Query query = HL7Query.compile("SELECT MESSAGE"); 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); final QueryResult result = query.evaluate(msg);
assertTrue(result.isMatch()); assertTrue(result.isMatch());
final List<String> labels = result.getLabels(); final List<String> labels = result.getLabels();
@ -114,7 +111,7 @@ public class TestHL7Query {
@SuppressWarnings({ "unchecked", "rawtypes" }) @SuppressWarnings({ "unchecked", "rawtypes" })
public void testSelectField() throws HL7Exception, IOException { public void testSelectField() throws HL7Exception, IOException {
final HL7Query query = HL7Query.compile("SELECT PID.5"); 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); final QueryResult result = query.evaluate(msg);
assertTrue(result.isMatch()); assertTrue(result.isMatch());
final List<String> labels = result.getLabels(); final List<String> labels = result.getLabels();
@ -126,7 +123,7 @@ public class TestHL7Query {
final List<Object> nameList = (List) names; final List<Object> nameList = (List) names;
assertEquals(1, nameList.size()); assertEquals(1, nameList.size());
final HL7Field nameField = (HL7Field) nameList.get(0); final HL7Field nameField = (HL7Field) nameList.get(0);
assertEquals("KENNEDY^JOHN^FITZGERALD^JR", nameField.getValue()); assertEquals("SMITH^JOHN", nameField.getValue());
} }
@Test @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 String query = "DECLARE result AS REQUIRED OBX SELECT result WHERE result.7 != 'N' AND result.1 = 1";
final HL7Query hl7Query = HL7Query.compile(query); final HL7Query hl7Query = HL7Query.compile(query);
final QueryResult result = hl7Query.evaluate(createMessage(new File("src/test/resources/vaers-message-long"))); final QueryResult result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia")));
assertFalse( result.isMatch() ); assertTrue( result.isMatch() );
} }
@ -224,18 +221,6 @@ public class TestHL7Query {
QueryResult result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); QueryResult result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia")));
assertTrue( result.isMatch() ); assertTrue( result.isMatch() );
assertEquals(1, result.getHitCount()); 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 @Test
@ -288,10 +273,6 @@ public class TestHL7Query {
hl7Query = HL7Query.compile("SELECT MESSAGE WHERE OBX IS NULL"); hl7Query = HL7Query.compile("SELECT MESSAGE WHERE OBX IS NULL");
result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia")));
assertFalse( result.isMatch() ); 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"); hl7Query = HL7Query.compile("SELECT MESSAGE WHERE OBX NOT NULL");
result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia")));
assertTrue( result.isMatch() ); 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 { private HL7Message createMessage(final File file) throws HL7Exception, IOException {
@ -334,19 +307,4 @@ public class TestHL7Query {
return new HapiMessage(message); 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);
}
} }

View File

@ -1,5 +1,5 @@
MSH|^~\&|CERNER||PriorityHealth||||ORU^R01|Q479004375T431430612|P|2.3| MSH|^~\&|XXXXXXXX||HealthProvider||||ORU^R01|Q1111111111111111111|P|2.3|
PID|||001677980||SMITH^CURTIS||19680219|M||||||||||929645156318|123456789| PID|||111111111||SMITH^JOHN||19700100|M||||||||||111111111111|123456789|
PD1||||1234567890^LAST^FIRST^M^^^^^NPI| PD1||||1234567890^LAST^FIRST^M^^^^^NPI|
OBR|1|341856649^HNAM_ORDERID|000002006326002362|648088^Basic Metabolic Panel|||20061122151600|||||||||1620^Hooker^Robert^L||||||20061122154733|||F|||||||||||20061122140000| 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|||20061122154733| OBX|1|NM|GLU^Glucose Lvl|159|mg/dL|65-99^65^99|H|||F|||20150102000000|

View File

@ -1,5 +1,5 @@
MSH|^~\&|CERNER||PriorityHealth||||ORU^R01|Q479004375T431430612|P|2.3| MSH|^~\&|XXXXXXXX||HealthProvider||||ORU^R01|Q1111111111111111111|P|2.3|
PID|||001677980||SMITH^CURTIS||19680219|M||||||||||929645156318|123456789| PID|||111111111||SMITH^JOHN||19700100|M||||||||||111111111111|123456789|
PD1||||1234567890^LAST^FIRST^M^^^^^NPI| PD1||||1234567890^LAST^FIRST^M^^^^^NPI|
OBR|1|341856649^HNAM_ORDERID|000002006326002362|648088^Basic Metabolic Panel|||20061122151600|||||||||1620^Hooker^Robert^L||||||20061122154733|||F|||||||||||20061122140000| 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|||20061122154733| OBX|1|NM|GLU^Glucose Lvl|59|mg/dL|65-99^65^99|L|||F|||20150102000000|

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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<6F>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|

View File

@ -107,6 +107,6 @@ public class ContinuallyRunConnectableTask implements Callable<Boolean> {
return true; return true;
} }
return true; return false; // do not yield
} }
} }

View File

@ -21,11 +21,6 @@ java=java
# Username to use when running NiFi. This value will be ignored on Windows. # Username to use when running NiFi. This value will be ignored on Windows.
run.as= run.as=
# Bootstrap logger info
bootstrap.log.file=logs/nifi-bootstrap.log
bootstrap.log.max.bytes=10485760
bootstrap.log.count=10
# Configure where NiFi's lib and conf directories live # Configure where NiFi's lib and conf directories live
lib.dir=./lib lib.dir=./lib
conf.dir=./conf conf.dir=./conf

View File

@ -29,4 +29,4 @@
<input type="hidden" name="caption" value="" /> <input type="hidden" name="caption" value="" />
</form> </form>
</div> </div>
<div id="trancation-message">Showing up to 1.5kb</div> <div id="truncation-message">Showing up to 1.5 KB</div>

View File

@ -87,7 +87,7 @@
padding: 2px; padding: 2px;
} }
#trancation-message { #truncation-message {
position: absolute; position: absolute;
left: 100px; left: 100px;
bottom: 35px; bottom: 35px;

View File

@ -1015,7 +1015,7 @@
// ensure the configured value is referencing a valid service // ensure the configured value is referencing a valid service
$.each(propertyDescriptor.allowableValues, function (_, allowableValue) { $.each(propertyDescriptor.allowableValues, function (_, allowableValue) {
if (allowableValue.value === dataContext.value) { if (allowableValue.value === dataContext.value) {
markup = '<img src="images/iconGoTo.png" title="Go To" class="go-to-service pointer" style="margin-top: 2px" />'; markup += '<img src="images/iconGoTo.png" title="Go To" class="go-to-service pointer" style="margin-top: 2px" />';
return false; return false;
} }
}); });
@ -1023,7 +1023,7 @@
// allow user defined properties to be removed // allow user defined properties to be removed
if (options.readOnly !== true && dataContext.type === 'userDefined') { if (options.readOnly !== true && dataContext.type === 'userDefined') {
markup = '<img src="images/iconDelete.png" title="Delete" class="delete-property pointer" style="margin-top: 2px" />'; markup += '<img src="images/iconDelete.png" title="Delete" class="delete-property pointer" style="margin-top: 2px" />';
} }
return markup; return markup;
@ -1375,37 +1375,59 @@
var add = function () { var add = function () {
var propertyName = $.trim(newPropertyNameField.val()); var propertyName = $.trim(newPropertyNameField.val());
// ensure the property name and value is specified // ensure the property name is specified
if (propertyName !== '') { if (propertyName !== '') {
// load the descriptor and add the property var propertyGrid = table.data('gridInstance');
options.descriptorDeferred(propertyName).done(function(response) { var propertyData = propertyGrid.getData();
var descriptor = response.propertyDescriptor;
// store the descriptor for use later // ensure the property name is unique
var descriptors = table.data('descriptors'); var existingPropertyId = null;
if (!nf.Common.isUndefined(descriptors)) { $.each(propertyData.getItems(), function (_, item) {
descriptors[descriptor.name] = descriptor; if (propertyName === item.property) {
existingPropertyId = item.id;
return false;
} }
});
// add a row for the new property if (existingPropertyId === null) {
var propertyGrid = table.data('gridInstance'); // load the descriptor and add the property
var propertyData = propertyGrid.getData(); options.descriptorDeferred(propertyName).done(function(response) {
var id = propertyData.getLength(); var descriptor = response.propertyDescriptor;
propertyData.addItem({
id: id, // store the descriptor for use later
hidden: false, var descriptors = table.data('descriptors');
property: propertyName, if (!nf.Common.isUndefined(descriptors)) {
displayName: propertyName, descriptors[descriptor.name] = descriptor;
previousValue: null, }
value: null,
type: 'userDefined' // add a row for the new property
var id = propertyData.getLength();
propertyData.addItem({
id: id,
hidden: false,
property: propertyName,
displayName: propertyName,
previousValue: null,
value: null,
type: 'userDefined'
});
// select the new properties row
var row = propertyData.getRowById(id);
propertyGrid.setActiveCell(row, propertyGrid.getColumnIndex('value'));
propertyGrid.editActiveCell();
});
} else {
nf.Dialog.showOkDialog({
dialogContent: 'A property with this name already exists.',
overlayBackground: false
}); });
// select the new properties row // select the existing properties row
var row = propertyData.getRowById(id); var row = propertyData.getRowById(existingPropertyId);
propertyGrid.setSelectedRows([row]); propertyGrid.setSelectedRows([row]);
propertyGrid.scrollRowIntoView(row); propertyGrid.scrollRowIntoView(row);
}); }
} else { } else {
nf.Dialog.showOkDialog({ nf.Dialog.showOkDialog({
dialogContent: 'Property name must be specified.', dialogContent: 'Property name must be specified.',

View File

@ -311,8 +311,9 @@ nf.CanvasUtils = (function () {
// if we've reached the last line, use single line ellipsis // if we've reached the last line, use single line ellipsis
if (++i >= lineCount) { if (++i >= lineCount) {
// restore the current word // get the remainder using the current word and
var remainder = [word].concat(words); // reversing whats left
var remainder = [word].concat(words.reverse());
// apply ellipsis to the last line // apply ellipsis to the last line
nf.CanvasUtils.ellipsis(tspan, remainder.join(' ')); nf.CanvasUtils.ellipsis(tspan, remainder.join(' '));
@ -322,7 +323,7 @@ nf.CanvasUtils = (function () {
} else { } else {
tspan.text(word); tspan.text(word);
// other prep the line for the next iteration // prep the line for the next iteration
line = [word]; line = [word];
} }
} }

View File

@ -529,9 +529,11 @@ nf.Canvas = (function () {
}; };
// listen for browser resize events to reset the graph size // listen for browser resize events to reset the graph size
$(window).on('resize', function () { $(window).on('resize', function (e) {
updateGraphSize(); if (e.target === window) {
nf.Settings.resetTableSize(); updateGraphSize();
nf.Settings.resetTableSize();
}
}).on('keydown', function (evt) { }).on('keydown', function (evt) {
var isCtrl = evt.ctrlKey || evt.metaKey; var isCtrl = evt.ctrlKey || evt.metaKey;

View File

@ -25,6 +25,20 @@
<artifactId>nifi-hl7-processors</artifactId> <artifactId>nifi-hl7-processors</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>
<build>
<plugins>
<plugin>
<groupId>org.apache.rat</groupId>
<artifactId>apache-rat-plugin</artifactId>
<configuration>
<excludes>
<exclude>src/test/resources/hypoglycemia.hl7</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.apache.nifi</groupId> <groupId>org.apache.nifi</groupId>

View File

@ -34,7 +34,7 @@ public class TestExtractHL7Attributes {
public void testExtract() throws IOException { public void testExtract() throws IOException {
System.setProperty("org.slf4j.simpleLogger.log.org.apache.nifi", "DEBUG"); System.setProperty("org.slf4j.simpleLogger.log.org.apache.nifi", "DEBUG");
final TestRunner runner = TestRunners.newTestRunner(ExtractHL7Attributes.class); 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.run();
runner.assertAllFlowFilesTransferred(ExtractHL7Attributes.REL_SUCCESS, 1); runner.assertAllFlowFilesTransferred(ExtractHL7Attributes.REL_SUCCESS, 1);

View File

@ -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 }

View File

@ -1,5 +1,5 @@
MSH|^~\&|CERNER||PriorityHealth||||ORU^R01|Q479004375T431430612|P|2.3| MSH|^~\&|XXXXXXXX||HealthProvider||||ORU^R01|Q1111111111111111111|P|2.3|
PID|||001677980||SMITH^CURTIS||19680219|M||||||||||929645156318|123456789| PID|||111111111||SMITH^JOHN||19700100|M||||||||||111111111111|123456789|
PD1||||1234567890^LAST^FIRST^M^^^^^NPI| PD1||||1234567890^LAST^FIRST^M^^^^^NPI|
OBR|1|341856649^HNAM_ORDERID|000002006326002362|648088^Basic Metabolic Panel|||20061122151600|||||||||1620^Hooker^Robert^L||||||20061122154733|||F|||||||||||20061122140000| 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|||20061122154733| OBX|1|NM|GLU^Glucose Lvl|59|mg/dL|65-99^65^99|L|||F|||20150102000000|

View File

@ -92,7 +92,7 @@ public class YandexTranslate extends AbstractProcessor {
.name("Input Language") .name("Input Language")
.description("The language of incoming data") .description("The language of incoming data")
.required(true) .required(true)
.defaultValue("sp") .defaultValue("es")
.expressionLanguageSupported(true) .expressionLanguageSupported(true)
.addValidator(new LanguageNameValidator()) .addValidator(new LanguageNameValidator())
.build(); .build();
@ -213,6 +213,24 @@ public class YandexTranslate extends AbstractProcessor {
} }
} }
protected WebResource.Builder prepareResource(final String key, final List<String> text, final String sourceLanguage, final String destLanguage) {
WebResource webResource = client.resource(URL);
final MultivaluedMap<String, String> paramMap = new MultivaluedMapImpl();
paramMap.put("text", text);
paramMap.add("key", key);
paramMap.add("lang", sourceLanguage + "-" + destLanguage);
WebResource.Builder builder = webResource
.accept(MediaType.APPLICATION_JSON)
.type(MediaType.APPLICATION_FORM_URLENCODED);
builder = builder.entity(paramMap);
return builder;
}
@Override @Override
public void onTrigger(final ProcessContext context, final ProcessSession session) throws ProcessException { public void onTrigger(final ProcessContext context, final ProcessSession session) throws ProcessException {
FlowFile flowFile = session.get(); FlowFile flowFile = session.get();
@ -247,17 +265,7 @@ public class YandexTranslate extends AbstractProcessor {
textValues.add(content); textValues.add(content);
} }
WebResource webResource = client.resource(URL); final WebResource.Builder builder = prepareResource(key, textValues, sourceLanguage, targetLanguage);
final MultivaluedMap<String, String> paramMap = new MultivaluedMapImpl();
paramMap.put("text", textValues);
paramMap.add("key", key);
paramMap.add("lang", sourceLanguage + "-" + targetLanguage);
WebResource.Builder builder = webResource
.accept(MediaType.APPLICATION_JSON)
.type(MediaType.APPLICATION_FORM_URLENCODED);
builder = builder.entity(paramMap);
final ClientResponse response; final ClientResponse response;
try { try {

View File

@ -18,41 +18,100 @@ package org.apache.nifi.processors.yandex;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import java.io.File; import java.util.ArrayList;
import java.io.FileInputStream; import java.util.HashMap;
import java.io.IOException; import java.util.List;
import java.io.InputStream; import java.util.Map;
import java.util.Properties;
import org.apache.nifi.processors.yandex.YandexTranslate; import javax.ws.rs.core.Response.Status.Family;
import javax.ws.rs.core.Response.StatusType;
import org.apache.nifi.processors.yandex.model.Translation;
import org.apache.nifi.util.MockFlowFile; import org.apache.nifi.util.MockFlowFile;
import org.apache.nifi.util.TestRunner; import org.apache.nifi.util.TestRunner;
import org.apache.nifi.util.TestRunners; import org.apache.nifi.util.TestRunners;
import org.junit.Before; import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.api.client.WebResource;
import com.sun.jersey.api.client.WebResource.Builder;
@Ignore("For local testing only; requires local file to be populated with Yandex API Key")
public class TestYandexTranslate { public class TestYandexTranslate {
private TestRunner testRunner; private static final Map<String, String> translations = new HashMap<>();
private String apiKey;
@Before @BeforeClass
public void init() throws IOException { public static void setupTranslationMap() {
testRunner = TestRunners.newTestRunner(YandexTranslate.class); translations.put("bonjour", "hello");
translations.put("traduire", "translate");
translations.put("amusant", "fun");
translations.put("ordinateur", "computer");
}
final Properties properties = new Properties(); private TestRunner createTestRunner(final int statusCode) {
try (final InputStream in = new FileInputStream(new File("C:/dev/notes/yandex-info.txt"))) { return TestRunners.newTestRunner(new YandexTranslate() {
properties.load(in); @Override
} protected Builder prepareResource(final String key, final List<String> text, final String sourceLanguage, final String destLanguage) {
apiKey = properties.getProperty("api_key").trim(); final WebResource.Builder builder = Mockito.mock(WebResource.Builder.class);
Mockito.doAnswer(new Answer<ClientResponse>() {
@Override
public ClientResponse answer(final InvocationOnMock invocation) throws Throwable {
final ClientResponse response = Mockito.mock(ClientResponse.class);
final StatusType statusType = new StatusType() {
@Override
public int getStatusCode() {
return statusCode;
}
@Override
public String getReasonPhrase() {
return String.valueOf(statusCode);
}
@Override
public Family getFamily() {
return statusCode == 200 ? Family.SUCCESSFUL : Family.SERVER_ERROR;
}
};
Mockito.when(response.getStatus()).thenReturn(statusCode);
Mockito.when(response.getStatusInfo()).thenReturn(statusType);
if ( statusCode == 200 ) {
final Translation translation = new Translation();
translation.setCode(statusCode);
translation.setLang(destLanguage);
final List<String> translationList = new ArrayList<>();
for ( final String original : text ) {
final String translated = translations.get(original);
translationList.add(translated == null ? original : translated);
}
translation.setText(translationList);
Mockito.when(response.getEntity(Translation.class)).thenReturn(translation);
}
return response;
}
}).when(builder).post(ClientResponse.class);
return builder;
}
});
} }
@Test @Test
public void testTranslateContent() { public void testTranslateContent() {
testRunner.setProperty(YandexTranslate.KEY, apiKey); final TestRunner testRunner = createTestRunner(200);
testRunner.setProperty(YandexTranslate.KEY, "a");
testRunner.setProperty(YandexTranslate.SOURCE_LANGUAGE, "fr"); testRunner.setProperty(YandexTranslate.SOURCE_LANGUAGE, "fr");
testRunner.setProperty(YandexTranslate.TARGET_LANGUAGE, "en"); testRunner.setProperty(YandexTranslate.TARGET_LANGUAGE, "en");
testRunner.setProperty(YandexTranslate.TRANSLATE_CONTENT, "true"); testRunner.setProperty(YandexTranslate.TRANSLATE_CONTENT, "true");
@ -71,7 +130,9 @@ public class TestYandexTranslate {
@Test @Test
public void testTranslateSingleAttribute() { public void testTranslateSingleAttribute() {
testRunner.setProperty(YandexTranslate.KEY, apiKey); final TestRunner testRunner = createTestRunner(200);
testRunner.setProperty(YandexTranslate.KEY, "A");
testRunner.setProperty(YandexTranslate.SOURCE_LANGUAGE, "fr"); testRunner.setProperty(YandexTranslate.SOURCE_LANGUAGE, "fr");
testRunner.setProperty(YandexTranslate.TARGET_LANGUAGE, "en"); testRunner.setProperty(YandexTranslate.TARGET_LANGUAGE, "en");
testRunner.setProperty(YandexTranslate.TRANSLATE_CONTENT, "false"); testRunner.setProperty(YandexTranslate.TRANSLATE_CONTENT, "false");
@ -90,7 +151,9 @@ public class TestYandexTranslate {
@Test @Test
public void testTranslateMultipleAttributes() { public void testTranslateMultipleAttributes() {
testRunner.setProperty(YandexTranslate.KEY, apiKey); final TestRunner testRunner = createTestRunner(200);
testRunner.setProperty(YandexTranslate.KEY, "A");
testRunner.setProperty(YandexTranslate.SOURCE_LANGUAGE, "fr"); testRunner.setProperty(YandexTranslate.SOURCE_LANGUAGE, "fr");
testRunner.setProperty(YandexTranslate.TARGET_LANGUAGE, "en"); testRunner.setProperty(YandexTranslate.TARGET_LANGUAGE, "en");
testRunner.setProperty(YandexTranslate.TRANSLATE_CONTENT, "false"); testRunner.setProperty(YandexTranslate.TRANSLATE_CONTENT, "false");
@ -114,7 +177,9 @@ public class TestYandexTranslate {
@Test @Test
public void testTranslateContentAndMultipleAttributes() { public void testTranslateContentAndMultipleAttributes() {
testRunner.setProperty(YandexTranslate.KEY, apiKey); final TestRunner testRunner = createTestRunner(200);
testRunner.setProperty(YandexTranslate.KEY, "A");
testRunner.setProperty(YandexTranslate.SOURCE_LANGUAGE, "fr"); testRunner.setProperty(YandexTranslate.SOURCE_LANGUAGE, "fr");
testRunner.setProperty(YandexTranslate.TARGET_LANGUAGE, "en"); testRunner.setProperty(YandexTranslate.TARGET_LANGUAGE, "en");
testRunner.setProperty(YandexTranslate.TRANSLATE_CONTENT, "true"); testRunner.setProperty(YandexTranslate.TRANSLATE_CONTENT, "true");
@ -138,4 +203,24 @@ public class TestYandexTranslate {
out.assertAttributeEquals("nifi", "nifi"); out.assertAttributeEquals("nifi", "nifi");
} }
@Test
public void testFailureResponse() {
final TestRunner testRunner = createTestRunner(403);
testRunner.setProperty(YandexTranslate.KEY, "A");
testRunner.setProperty(YandexTranslate.SOURCE_LANGUAGE, "fr");
testRunner.setProperty(YandexTranslate.TARGET_LANGUAGE, "en");
testRunner.setProperty(YandexTranslate.TRANSLATE_CONTENT, "true");
testRunner.setProperty(YandexTranslate.CHARACTER_SET, "UTF-8");
testRunner.setProperty("hello", "bonjour");
testRunner.setProperty("translate", "traduire");
testRunner.setProperty("fun", "amusant");
testRunner.setProperty("nifi", "nifi");
testRunner.enqueue("ordinateur".getBytes());
testRunner.run();
testRunner.assertAllFlowFilesTransferred(YandexTranslate.REL_TRANSLATION_FAILED, 1);
}
} }

View File

@ -14,6 +14,9 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
/* global Slick */
$(document).ready(function () { $(document).ready(function () {
ua.editable = $('#attribute-updater-editable').text() === 'true'; ua.editable = $('#attribute-updater-editable').text() === 'true';
ua.init(); ua.init();
@ -43,10 +46,12 @@ var ua = {
var actionsGrid = ua.initActionsGrid(); var actionsGrid = ua.initActionsGrid();
// enable grid resizing // enable grid resizing
$(window).resize(function () { $(window).resize(function (e) {
conditionsGrid.resizeCanvas(); if (e.target === window) {
actionsGrid.resizeCanvas(); conditionsGrid.resizeCanvas();
ua.resizeSelectedRuleNameField(); actionsGrid.resizeCanvas();
ua.resizeSelectedRuleNameField();
}
}); });
// initialize the rule list // initialize the rule list