source: FOIAVistA/trunk/r/MENTAL_HEALTH-YS-RUCL-YI-YT/YTAPI1.m@ 1625

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

initial load of FOIAVistA 6/30/08 version

File size: 2.0 KB
Line 
1YTAPI1 ;ALB/ASF PSYCH TEST API ;10/3/02 15:27
2 ;;5.01;MENTAL HEALTH;**53,71,76,77**;Dec 30, 1994
3SAVEIT(YSDATA,YS) ;
4 N N,N2,N4,YSAA,I,II,DFN,YSCODE,YSADATE,YSSCALE,YSBED,YSEND
5 D PARSE^YTAPI(.YS)
6 IF YSSTAFF'?1N.N!('$D(^VA(200,YSSTAFF))) S YSDATA(1)="[ERROR]",YSDATA(2)="no appro staff" Q
7 I '$D(^YTT(601,"B",YSCODE)) S YSDATA(1)="[ERROR]",YSDATA(2)="INCORRECT TEST CODE" Q
8 S (YSTEST,YSET)=$O(^YTT(601,"B",YSCODE,0))
9 S YSTYPE=$P(^YTT(601,YSTEST,0),U,9),YSINUM=$P(^YTT(601,YSTEST,0),U,11) ;ASF 11/5/01
10 I YSTYPE'="T"&(YSTYPE'="I") S YSDATA(1)="ERROR",YSDATA(2)="not a test or int" Q
11 D CK:YSCODE'="MCMI2",CKMCMI:YSCODE="MCMI2" Q:YSCK
12 ;;
13 S ^YTD(601.2,DFN,0)=DFN
14 S ^YTD(601.2,DFN,1,0)="^601.21PA^"
15 S ^YTD(601.2,DFN,1,YSET,0)=YSET
16 S ^YTD(601.2,DFN,1,YSET,1,0)="^601.22DA^"
17 S ^YTD(601.2,DFN,1,YSET,1,DT,0)=DT_U_IO_U_YSSTAFF_U_DUZ_U_U_2_U_DUZ(2)_U_YSADATE
18 S ^YTD(601.2,DFN,1,YSET,1,DT,1)=R1
19 S:$L(R2) ^YTD(601.2,DFN,1,YSET,1,DT,2)=R2
20 S:$L(R3) ^YTD(601.2,DFN,1,YSET,1,DT,3)=R3
21 S DIK="^YTD(601.2,",DA=DFN,DA(1)=YSET,DA(2)=DT D IX^DIK K DIK ;ASF 10/02/02
22 S YSDATA(1)="[DATA]",YSDATA(2)="saved ok"
23 S YSENT=YSET,YSDFN=DFN D ENKIL^YTFILE K YSENT,YSDFN ;ASF 6/29/01
24 Q
25CKMCMI ;check mcmi2
26 S YSCK=0
27 I $L(R1)'=177 S YSDATA(1)="[ERROR]",YSDATA(2)="MCMI2 BAD #",YSCK=1 Q
28 I $L(R1,"T")+$L(R1,"F")+$L(R1,"X")'=178 S YSCK=1 Q
29 Q
30CK ;
31 S YSCK=0
32 S X=YSINUM\200+1
33 I $E(@("R"_X),YSINUM#200)=""!($E(@("R"_X),YSINUM#200+1)'="") S YSDATA(1)="[ERROR]",YSDATA(2)="wrong # of respon",YSCK=1 Q
34 F I=1:1:$L(R1) S X=$E(R1,I) D CK1 Q:YSCK
35 Q:'$L(R2)
36 F I=201:1:$L(R2) S X=$E(R2,I) D CK1 Q:YSCK
37 Q:'$L(R3)
38 F I=401:1:$L(R3) S X=$E(R1,3) D CK1 Q:YSCK
39 Q
40CK1 ;
41 I YSTYPE="TEST" D
42 . I $P($G(^YTT(601,YSTEST,"Q",I,0)),U,2)'="" S C=$P(^YTT(601,YSTEST,"Q",I,0),U,2)
43 . I C'[X S YSCK=1,YSDATA(1)="[ERROR]",YSDATA(2)="test responses dont check"
44 I YSTYPE="INTERVIEW" D
45 . Q:X=" "
46 . S YSQT=$P($G(^YTT(601,YSTEST,"Q",1)),U,1)
47 . I +YSQT=3 S YSQT=$E("123456789",1,$P(YSQT,",",2))
48 . E S YSQT="YN"
49 . S:YSQT'[X YSCK=1,YSDATA(1)="[ERROR]",YSDATA(2)="interview resp dont check"
50 Q
Note: See TracBrowser for help on using the repository browser.