-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update plugins with custom error messages
- Loading branch information
1 parent
7fbdb50
commit 406506f
Showing
13 changed files
with
24,263 additions
and
874 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
91 changes: 91 additions & 0 deletions
91
src/main/java/gov/nist/hit/pcd/custom/ALERT_OBSERVATION_OBR.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
package gov.nist.hit.pcd.custom; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.HashSet; | ||
import java.util.Set; | ||
|
||
import hl7.v2.instance.Element; | ||
import hl7.v2.instance.Query; | ||
import hl7.v2.instance.Simple; | ||
import scala.collection.Iterator; | ||
import scala.collection.immutable.List; | ||
|
||
public class ALERT_OBSERVATION_OBR { | ||
|
||
public java.util.List<String> assertionWithCustomMessages(hl7.v2.instance.Element e) { | ||
java.util.List<String> messages = new ArrayList<String>(); | ||
// System.out.println("get in"); | ||
List<Element> OBXList = Query.query(e, "2[*].1[1]").get(); | ||
// System.out.println(OBXList); | ||
|
||
if (OBXList.size() >= 2) { | ||
String OBX3_1 = getSimpleValue(Query.queryAsSimple(OBXList.apply(0), "3[1].2[1]").get()); | ||
String OBX3_2 = getSimpleValue(Query.queryAsSimple(OBXList.apply(1), "3[1].2[1]").get()); | ||
// String OBX3_3 = getSimpleValue(Query.queryAsSimple(OBXList.apply(2), "3[1].2[1]").get()); | ||
|
||
if (!OBX3_1.matches(".*_MDS")) { | ||
messages.add("Missing Medical Device System (MDS) information"); | ||
return messages; | ||
} | ||
if (!OBX3_2.matches(".*_VMD")) { | ||
messages.add("Missing Virtual Medical Devices (VMD) information"); | ||
return messages; | ||
} | ||
// if (!OBX3_3.matches(".*_CHAN")) { | ||
// return false; | ||
// } | ||
|
||
} | ||
|
||
// | ||
// Iterator<Element> it = OBXList.iterator(); | ||
// while (it.hasNext()) { | ||
// Element next = it.next(); | ||
// List<Simple> OBX3_1List = Query.queryAsSimple(next, "1[1]").get(); | ||
// List<Simple> OBX3_2List = Query.queryAsSimple(next, "2[1]").get(); | ||
// List<Simple> OBX3_3List = Query.queryAsSimple(next, "3[1]").get(); | ||
// | ||
// String OBX3_1 = OBX3_1List.size() > 0 ? OBX3_1List.apply(0).value().raw() : | ||
// ""; | ||
// String OBX3_2 = OBX3_2List.size() > 0 ? OBX3_2List.apply(0).value().raw() : | ||
// ""; | ||
// String OBX3_3 = OBX3_3List.size() > 0 ? OBX3_3List.apply(0).value().raw() : | ||
// ""; | ||
// | ||
// // ignore 0 code terms or MDCX terms | ||
// if (OBX3_1.equals("0") || OBX3_2.startsWith("MDCX_")) { | ||
// return true; | ||
// } | ||
// | ||
// | ||
// if (OBX3_3.equals("MDC")) { | ||
// ResourceHandler rh = new ResourceHandler(); | ||
// if (rh.dupletIsValid(OBX3_1, OBX3_2)) { | ||
// return true; | ||
// }else { | ||
// return false; | ||
// } | ||
// | ||
// }else { | ||
// return true; | ||
// } | ||
// | ||
// } | ||
|
||
return messages; | ||
|
||
} | ||
|
||
private String getSimpleValue(List<Simple> simpleElementList) { | ||
if (simpleElementList.size() > 1) { | ||
throw new IllegalArgumentException("Invalid List size : " + simpleElementList.size()); | ||
} | ||
if (simpleElementList.size() == 0) { | ||
return null; | ||
} | ||
// only get first element | ||
return simpleElementList.apply(0).value().raw(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.