source: WorldVistAEHR/trunk/r/MENTAL_HEALTH-YS-RUCL-YI-YT/YTCHECK.m@ 1147

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

initial load of WorldVistAEHR

File size: 4.7 KB
Line 
1YTCHECK ;SLC/TGA-CHECK PSYCH TEST/INTERVIEW DATA BASE ; 7/10/89 11:21 ;03/11/94 12:13
2 ;;5.01;MENTAL HEALTH;;Dec 30, 1994
3 ;
4 ; Called from the top by MENU option YSMCHK
5 ;
6S ;
7 W @IOF,?22,"Check Psych Test/Interview Data Base"
8 W !!,"You may use this option for individual patients or all patients."
9 W !,"If you use it for individual patients, you may elect to delete any unknown"
10 W !,"tests/interviews and any tests/interviews with erroneous response sets."
11 W !,"If you use it for all patients, you may elect to print a list of errors or"
12 W !,"automatically delete all unknown patients, unknown instruments, and all"
13 W !,"instruments with erroneous response sets."
14 W !!,"THIS OPTION SHOULD NOT BE RUN WHILE TESTS/INTERVIEWS ARE UNDERWAY!",$C(7)
151 ;
16 W !!,"Check (I)ndividual patient or (A)ll patients: I// " R A:DTIME S YSTOUT='$T,YSUOUT=A["^" G:YSTOUT!YSUOUT KIL S A=$TR($E(A),"ia","IA")
17 I "AI"'[A W:A'["?" " ?",$C(7) W !,"Type 'I' to check an individial patient's data or 'A' to check all patients." G 1
18 S YSN=$S("I"[A:0,1:1),YSD=0,YSE=0 G:'YSN 2
19 R !!,"(L)ist or (D)elete errors: ",A:DTIME S YSTOUT='$T,YSUOUT=A["^" G:YSTOUT!YSUOUT KIL S A=$TR($E(A),"ld","LD") I "LD"'[A W:A'["?" " ?",$C(7) G S
20 S YSD=$S("D"[A:1,1:0)
212 ;
22 R !!,"Shall I list discontinued session(s)" S %=0 D YN^DICN G:"^"[%Y KIL I %Y["?" W !?4,"Answer 'YES' or 'NO'." G 2
23 S YSL=$S(%=1:1,1:0) I 'YSN D ^YSLRP G:YSDFN<1 KIL S P=YSDFN D P1 G:YSDFN<1 KIL D INC:YSL,T G END
24 S %ZIS="Q" D ^%ZIS G:POP KIL I $D(IO("Q")) S ZTRTN="ENP^YTCHECK",ZTSAVE("YS*")="",ZTDESC="YS DB CHECK" D ^%ZTLOAD G KIL
25ENP ;
26 U IO D HD S (P,P(0))=0,P1="" F S P=$O(^YTD(601.2,P)) Q:'P D P,T
27 I YSL S P=0 F S P=$O(^YTD(601.4,P)) Q:'P S YSNM=$S($D(^DPT(P,0)):$P(^(0),U),1:"UNKNOWN PATIENT") D INC
28 G END
29CK ;
30 ;G:'$D(^YTT(601,T,0)) CK1 S L=$P(^(0),U,11),L1=0 S:$G(^YTD(601.2,P,1,T,1,D,99))="MMPIR" L=1132 L +^YTD(601.2,P) S I=0 F S I=$O(^YTD(601.2,P,1,T,1,D,I)) Q:'I!(I>50) S L1=L1+$L(^(I))
31 G:'$D(^YTT(601,T,0)) CK1
32 S L=$P(^(0),U,11),L1=0
33 L +^YTD(601.2,P) S I=0
34 F S I=$O(^YTD(601.2,P,1,T,1,D,I)) Q:'I!(I>50) S L1=L1+$L(^(I))
35 ;
36 ; 3/10/94 LJA Changes made to display MMPR correctly, when it is...
37 L -^YTD(601.2,P)
38 I L'=L1,$$MMPIRCK(L,L1) D
39 . S YSE=YSE+1 D:IOST?1"P".E HD:$Y+9>IOSL W ! W:YSN YSNM
40 . W ?31,"Response set length error on " S X=$P(^YTT(601,T,0),U)
41 . ; Following line commented on 4/29/94. LJA.
42 . ;I L'=L1,T=60,$G(^YTD(601.2,+P,1,+T,1,+D,99))="MMPIR" S X="MMPIR"
43 . ;
44 . W X,!?31,"expected ",L," got ",L1
45 . D DEL:'YSN
46 . I YSD K ^YTD(601.2,+P,1,+T,1,+D) W " - DELETED" QUIT
47CK1 ;
48 S D(0)=D(0)+1,C=D
49 QUIT
50 ;
51MMPIRCK(L,L1) ; If MMPIR and EXP=566 and GOT=1132... OK
52 ; This code "compensates" for MMPR longs (MMPIs) entered before
53 ; YS*5*17. These entries still have 1132 (2 x 566) responses...
54 ;
55 ; Report 1 (ok) if anything other than an MMPIR
56 I $G(^YTD(601.2,+P,1,+T,1,+D,99))'="MMPIR" QUIT 1 ;->
57 ;
58 ; This is an MMPIR...
59 QUIT '(L=566&(L1=1132))
60 ;
61D ;
62 S D(0)=0 I '$D(^YTT(601,T,0)) S YSE=YSE+1 D:IOST?1"P".E HD:$Y+8>IOSL W ! W:YSN YSNM W ?31,"Unknown Instrument" S X="instrument" D DEL:'YSN I YSD K ^YTD(601.2,P,1,T),^YTD(601.2,P,1,"B",T) W " - DELETED" Q
63 S D=0 F S D=$O(^YTD(601.2,P,1,T,1,D)) Q:'D D CK
64 I D(0)>0 L +^YTD(601.2,P,1,T,1,0) S ^YTD(601.2,P,1,T,1,0)="^601.22DA^"_C_"^"_D(0) L -^YTD(601.2,P,1,T,1,0) S:'$D(^YTD(601.2,P,1,"B",T,T)) ^(T)="" Q
65 K ^YTD(601.2,P,1,T) Q
66T ;
67 S (T(0),T)=0 F S T=$O(^YTD(601.2,P,1,T)) Q:'T D D I D(0)>0 S T(0)=T(0)+1,H=T S:'$D(^YTD(601.2,P,1,"B",T,T)) ^(T)=""
68 I T(0)>0 L +^YTD(601.2,P,1,0) S ^YTD(601.2,P,1,0)="^601.21PA^"_H_"^"_T(0) L -^YTD(601.2,P,1,0) S:YSN P(0)=P(0)+1,P1=P
69 I T(0)>0 S I=0 F S I=$O(^YTD(601.2,P,1,"B",I)) Q:'I K:'$D(^YTD(601.2,P,1,I,0)) ^YTD(601.2,P,1,"B",I)
70 Q:T(0) K ^YTD(601.2,P),^YTD(601.2,"B",P) Q:YSN L +^YTD(601.2,0) S X=$P(^YTD(601.2,0),U,4),X=X-1 S:X<1 X=0 S $P(^(0),U,4)=X L -^YTD(601.2,0) Q
71P ;
72 S YSDFN=P,YSNM=$S($D(^DPT(P,0)):$P(^(0),U),1:"Unknown Patient") I '$D(^DPT(P,0)) S YSE=YSE+1 D:IOST?1"P".E HD:$Y+8>IOSL W !,"Unknown patient found" I YSD K ^YTD(601.2,P),^YTD(601.2,"B",P,P) W " - DELETED" Q
73P1 I 'YSN,'$D(^YTD(601.2,P)),'$D(^YTD(601.4,P)) W !,"No data on this patient." S YSDFN=-1 Q
74 S:'$D(^YTD(601.2,"B",P,P)) ^(P)="" Q
75 Q
76INC ;
77 I $O(^YTD(601.4,P,1,0))>0 D:IOST?1"P".E HD:$Y+8>IOSL W ! W:YSN YSNM W ?31,"Incomplete Session(s) found"
78 Q
79DEL ;
80 S YSD=0 W !!,"DELETE this ",X,"? " R A:DTIME S YSTOUT='$T,YSUOUT=A["^" Q:YSTOUT!YSUOUT S A=$E(A) I "YyNn"'[A W:A'["?" " ?",$C(7) G DEL
81 S:"Yy"[A YSD=1 Q
82END ;
83 I YSN L +^YTD(601.2,0) S $P(^YTD(601.2,0),U,3)=P1,$P(^(0),U,4)=P(0) L -^YTD(601.2,0) D KILL^%ZTLOAD
84 W:'YSE !!,"NO ERRORS FOUND" W ! D:YSN ^%ZISC
85KIL ;
86 K %,%ZIS,%Y,A,C,D,H,I,IO("Q"),L,L1,P,P1,T,X,Y,YSAGE,YSD,YSDFN,YSDOB,YSL,YSN,YSNM,YSSEX,YSSSN,ZTSK Q
87HD ;
88 W @IOF,!,"Test/Interview Database Report on " S Y=DT D DT^YTAUDIT W !! Q
Note: See TracBrowser for help on using the repository browser.