source: WorldVistAEHR/trunk/r/CLINICAL_MONITORING_SYSTEM-QAM/QAMSANE.m@ 1556

Last change on this file since 1556 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 3.2 KB
Line 
1QAMSANE ;HISC/DAD-MONITOR SANITY CHECK ;9/10/93 14:35
2 ;;1.0;Clinical Monitoring System;;09/13/1993
3 ;
4 ;Checks monitor with internal entry number QAMD0 for correctness.
5 ;If the monitor is ok Y is returned as 1. If The monitor is not
6 ;ok Y will be returned as -1. Error messages will also be printed
7 ;if QAMMSGS contains an 'E'. Warning messages will also be printed
8 ;if QAMMSGS contains a 'W' (in addition to an 'E'). No messsages
9 ;will be printed if QAMMSGS is undefined or null.
10 ;
11 ; Required variables
12 ; QAMD0 = IEN of a monitor (file #743)
13 ; QAMMSGS = <UNDEF> or Null - Do not display any messages
14 ; E - Display error messages only
15 ; EW - Display error and warning messages
16 ;
17 S Y=1 G EXIT:$D(QAMD0)[0,EXIT:QAMD0'?1N.N
18 N QAMZERO,QAMONE,QAMTHRES,QAMERR,X
19 S QAMZERO=$G(^QA(743,QAMD0,0)),QAMONE=$G(^QA(743,QAMD0,1))
20 S QAMTHRES=$P(QAMONE,"^",3),QAMMSGS=$G(QAMMSGS)
21 I QAMMSGS["E" W !!,"Checking monitor..."
22 I QAMZERO="" S QAMERR=1 D ERROR G DONE ; Monitor exists
23 I $P(QAMZERO,"^",4)="" S QAMERR=2 D ERROR ; Auto enroll monitor
24 I $O(^QA(743,QAMD0,"COND",0))'>0 S QAMERR=3 D ERROR ; No conditions
25 I $G(^QA(743,QAMD0,"REL"))="" S QAMERR=4 D ERROR ; Fall out relate
26 I $G(^QA(743,QAMD0,"SMP"))="",$O(^QA(743,QAMD0,"COND","AS",0)) S QAMERR=5 D ERROR ; Sample size relate
27 I $P(QAMONE,"^",15)'>0 S QAMERR=6 D ERROR ; Cond for date of event
28 I $P(QAMONE,"^")'>0 S QAMERR=7 D ERROR ; Time frame
29 I QAMTHRES="" S QAMERR=8 D ERROR ; Threshold
30 I QAMTHRES["%",$P(QAMONE,"^",2)'>0 S QAMERR=9 D ERROR ; Minimum sample
31 I QAMTHRES,QAMTHRES'["%",$P(QAMONE,"^",2)>QAMTHRES S QAMERR=10 D ERROR ; Pre-threshold alert level > threshold
32 I QAMTHRES["%",$P(QAMONE,"^",4)="" S QAMERR=11 D ERROR ; Hi/Lo percent
33 I $P(QAMONE,"^",9),$G(^QA(743,QAMD0,"WSR"))="" S QAMERR=12 D ERROR ; Print daily worksheets and no worksheet routine
34 I $P(QAMONE,"^",10,12)["1",$P(QAMONE,"^",13)'>0 S QAMERR=13 D ERROR ; Bulletin mail group
35 I $P(QAMONE,"^",6)'>0 S QAMERR=14 D ERROR ; Start date
36 I $P(QAMONE,"^",6),$P(QAMONE,"^",7),$P(QAMONE,"^",7)<$P(QAMONE,"^",6) S QAMERR=15 D ERROR ; End date < Start date
37 I $P(QAMONE,"^",5)'>0 S QAMERR=16 D ERROR ; On/Off switch
38DONE I QAMMSGS["E" W !,$S(Y=1:"No errors found.",Y=-1:"All errors must be corrected in order for this monitor to run !!",1:""),!
39EXIT K QAMMSGS
40 Q
41ERROR ; *** Set error flag (Y=-1) optionally write error message
42 S X=$P($T(ERRMSG+QAMERR),";;",2)
43 S:X Y=-1 Q:QAMMSGS="" Q:(X'>0)&(QAMMSGS'["W")
44 W !?2,$S(X:"*ERROR*",1:"Warning"),": ",$P(X,"^",2)
45 Q
46ERRMSG ;;$S(1:"*ERROR*",0:"Warning") ^ Monitor error and warning messages
47 ;;1^Monitor not found
48 ;;1^AUTO ENROLL MONITOR not specified
49 ;;1^No CONDITIONS specified
50 ;;1^FALL OUT RELATIONSHIP not specified
51 ;;0^SAMPLE RELATIONSHIP not specified
52 ;;1^CONDITION FOR DATE OF EVENT not specified
53 ;;0^TIME FRAME not specified
54 ;;0^THRESHOLD not specified
55 ;;0^MINIMUM SAMPLE not specified
56 ;;0^PRE-THRESHOLD ALERT LEVEL greater than THRESHOLD
57 ;;0^HI/LO PERCENT not specified
58 ;;0^PRINT DAILY WORKSHEETS selected, WORKSHEET ROUTINE not specified
59 ;;0^BULLETIN MAIL GROUP not specified
60 ;;1^START DATE not specified
61 ;;1^END DATE is less than the START DATE
62 ;;0^ON/OFF SWITCH is turned off
Note: See TracBrowser for help on using the repository browser.