- HLEMT ;ALB/CJM-HL7 - APIs for Monitor Event Types ;02/04/2004
- ;;1.6;HEALTH LEVEL SEVEN;**109**;Oct 13, 1995
- ;
- FIND(CODE,PACKAGE) ;
- ;Description: Finds an event type.
- ;Input:
- ; CODE - the string value of the code
- ; PACKAGE - the name (.01 field) of a package in the Package file representing the application that dessigned/created the code.
- ;Output:
- ; Function returns 0 on failue, ien of event type if successful
- ;
- Q:('$L($G(CODE))) 0
- Q:'$L($G(PACKAGE)) 0
- Q $O(^HLEV(776.3,"C",CODE,PACKAGE,0))
- ;
- GET(IEN,ETYPE) ;
- ;Description - given the ien, it returns an array containing the event type
- ;Input:
- ; IEN - ien of event type
- ; ETYPE - pass by reference, the return array
- ;Output:
- ; function returns 0 on failure, 1 on success
- ; ETYPE(
- ; "ACTION" - <tag>^<routine> - the routine that should be executed when events of this type occur
- ; "BRIEF" - brief description
- ; "CODE" - the event type code
- ; "CATEGORY" - category of event type, set of codes
- ; "CONGLOMERATE" - 1=events of this type are conglomerated, 0 is no
- ; "CONGLOMERATE","HOURS" - #of hours to conglomerate
- ; "DAYS" - # of days to keep events of this type before purge
- ; "IEN" -the ien
- ; "PACKAGE" - ien of the package that assigned the code
- ; "REVIEW" - 0=not required, 1=required, 2=only if action fails
- ; "SITES",<IEN of DOMAIN>=<screen if defined> - list of domains to send server messages
- ; "URGENT" - 0=NO,1=YES,2=IF ACTIONFAILS
- ;
- Q:'$G(IEN) 0
- N NODE,I,DOMAIN
- K ETYPE
- S ETYPE("IEN")=IEN
- S NODE=$G(^HLEV(776.3,IEN,0))
- Q:'$L(NODE) 0
- S ETYPE("CODE")=$P(NODE,"^")
- S ETYPE("PACKAGE")=$P(NODE,"^",2)
- S ETYPE("CATEGORY")=$P(NODE,"^",3)
- S ETYPE("URGENT")=$P(NODE,"^",4)
- S ETYPE("CONGLOMERATE")=$P(NODE,"^",5)
- S ETYPE("CONGLOMERATE","HOURS")=$P(NODE,"^",6)
- S ETYPE("REVIEW")=$P(NODE,"^",7)
- S ETYPE("DAYS")=$P(NODE,"^",9)
- S ETYPE("ACTIVE")=$P(NODE,"^",10)
- S ETYPE("ACTION")=$E($G(^HLEV(776.3,IEN,1)),1,20)
- 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))
- S ETYPE("BRIEF")=$P($G(^HLEV(776.3,IEN,4)),"^")
- Q 1
- ;
- CODE(EVENT) ;
- ;Given the event type ien, returns the code
- Q:'$G(EVENT) ""
- Q $P($G(^HLEV(776.3,EVENT,0)),"^")
- BRIEF(EVENT) ;
- ;Given the event type ien, returns the brief desciption
- Q:'$G(EVENT) ""
- Q $P($G(^HLEV(776.3,EVENT,4)),"^")
- ;
- CONG(TYPE) ;
- ;Input:
- ; TYPE - ien of event type
- ;Output:
- ; function returns 0 if this is NOT a conglomerated event, 1 if it is
- ;
- Q $P($G(^HLEV(776.3,TYPE,0)),"^",5)
- HOURS(TYPE) ;
- ;Description - returns #of hours overwhich to congregate events of this type
- ;Input:
- ; TYPE - ien of event type
- ;Output:
- ; function returns # of hours, 0 if not to be conglomerated
- ;
- Q:'$$CONG(TYPE) 0
- Q $P($G(^HLEV(776.3,TYPE,0)),"^",6)
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HHLEMT 2894 printed Feb 18, 2025@23:24:02 Page 2
- HLEMT ;ALB/CJM-HL7 - APIs for Monitor Event Types ;02/04/2004
- +1 ;;1.6;HEALTH LEVEL SEVEN;**109**;Oct 13, 1995
- +2 ;
- FIND(CODE,PACKAGE) ;
- +1 ;Description: Finds an event type.
- +2 ;Input:
- +3 ; CODE - the string value of the code
- +4 ; PACKAGE - the name (.01 field) of a package in the Package file representing the application that dessigned/created the code.
- +5 ;Output:
- +6 ; Function returns 0 on failue, ien of event type if successful
- +7 ;
- +8 if ('$LENGTH($GET(CODE)))
- QUIT 0
- +9 if '$LENGTH($GET(PACKAGE))
- QUIT 0
- +10 QUIT $ORDER(^HLEV(776.3,"C",CODE,PACKAGE,0))
- +11 ;
- GET(IEN,ETYPE) ;
- +1 ;Description - given the ien, it returns an array containing the event type
- +2 ;Input:
- +3 ; IEN - ien of event type
- +4 ; ETYPE - pass by reference, the return array
- +5 ;Output:
- +6 ; function returns 0 on failure, 1 on success
- +7 ; ETYPE(
- +8 ; "ACTION" - <tag>^<routine> - the routine that should be executed when events of this type occur
- +9 ; "BRIEF" - brief description
- +10 ; "CODE" - the event type code
- +11 ; "CATEGORY" - category of event type, set of codes
- +12 ; "CONGLOMERATE" - 1=events of this type are conglomerated, 0 is no
- +13 ; "CONGLOMERATE","HOURS" - #of hours to conglomerate
- +14 ; "DAYS" - # of days to keep events of this type before purge
- +15 ; "IEN" -the ien
- +16 ; "PACKAGE" - ien of the package that assigned the code
- +17 ; "REVIEW" - 0=not required, 1=required, 2=only if action fails
- +18 ; "SITES",<IEN of DOMAIN>=<screen if defined> - list of domains to send server messages
- +19 ; "URGENT" - 0=NO,1=YES,2=IF ACTIONFAILS
- +20 ;
- +21 if '$GET(IEN)
- QUIT 0
- +22 NEW NODE,I,DOMAIN
- +23 KILL ETYPE
- +24 SET ETYPE("IEN")=IEN
- +25 SET NODE=$GET(^HLEV(776.3,IEN,0))
- +26 if '$LENGTH(NODE)
- QUIT 0
- +27 SET ETYPE("CODE")=$PIECE(NODE,"^")
- +28 SET ETYPE("PACKAGE")=$PIECE(NODE,"^",2)
- +29 SET ETYPE("CATEGORY")=$PIECE(NODE,"^",3)
- +30 SET ETYPE("URGENT")=$PIECE(NODE,"^",4)
- +31 SET ETYPE("CONGLOMERATE")=$PIECE(NODE,"^",5)
- +32 SET ETYPE("CONGLOMERATE","HOURS")=$PIECE(NODE,"^",6)
- +33 SET ETYPE("REVIEW")=$PIECE(NODE,"^",7)
- +34 SET ETYPE("DAYS")=$PIECE(NODE,"^",9)
- +35 SET ETYPE("ACTIVE")=$PIECE(NODE,"^",10)
- +36 SET ETYPE("ACTION")=$EXTRACT($GET(^HLEV(776.3,IEN,1)),1,20)
- +37 SET I=0
- FOR
- SET I=$ORDER(^HLEV(776.3,IEN,2,I))
- if 'I
- QUIT
- SET DOMAIN=+$GET(^HLEV(776.3,IEN,2,I,0))
- if DOMAIN
- SET ETYPE("DOMAIN",DOMAIN)=$GET(^HLEV(776.3,IEN,2,I,1))
- +38 SET ETYPE("BRIEF")=$PIECE($GET(^HLEV(776.3,IEN,4)),"^")
- +39 QUIT 1
- +40 ;
- CODE(EVENT) ;
- +1 ;Given the event type ien, returns the code
- +2 if '$GET(EVENT)
- QUIT ""
- +3 QUIT $PIECE($GET(^HLEV(776.3,EVENT,0)),"^")
- BRIEF(EVENT) ;
- +1 ;Given the event type ien, returns the brief desciption
- +2 if '$GET(EVENT)
- QUIT ""
- +3 QUIT $PIECE($GET(^HLEV(776.3,EVENT,4)),"^")
- +4 ;
- CONG(TYPE) ;
- +1 ;Input:
- +2 ; TYPE - ien of event type
- +3 ;Output:
- +4 ; function returns 0 if this is NOT a conglomerated event, 1 if it is
- +5 ;
- +6 QUIT $PIECE($GET(^HLEV(776.3,TYPE,0)),"^",5)
- HOURS(TYPE) ;
- +1 ;Description - returns #of hours overwhich to congregate events of this type
- +2 ;Input:
- +3 ; TYPE - ien of event type
- +4 ;Output:
- +5 ; function returns # of hours, 0 if not to be conglomerated
- +6 ;
- +7 if '$$CONG(TYPE)
- QUIT 0
- +8 QUIT $PIECE($GET(^HLEV(776.3,TYPE,0)),"^",6)