Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: AMQQAT2

AMQQAT2.m

Go to the documentation of this file.
  1. AMQQAT2 ; IHS/CMI/THL - FILE AND TAXONOMY ATTRIBUTE ;
  1. ;;2.0;IHS PCC SUITE;;MAY 14, 2009
  1. ;-----
  1. FQ S DIC("A")="Which Fileman file: "
  1. S DIC(0)="AEQ"
  1. S DIC=1
  1. D ^DIC
  1. K DIC
  1. I Y=-1,X'="",$E(X)=U S AMQQQUIT="" Q
  1. I Y=-1 Q
  1. I AMQQCCLS="P",+Y=2!(+Y=9000001) W !,"I assume that ALL patients are members of this file...Try another attribute.",*7,! Q
  1. D CHECK
  1. I '$D(AMQQFFLD) G FQ
  1. D FSET
  1. EXIT K AMQQFFLD,AMQQCHTT,AMQQRNDN,AMQQCRFG,AMQQFFIL,AMQQFFLD,AMQQFGBL,AMQQFPC,AMQQFSBS,AMQQFXR,%,I,N,Z
  1. Q
  1. ;
  1. CHECK K AMQQFFLD
  1. F X=0:0 S X=$O(^DD(+Y,"IX",X)) Q:'X S %=$P(^DD(+Y,X,0),U,2) I %["P2"!(%["P9000001") D C1 I $D(AMQQFFLD) Q
  1. I '$D(AMQQFFLD) W !,"Sorry...I cannot find any patient fields in this file which are indexed" Q
  1. W !!,"OK, I'll check the ",$P(^DD(+Y,X,0),U)," field of this file."
  1. Q
  1. ;
  1. C1 F Z=0:0 S Z=$O(^DD(+Y,X,1,Z)) Q:'Z I $P(^(Z,0),U,3)="" S AMQQFFLD=X,AMQQFFIL=+Y,AMQQFXR=$P(^(0),U,2) Q
  1. Q
  1. ;
  1. FSET S AMQQFGBL=^DIC(AMQQFFIL,0,"GL")
  1. S AMQQCHRT=$E(AMQQFGBL,2,99)_";"_AMQQFXR
  1. S %=$P(^DD(AMQQFFIL,AMQQFFLD,0),U,4)
  1. S AMQQFSBS=$P(%,";")
  1. S AMQQFPC=$P(%,";",2)
  1. S DIR(0)="SO^1:Look for patients entered in the file;2:Look for patients not entered in the file;3:Take a random sample of patients entered in the file;4:Count the number of patients in the file"
  1. S DIR("A")="Your choice"
  1. S DIR("B")="1"
  1. S DIR("?")=""
  1. D ^DIR
  1. K DIR
  1. I $E(Y)=U S AMQQQUIT="" Q
  1. I Y=4 D FCOUNT K ^UTILITY("AMER TEMP",$J) G FSET
  1. I Y=3 D FRAND Q
  1. I Y=2 S AMQQLINK=177
  1. W !!
  1. Q
  1. ;
  1. FCOUNT I IOST["C-" W !!!,"Counting...",!
  1. S A=AMQQFGBL_""""_AMQQFXR_""",X)"
  1. S %=0
  1. K ^UTILITY("AMQQ TEMP",$J)
  1. F X=0:0 S X=$O(@A) Q:'X I '$D(^UTILITY("AMQQ TEMP",$J,X)) S ^(X)="",%=%+1 W:IOST["C-" $C(13),% I $D(AMQQFFFG) S ^UTILITY("AMQQ FTEMP",$J,%,X)=""
  1. S AMQQCHTT=%
  1. Q
  1. ;
  1. FRAND W !!
  1. D WAIT^DICD
  1. S AMQQFFFG=""
  1. D FCOUNT
  1. K AMQQFFFG
  1. W $C(13)," ",$C(13),"There are ",AMQQCHTT," patients in this file"
  1. W !!!
  1. S AMQQRNDN=AMQQCHTT\2
  1. S AMQQCRFL=""
  1. D CNP1^AMQQAT1
  1. I IOST["C-" W !!,"Collecting a random sample",!
  1. K ^UTILITY("AMQQ FRAND",$J,AMQQATN)
  1. S AMQQCHRT=AMQQCHRT_";"_$J_";"_AMQQCHNN_";"_AMQQCHTT_";"_AMQQUATN,I=0,N=AMQQCHTT-1
  1. S AMQQLINK=178
  1. FR1 ; ENTRY POINT FROM STUFF
  1. F Q:I=AMQQCHNN S Y=$R(N)+1,Z=$O(^UTILITY("AMQQ FTEMP",$J,Y,"")) I Z,'$D(^UTILITY("AMQQ FRAND",$J,AMQQUATN,Z)) S ^(Z)="",I=I+1 W:IOST["C-" $C(13),I
  1. K ^UTILITY("AMQQ FTEMP",$J),AMQQRNDN,^UTILITY("AMQQ TEMP",$J),AMQQCHNN,AMQQCHTT
  1. Q
  1. ;
  1. STUFF ; ENTRY POINT FROM METADICTIONARY
  1. N AMQQFGBL,AMQQFXR,AMQQUATN,AMQQFFFG
  1. S AMQQFGBL=U_%(1)
  1. S AMQQFXR=%(2)
  1. S AMQQCHNN=%(4)
  1. S AMQQUATN=%(5)
  1. S AMQQFFFG=""
  1. D FCOUNT
  1. I IOST["C-" W !! D WAIT^DICD W !!
  1. S N=AMQQCHTT-1
  1. S I=0
  1. D FR1
  1. K %
  1. Q
  1. ;