| 1 | HLEMT ;ALB/CJM-HL7 - APIs for Monitor Event Types ;02/04/2004 | 
|---|
| 2 | ;;1.6;HEALTH LEVEL SEVEN;**109**;Oct 13, 1995 | 
|---|
| 3 | ; | 
|---|
| 4 | FIND(CODE,PACKAGE) ; | 
|---|
| 5 | ;Description: Finds an event type. | 
|---|
| 6 | ;Input: | 
|---|
| 7 | ;  CODE - the string value of the code | 
|---|
| 8 | ;  PACKAGE - the name (.01 field) of a package in the Package file representing the application that dessigned/created the code. | 
|---|
| 9 | ;Output: | 
|---|
| 10 | ;   Function returns 0 on failue, ien of event type if successful | 
|---|
| 11 | ; | 
|---|
| 12 | Q:('$L($G(CODE))) 0 | 
|---|
| 13 | Q:'$L($G(PACKAGE)) 0 | 
|---|
| 14 | Q $O(^HLEV(776.3,"C",CODE,PACKAGE,0)) | 
|---|
| 15 | ; | 
|---|
| 16 | GET(IEN,ETYPE) ; | 
|---|
| 17 | ;Description - given the ien, it returns an array containing the event type | 
|---|
| 18 | ;Input: | 
|---|
| 19 | ;  IEN - ien of event type | 
|---|
| 20 | ;  ETYPE - pass by reference, the return array | 
|---|
| 21 | ;Output: | 
|---|
| 22 | ;  function returns 0 on failure, 1 on success | 
|---|
| 23 | ;  ETYPE( | 
|---|
| 24 | ;   "ACTION" - <tag>^<routine> - the routine that should be executed when events of this type occur | 
|---|
| 25 | ;   "BRIEF" - brief description | 
|---|
| 26 | ;   "CODE" - the event type code | 
|---|
| 27 | ;   "CATEGORY" - category of event type, set of codes | 
|---|
| 28 | ;   "CONGLOMERATE" - 1=events of this type are conglomerated, 0 is no | 
|---|
| 29 | ;   "CONGLOMERATE","HOURS" - #of hours to conglomerate | 
|---|
| 30 | ;   "DAYS" - # of days to keep events of this type before purge | 
|---|
| 31 | ;   "IEN" -the ien | 
|---|
| 32 | ;   "PACKAGE" - ien of the package that assigned the code | 
|---|
| 33 | ;   "REVIEW" - 0=not required, 1=required, 2=only if action fails | 
|---|
| 34 | ;   "SITES",<IEN of DOMAIN>=<screen if defined> - list of domains to send server messages | 
|---|
| 35 | ;   "URGENT" - 0=NO,1=YES,2=IF ACTIONFAILS | 
|---|
| 36 | ; | 
|---|
| 37 | Q:'$G(IEN) 0 | 
|---|
| 38 | N NODE,I,DOMAIN | 
|---|
| 39 | K ETYPE | 
|---|
| 40 | S ETYPE("IEN")=IEN | 
|---|
| 41 | S NODE=$G(^HLEV(776.3,IEN,0)) | 
|---|
| 42 | Q:'$L(NODE) 0 | 
|---|
| 43 | S ETYPE("CODE")=$P(NODE,"^") | 
|---|
| 44 | S ETYPE("PACKAGE")=$P(NODE,"^",2) | 
|---|
| 45 | S ETYPE("CATEGORY")=$P(NODE,"^",3) | 
|---|
| 46 | S ETYPE("URGENT")=$P(NODE,"^",4) | 
|---|
| 47 | S ETYPE("CONGLOMERATE")=$P(NODE,"^",5) | 
|---|
| 48 | S ETYPE("CONGLOMERATE","HOURS")=$P(NODE,"^",6) | 
|---|
| 49 | S ETYPE("REVIEW")=$P(NODE,"^",7) | 
|---|
| 50 | S ETYPE("DAYS")=$P(NODE,"^",9) | 
|---|
| 51 | S ETYPE("ACTIVE")=$P(NODE,"^",10) | 
|---|
| 52 | S ETYPE("ACTION")=$E($G(^HLEV(776.3,IEN,1)),1,20) | 
|---|
| 53 | S I=0 F  S I=$O(^HLEV(776.3,IEN,2,I)) Q:'I  S DOMAIN=+$G(^HLEV(776.3,IEN,2,I,0)) S:DOMAIN ETYPE("DOMAIN",DOMAIN)=$G(^HLEV(776.3,IEN,2,I,1)) | 
|---|
| 54 | S ETYPE("BRIEF")=$P($G(^HLEV(776.3,IEN,4)),"^") | 
|---|
| 55 | Q 1 | 
|---|
| 56 | ; | 
|---|
| 57 | CODE(EVENT) ; | 
|---|
| 58 | ;Given the event type ien, returns the code | 
|---|
| 59 | Q:'$G(EVENT) "" | 
|---|
| 60 | Q $P($G(^HLEV(776.3,EVENT,0)),"^") | 
|---|
| 61 | BRIEF(EVENT) ; | 
|---|
| 62 | ;Given the event type ien, returns the brief desciption | 
|---|
| 63 | Q:'$G(EVENT) "" | 
|---|
| 64 | Q $P($G(^HLEV(776.3,EVENT,4)),"^") | 
|---|
| 65 | ; | 
|---|
| 66 | CONG(TYPE) ; | 
|---|
| 67 | ;Input: | 
|---|
| 68 | ;  TYPE - ien of event type | 
|---|
| 69 | ;Output: | 
|---|
| 70 | ;  function returns 0 if this is NOT a conglomerated event, 1 if it is | 
|---|
| 71 | ; | 
|---|
| 72 | Q $P($G(^HLEV(776.3,TYPE,0)),"^",5) | 
|---|
| 73 | HOURS(TYPE) ; | 
|---|
| 74 | ;Description - returns #of hours overwhich to congregate events of this type | 
|---|
| 75 | ;Input: | 
|---|
| 76 | ;  TYPE - ien of event type | 
|---|
| 77 | ;Output: | 
|---|
| 78 | ;  function returns # of hours, 0 if not to be conglomerated | 
|---|
| 79 | ; | 
|---|
| 80 | Q:'$$CONG(TYPE) 0 | 
|---|
| 81 | Q $P($G(^HLEV(776.3,TYPE,0)),"^",6) | 
|---|