VistA-FOIAVistA/r/KERNEL-XU-A4A7-USC-XG-XLF-X.../XUSNPIUT.m

97 lines
3.5 KiB
Mathematica

XUSNPIUT ;JLI/FO-OAK - UNIT TEST ROUTINE FOR NPI WORK ;5/12/06 08:54
;;8.0;KERNEL;**420**;Jul 10, 1995;Build 20
I $T(EN^XTMUNIT)'="" D EN^XTMUNIT("XUSNPIUT")
Q
;
ALIGNRGT ;
D CHKEQ^XTMUNIT($$ALIGNRGT^XUSNPIED("TEXT1",10)," TEXT1","INCORRECT RETURN VALUE")
D CHKEQ^XTMUNIT($$ALIGNRGT^XUSNPIED("AA AA",6)," AA AA","INCORRECT RETURN VALUE")
Q
;
NEEDSNPI ;
N OLDVALUE,NEWVALUE,XUFDA,IENS
S IENS=DUZ_","
S OLDVALUE=$$GET1^DIQ(200,IENS,41.98)
K XUFDA S XUFDA(200,IENS,41.98)="@" D FILE^DIE("","XUFDA")
D CHKEQ^XTMUNIT($$NEEDSNPI^XUSNPIED(DUZ),0,"INCORRECT OR NO DATA")
;
K XUFDA S XUFDA(200,IENS,41.98)="N" D FILE^DIE("","XUFDA")
D CHKEQ^XTMUNIT($$NEEDSNPI^XUSNPIED(DUZ),1,"INCORRECT ON NEEDS")
;
K XUFDA S XUFDA(200,IENS,41.98)="E" D FILE^DIE("","XUFDA")
D CHKEQ^XTMUNIT($$NEEDSNPI^XUSNPIED(DUZ),0,"INCORRECT ON EXEMPT")
;
K XUFDA S XUFDA(200,IENS,41.98)="D" D FILE^DIE("","XUFDA")
D CHKEQ^XTMUNIT($$NEEDSNPI^XUSNPIED(DUZ),0,"INCORRECT ON DONE")
;
K XUFDA S XUFDA(200,IENS,41.98)=$S(OLDVALUE'="":OLDVALUE,1:"@")
Q
;
HASNPI ;
N OLDVALUE,NEWVALUE,XUFDA,IENS
S IENS=DUZ_","
S OLDVALUE=$$GET1^DIQ(200,IENS,41.98)
K XUFDA S XUFDA(200,IENS,41.98)="@" D FILE^DIE("","XUFDA")
D CHKEQ^XTMUNIT($$HASNPI^XUSNPIED(DUZ),0,"INCORRECT ON NO DATA")
;
K XUFDA S XUFDA(200,IENS,41.98)="N" D FILE^DIE("","XUFDA")
D CHKEQ^XTMUNIT($$HASNPI^XUSNPIED(DUZ),0,"INCORRECT ON NEEDS")
;
K XUFDA S XUFDA(200,IENS,41.98)="E" D FILE^DIE("","XUFDA")
D CHKEQ^XTMUNIT($$HASNPI^XUSNPIED(DUZ),0,"INCORRECT ON EXEMPT")
;
K XUFDA S XUFDA(200,IENS,41.98)="D" D FILE^DIE("","XUFDA")
D CHKEQ^XTMUNIT($$HASNPI^XUSNPIED(DUZ),1,"INCORRECT ON DONE")
;
K XUFDA S XUFDA(200,IENS,41.98)=$S(OLDVALUE'="":$E(OLDVALUE),1:"@")
Q
;
GETNPI ;
N I,VALUE
F I=0:0 S I=$O(^VA(200,I)) Q:I'>0 I $G(^VA(200,I,"NPI"))'="" Q
I I'>0 D FAIL^XTMUNIT("NO VALID DATA AVAILABLE") Q
S VALUE=$$GET1^DIQ(200,I_",",41.99)
D CHKEQ^XTMUNIT($$GETNPI^XUSNPIED(I),VALUE,"INCORRECT VALUE RETURNED")
Q
;
NPISTATS ;
N OLDVALUE,NEWVALUE,XUFDA,IENS
S IENS=DUZ_","
S OLDVALUE=$$GET1^DIQ(200,IENS,41.98)
K XUFDA S XUFDA(200,IENS,41.98)="@" D FILE^DIE("","XUFDA")
D CHKEQ^XTMUNIT($$NPISTATS^XUSNPIED(DUZ),"","INCORRECT ON NO DATA")
;
K XUFDA S XUFDA(200,IENS,41.98)="N" D FILE^DIE("","XUFDA")
D CHKEQ^XTMUNIT($$NPISTATS^XUSNPIED(DUZ),"N","INCORRECT ON NEEDS")
;
K XUFDA S XUFDA(200,IENS,41.98)="E" D FILE^DIE("","XUFDA")
D CHKEQ^XTMUNIT($$NPISTATS^XUSNPIED(DUZ),"E","INCORRECT ON EXEMPT")
;
K XUFDA S XUFDA(200,IENS,41.98)="D" D FILE^DIE("","XUFDA")
D CHKEQ^XTMUNIT($$NPISTATS^XUSNPIED(DUZ),"D","INCORRECT ON DONE")
;
K XUFDA S XUFDA(200,IENS,41.98)=$S(OLDVALUE'="":$E(OLDVALUE),1:"@")
Q
;
GETTAXON ;
N XUSGLOB,DONE,IEN,TAXON,PVAL,CODE,DESCRIP,TAXDESCR
S XUSGLOB=$$CHKGLOB^XUSNPIED()
S DONE=0 F IEN=0:0 Q:DONE S IEN=$O(^VA(200,IEN)) Q:IEN'>0 F TAXON=0:0 S TAXON=$O(^VA(200,IEN,"USC1",TAXON)) Q:TAXON'>0 I $P(^(TAXON,0),U,3)'>0 S PVAL=$P(^(0),U),CODE=$$GET1^DIQ(8932.1,PVAL_",",6) I CODE'="",$D(@XUSGLOB@(CODE)) S DONE=1 Q
I 'DONE D FAIL^XTMUNIT("NO VALID TAXONOMY VALUES FOUND") Q
S TAXDESCR=$$GET1^DIQ(8932.1,PVAL_",",1)
S DESCRIP=""
I CODE'="" S TAXON=$$GETTAXON^XUSNPIED(IEN,.DESCRIP)
D CHKEQ^XTMUNIT(TAXON,CODE,"INCORRECT CODE RETURNED")
D CHKEQ^XTMUNIT(DESCRIP,TAXDESCR,"INCORRECT DESCRIPTION RETURNED")
Q
;
XTROU ;
;
XTENT ;
;;ALIGNRGT;LEFT ALIGN TEXT IN A SPECIFIED WIDTH
;;NEEDSNPI;CHECK ON NEEDS NPI STATUS
;;HASNPI;CHECK ON WHETHER USER HAS NPI
;;GETNPI;GET NPI VALUE FOR USER
;;NPISTATS;GET NPI STATUS
;;GETTAXON;GET TAXONOMY DATA