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

AGFLDREQ.m

Go to the documentation of this file.
AGFLDREQ ; IHS/SD/TPF - DEVELOPER TOOL TO ADD REQUIRED FIELDS TO THE REQUIRED FIELD MULTIPLE IN THE REGISTRATION PARAMETER FILE
 ;;7.1;PATIENT REGISTRATION;**2,9**;AUG 25, 2005
 ;
 ;IN ORDER TO SET UP THE SITE SPECIFIC MANDATORY FIELDS DO THE FOLLOWING
 ;EDIT THE 'REGISTRATION PARAMETER' FILE
 ;            'MANDATORY FIELDS'
 ;                   'REQUIRED FIELDS'
 ;AND ENTER THE FILE AND THEN THEN FIELDS WITHIN THAT FILE YOU WISH
 ;TO ALLOW SITES TO SET
 ;LOCALLY AS REQUIRED OR NOT. THIS DOES NOT OVERRIDE FILEMEN REQUIRED
 ;FIELDS AND CAN ONLY
 ;BE USED FOR FIELDS THAT HAVE NO REQ SETTING IN THE FILEMAN DD.
 ;
 ;GENERALLY ADDING OF LOCAL REQ FIELDS WILL BE DONE BY DEVELOPERS. EVEN
 ;IF THE FIELD IS
 ;SET UP FOR LOCAL SETTINGS IT WILL NOT BE IN AFFECT UNTIL THE PROPER CODE
 ;IS ADDED TO
 ;THE PAT REG SCREEN ROUTINE. AFTER IT IS ADDED TO THE
 ;'REGISTRATION PARAMETER' FILE THE
 ;FOLLOWING CODE SHOULD BE ADDED TO THE APPROPRAIRE ROUTINE WHERE THE
 ;FIELD IS EDITED.
 ;
 ;            I $$ISREQ^AGFLDREQ(file or subfile #,field #) S
 ;                                               DIE("NO^"),DR=field#_"R"
 ;            E  S DR=field#
 ;
 ;THE FORMAT AT THIS TIME IS LIMITED TO CHECKING ONE FIELD AT A TIME.
 ;EACH EDIT CALL MAY HAVE TO BE MODIFIED TO ACCOUNT
 ;FOR THIS LIMITATION.
 ;
 ;THE SITE CAN THEN USE THE 'AGFAC' INPUT TEMPLATE VIA OPTION 'AGOPT'
 ;TO EDIT THE SETTING FOR EACH OF THE FIELDS
 ;
 Q  ;NOT TO BE RUN FROM ROOT
GETFIELD(A,B,X) ;EP - CALLED FROM INPUT TRANSFORM OF FIELD 9009061.1101 'REQUIRED FIELD NAME' SUB-FIELD
 N DIC,DIE,Y,DO
 ;GO THROUGH AND SEE IF THE FIELD IS IN THE TOP LEVEL FILE
 S TOPFILE=+$P(^AGFAC(A,11,B,0),U)
 S DIC="^DD("_TOPFILE_","
 S DIC(0)="EX"  ;SET THIS TO EX WHEN ADDING ITEMS IN AN INSTALL
 ;S DIC(0)="E"
 D ^DIC
 I +Y<0 D SUBFILES(TOPFILE,.X,.Y)
 I +Y<0 K X Q
 S X=$P(Y,U,2)
 Q
SUBFILES(TOPFILE,X,Y) ;GO THROUGH THE NEXT LEVEL OF SUB FILES AND FIND
 ;IT THERE
 N DIC,DIE,DO
 S SUBFILE=TOPFILE
 F  S SUBFILE=$O(^DD(TOPFILE,"SB",SUBFILE)) Q:SUBFILE=""  D  Q:+Y>0
 .S DIC="^DD("_SUBFILE_","
 .S DIC(0)="EX"  ;SET THIS TO EX WHEN ADDING ITEMS IN AN INSTALL
 .;S DIC(0)="E"
 .D ^DIC
 Q
 ;IS THIS A SITE SPECIFIC REQUIRED FLD?
 ;FILENUM = FILE OR SUBFILE #
 ;FIELDNUM = FLD #
 ;WILL BE CALLLED FROM VARIOUS PAT REG SCREENS
ISREQ(FILENUM,FIELDNUM) ;EP - USE TO VERIFY A SITE SPECIFIC MANDATORY FIELD IS SET FOR REQUIRED
 K RETURN,ERROR
 N FIELDIEN,FILEIEN
 D FIELD^DID(FILENUM,FIELDNUM,,"LABEL","RETURN","ERROR")
 Q:$D(ERROR) 0  ;ERROR CAN'T FIND FILE OR FIELD??
 S FIELDNAM=RETURN("LABEL")
 S FILEIEN=$O(^AGFAC(DUZ(2),11,"B",FILENUM,""))
 Q:FILEIEN="" 0  ;ERROR CAN'T FIND RECORD FOR THIS FILE #
 S FIELDIEN=$O(^AGFAC(DUZ(2),11,FILEIEN,1,"B",FIELDNAM,""))
 Q:FIELDIEN="" 0  ;ERROR CAN'T FIND RECORD FOR THIS FLD #
 Q $P($G(^AGFAC(DUZ(2),11,FILEIEN,1,FIELDIEN,0)),U,2)
 ;THIS IS USED TO LOOP THROUGH THE SITE SPECIFIC MANDATORY FIELDS AND ALLOW THE USER TO
 ;SET IT AS REQUIRED OR NOT
EDIT ;EP - CALLED FROM INPUT TEMPLATE 'AGFAC' TO EDIT SITE SPECIFIC REQUIRED FIELDS
 ;AG*7.1*9 - Set up FACIEN which is needed to update the correct facility
 ;         - Changed DUZ(20 references to use FACIEN to update the correct facility
 N FILENUM,FIELDNUM,FILEIEN,FACIEN
 S FACIEN=$G(DA)
 ;
 N DIE,DIC,DA,D0,DO,DR,X,Y,DP,%,D,DC,DE,DG,DH,DI,DIA,DIEDA,DIEL,DIETMP,DIFLD,DIIENS,DILK,DIP,DISYS,DK,DL,DM,DQ,DSC,DU,DV,DW,DXS,L
 K RETURN,ERROR
 W !!,"Mandatory Fields (site specific) edit:"
 S FILENUM=0
 F  S FILENUM=$O(^AGFAC(FACIEN,11,"B",FILENUM)) Q:'FILENUM  D  Q:$D(Y)
 .S FILEIEN=0
 .F  S FILEIEN=$O(^AGFAC(FACIEN,11,"B",FILENUM,FILEIEN)) Q:'FILEIEN  D  Q:$D(Y)
 ..D FILE^DID(FILENUM,,"NAME","RETURN","ERROR")
 ..I $D(ERROR) W !,"CAN'T FIND FILE. POSSIBLE FILE CORRUPTION IN ^AGFAC" Q  ;CAN'T FIND FILE
 ..W !!,"Now setting requirement for fields within file ",RETURN("NAME")
 ..S FIELDNAM=0
 ..F  S FIELDNAM=$O(^AGFAC(FACIEN,11,FILEIEN,1,"B",FIELDNAM)) Q:FIELDNAM=""  D  Q:$D(Y)
 ...S FIELDIEN=$O(^AGFAC(FACIEN,11,FILEIEN,1,"B",FIELDNAM,""))
 ...W !?8,"Require entry of field "_$S(FIELDNAM["ETHNICITY":"ETHNICITY",1:FIELDNAM)_" ?" ;AG*7.1*9 - Special code for ETHNICITY
 ...K DIC,DIE,DR,DA
 ...S DA=FIELDIEN
 ...S DA(2)=FACIEN
 ...S DA(1)=FILEIEN
 ...S DIE="^AGFAC("_DA(2)_",11,"_DA(1)_",1,"
 ...S DR=.02
 ...S DR(2,9009061.11)=.01
 ...S DR(3,9009061.1101)=.02
 ...S DIE("NO^")="OUTOK"
 ...D ^DIE
 ...;
 ...;Special code for Print Ethnicity On FaceSheet - AG*7.1*9
 ...I FILENUM=2,FIELDNAM="ETHNICITY INFORMATION" D  Q
 ....K DA,DR,DIE
 ....S DA=FACIEN
 ....S DIE="^AGFAC("
 ....S DR=501
 ....D ^DIE
 ....K DA,DR,DIE
 ...;
 ...;Special code for Print Race On FaceSheet - AG*7.1*9
 ...I FILENUM=2,FIELDNAM="RACE" D  Q
 ....K DA,DR,DIE
 ....S DA=FACIEN
 ....S DIE="^AGFAC("
 ....S DR=503
 ....D ^DIE
 ....K DA,DR,DIE
 Q
RESTRICT(IEN) ;EP - RESTRICT FILE CHOICE TO PATIENT REG FILES OR
 ;SPECIFIC AUP,AUT FILES
 Q 0
 ;
 ;AG*7.1*9 - Special check for mandatory multiple subfields
ALTREQ(FILENUM,FIELDNM) ;EP - ALTERNATE CHECK FOR SITE SPECIFIC MANDATORY FIELDS (HANDLES MULTIPLE SUBFIELDS)
 ;^AGFAC Structure does not allow multiple subfields to be entered so the are entered for the parent file
 ;This call will look up the multiple subfield by its name
 N FLIEN,FDIEN
 S FLIEN=$O(^AGFAC(DUZ(2),11,"B",FILENUM,"")) Q:FLIEN="" 0
 S FDIEN=$O(^AGFAC(DUZ(2),11,FLIEN,1,"B",FIELDNM,"")) Q:FDIEN="" 0
 Q $P($G(^AGFAC(DUZ(2),11,FLIEN,1,FDIEN,0)),U,2)