PXRMEXIC ;SLC/PKR,PJH - Routines to install repository entry components. ;Mar 12, 2025@10:34:59
;;2.0;CLINICAL REMINDERS;**6,12,17,16,18,22,24,26,47,45,87**;Feb 04, 2005;Build 35
;
; Reference to KILLUPDATING^ORIUTL in ICR# 7465
;
Q
;=================================================
FILE(PXRMRIEN,SITEIEN,IND120,JND120,ACTION,ATTR,NAMECHG) ;Read and process a
;file entry in repository entry PXRMRIEN. IND120 and JND120 are the
;indexes for the component list. ACTION is one of the possible actions.
I ACTION="S" Q
N CLASS,CLASSFIELDNUM,DATA,DUZ0S,EDULIST,FDA,FDAEND,FDASTART,FIELD,FILENUM
N IEN,IENS,IENREND,IENROOT,IENRSTR,IENUSED,IND,INDICES
N LINE,MSG,NAME,NEW01,PT01,PXNAT,PXRMEDOK,PXRMEXCH
N SRCIEN,START,TEMP,TEXT,TFDA,TIENROOT,TIUFPRIV,TNAME,TOPFNUM
N UPCNAME,UPCPT01,VERSN,WPLCNT,WPTMP,XUMF
;I $G(PXRMIGDS) S DUZ0S=DUZ(0),DUZ(0)="^",XUMF=1
;Set PXRMEDOK so files pointing to sponsors can be installed.
;Set PXRMEXCH so national entries can be installed and prevent
;execution of the input transform for custom logic fields.
;Set PXNAT to allow installation of national PCE data types.
S (PXNAT,PXRMEDOK,PXRMEXCH)=1
S TEMP=^PXD(811.8,PXRMRIEN,120,IND120,1,JND120,0)
S FDASTART=+$P(TEMP,U,2)
S FDAEND=+$P(TEMP,U,3)
S IENRSTR=+$P(TEMP,U,4)
S IENREND=+$P(TEMP,U,5)
F IND=FDASTART:1:FDAEND D
. S LINE=^PXD(811.8,PXRMRIEN,100,IND,0)
. S INDICES=$P(LINE,"~",1)
. S DATA=$P(LINE,"~",2)
. S FILENUM=$P(INDICES,";",1)
. S IENS=$P(INDICES,";",2)
. I IND=FDASTART S SRCIEN=+IENS
. S FIELD=$P(INDICES,";",3)
. I LINE["WP-start" D
.. S DATA="WPTMP("_IND_","_+FIELD_")"
.. S WPLCNT=$P(LINE,"~",3)
.. D WORDPROC(PXRMRIEN,.WPTMP,IND,+FIELD,.IND,WPLCNT)
. I (IND=FDASTART)&((FIELD=.01)!(FIELD=.001)) D
..;Save the top level file number.
.. S TOPFNUM=FILENUM
..;If the action is copy put it in the first open spot.
.. I ACTION="C" S IENROOT(SRCIEN)=$$LOIEN^PXRMEXU5(TOPFNUM,0)
..;
..;If the entry does not exist and the action is not copy set the
..;action to install.
.. I SITEIEN=0 S ACTION="I"
..;
..;If the action is install try to install at the source IEN. If
..;an entry already exists at the source IEN put it in the first
..;open spot.
.. I ACTION="I" D
... S IENUSED=+$$FIND1^DIC(FILENUM,"","QU","`"_SRCIEN)
... S IENROOT(SRCIEN)=$S(IENUSED=0:SRCIEN,1:$$LOIEN^PXRMEXU5(FILENUM))
..;
..;If the action is merge, overwrite,or update install at the site's
..;IEN.
.. I (ACTION="M")!(ACTION="O")!(ACTION="U") S IENROOT(SRCIEN)=SITEIEN
.;
.;This line is use to convert pre-patch 12 disable text to the new
.;value of 1 for disable
. I FILENUM=801.41,FIELD=3,DATA'="",$L(DATA)>2 D
..I DATA="DISABLE AND DO NOT SEND MESSAGE" Q
..S DATA="DISABLE AND SEND MESSAGE"
.;
. S FDA(FILENUM,IENS,FIELD)=DATA
;
S IENS=$O(FDA(TOPFNUM,""))
;
;Initialize the edit history.
D INIEH(TOPFNUM,IENS,.FDA,.WPTMP)
;
;S CLASSFIELDNUM=$$FLDNUM^DILFD(TOPFNUM,"CLASS")
;I CLASSFIELDNUM>0 D
;.;If there is no Class, default it to local.
;. S CLASS=$G(FDA(TOPFNUM,IENS,CLASSFIELDNUM))
;. I CLASS="" S FDA(TOPFNUM,IENS,100)="LOCAL"
;
;Initialize the Change Log/Edit History.
;S PT01=FDA(TOPFNUM,IENS,.01)
;S UPCPT01=$$UP^XLFSTR(PT01)
;D INIEH(PXRMRIEN,TOPFNUM,PT01,UPCPT01,.FDA,.NAMECHG,.WPTMP)
;
;If there is a Sponsor does it need to be replaced?
;S SPONFIELDNUM=$$FLDNUM^DILFD(TOPFNUM,"SPONSOR")
;I SPONFIELDNUM>0 D
;. S SPONSOR=$G(FDA(TOPFNUM,IENS,SPONFIELDNUM))
;. I (SPONSOR'=""),$D(^PXRMD(811.6,"REP",SPONSOR)) D
;.. S REPSPONIEN=$O(^PXRMD(811.6,"REP",SPONSOR,""))
;.. S FDA(TOPFNUM,IENS,SPONFIELDNUM)="`"_REPSPONIEN
;
;Some older PRD files may contain mixed-case. Make sure
;the appropriate fields in the FDA are uppercase.
;D UPPERCASE^PXRMEXUPC(TOPFNUM,.FDA)
;
;Build the IENROOT
F IND=IENRSTR:1:IENREND D
. I IND=0 Q
. S TEMP=^PXD(811.8,PXRMRIEN,100,IND,0)
. S IENROOT($P(TEMP,U,1))=$P(TEMP,U,2)
;Check for name changes, i.e., the copy action.
D NAMECHG(.FDA,.NAMECHG,TOPFNUM)
;
;Special handling for file 142.
I TOPFNUM=142 D Q:'$D(FDA)
. D SFMVPI^PXRMEXIU(.FDA,.NAMECHG,142.14)
;
;Special handling for file 801
I TOPFNUM=801 D Q:PXRMDONE
. D SFMVPI^PXRMEXIU(.FDA,.NAMECHG,801.015)
. D ROC^PXRMEXU5(.FDA,.IENROOT)
;
;Special handling for file 801.1
I TOPFNUM=801.1 D Q:PXRMDONE
. D ROCR^PXRMEXU5(.FDA)
;
I TOPFNUM=801.48 D DLINKSAV^PXRMEXU5(.FDA) Q:PXRMDONE
;Special handling for file 801.41
I TOPFNUM=801.41 D Q:PXRMDONE
. ;Merge only applies when the silent installer is used.
. I ACTION="M" D MOU^PXRMEXU5(801.41,SITEIEN,"18*",.FDA,.IENROOT,ACTION,.WPTMP)
. D DLG^PXRMEXU4(.FDA,.NAMECHG)
;
;Special handling for file 810.9
I TOPFNUM=810.9 D LOC^PXRMEXU0(.FDA)
;
;Special handling for file 811.2
I TOPFNUM=811.2 D TAX^PXRMEXU0(.FDA,"CFR")
;
I TOPFNUM=801.46 D DIALOGGF^PXRMEXU5(.FDA,.IENROOT)
;
;If the file number is 811.4 the user must have programmer
;access to install it.
I (TOPFNUM=811.4)&(DUZ(0)'="@") D Q
. W !,"Only programmers can install Reminder Computed Findings."
;
;Special handling for file 811.5.
I TOPFNUM=811.5 D Q:'$D(FDA)
.;set default usage if not defined
.I $G(FDA(811.5,IENS,103))="" S FDA(811.5,IENS,103)="*"
.;If the site has any findings already mapped merge them in.
. I (ACTION="M")!(ACTION="U") D MOU^PXRMEXU5(811.5,SITEIEN,"20*",.FDA,.IENROOT,ACTION,.WPTMP)
. D SFMVPI^PXRMEXIU(.FDA,.NAMECHG,811.52)
;
;Special handling for file 811.9.
I TOPFNUM=811.9 D
.;Don't execute the input transform for custom logic fields.
. S PXRMEXCH=1
. D DEF^PXRMEXIU(.FDA,.NAMECHG)
;
;Special handling for file 8925.1
I TOPFNUM=8925.1 D
. S TIUFPRIV=1
. D TIUOBJ^PXRMEXIU(.FDA)
;
;Special handling for file 9999999.09: Education Topics.
I TOPFNUM=9999999.09 D EDU^PXRMEXIU(.FDA,.EDULIST)
;
;Special handling for file 9999999.15: Exams.
I TOPFNUM=9999999.15 D EXAM^PXRMEXIU(.FDA)
;
;Special handling for file 9999999.64: Health Factors.
I TOPFNUM=9999999.64 D HF^PXRMEXIU(.FDA)
;
I TOPFNUM=101.71 D EN^PXRMEXUINFOPNL(.FDA) I PXRMDONE=1 Q
;
;If FDA is not defined at this point the user has opted to abort
;the install.
I '$D(FDA) Q
;
;If the action is merge, overwrite, or update do a test install
;before deleting the original entry.
I (ACTION="M")!(ACTION="O")!(ACTION="U") D
.I TOPFNUM=101.71 Q
.;Make the .01 unique for the test install.
. S IENS=$O(FDA(TOPFNUM,""))
.;Get the length of the .01 field
. D FIELD^DID(TOPFNUM,.01,"","FIELD LENGTH","ATTR")
. S TNAME="tmp"_$E(FDA(TOPFNUM,IENS,.01),1,ATTR("FIELD LENGTH")-3)
.;Make sure the test entry does not already exist.
. D DELALL^PXRMEXFI(TOPFNUM,TNAME)
. M TFDA=FDA
. S TFDA(TOPFNUM,IENS,.01)=TNAME
. K TIENROOT M TIENROOT=IENROOT
. S TIENROOT(SRCIEN)=$$LOIEN^PXRMEXU5(TOPFNUM)
. D UPDATE^DIE("E","TFDA","TIENROOT","MSG")
. I $D(MSG) D Q
.. K TEXT
.. S TEXT(1)="FILE^PXRMEXIC, "_ATTR("FILE NAME")_" entry "_$G(ATTR("PT01"))_" did not get installed!"
.. S TEXT(2)="Examine the following error message for the reason."
.. S TEXT(3)=""
.. S TEXT(4)="The test update failed, UPDATE^DIE returned the following error message:"
.. D MES^XPDUTL(.TEXT)
.. D AWRITE^PXRMUTIL("MSG")
.. H 2
.;Delete the test entry.
. D DELALL^PXRMEXFI(TOPFNUM,TNAME)
.;If the original update worked put the entry at its original ien.
.;Delete the existing entry.
. D DELETE^PXRMEXFI(TOPFNUM,SITEIEN)
;
D UPDATE^DIE($S(TOPFNUM=101.71:"ESU",1:"ES"),"FDA","IENROOT","MSG")
I TOPFNUM=101.71 D KILLUPDATING^ORIUTL
;
I '$D(MSG),ATTR("FILE NUMBER")=9999999.64 D
.;Build a list of health factor categories that need the [C] appended
. N IENS
. S IENS=$O(FDA(9999999.64,""))
. I FDA(9999999.64,IENS,.1)'="CATEGORY" Q
. N L4C,LEN,NAME
. S NAME=ATTR("NAME")
. S LEN=$L(NAME),L4C=$E(NAME,(LEN-3),LEN)
. I L4C'=" [C]" D
.. S UPCNAME=$$UP^XLFSTR(NAME)
.. S ^TMP("PXRMHFCAT",$J,UPCNAME)=""
I $D(MSG) D
. K TEXT
. S TEXT(1)="FILE^PXRMEXIC, "_ATTR("FILE NAME")_" entry "_$G(ATTR("PT01"))_" did not get installed!"
. S TEXT(2)="Examine the following error message for the reason."
. S TEXT(3)=""
. S TEXT(4)="The update failed, UPDATE^DIE returned the following error message:"
. D MES^XPDUTL(.TEXT)
. D AWRITE^PXRMUTIL("MSG") W ! D AWRITE^PXRMUTIL("FDA")
. W !
. H 2
;
I TOPFNUM=811.2 D
.;Finish conversion from pointer based structure to Lexicon based.
. N IEN,PDS
. S IEN=+$O(^PXD(811.2,"B",ATTR("NAME"),""))
. I IEN=0 Q
. D EXCH^PXRMTXCR(IEN,"CFR")
. S PDS=$P(^PXD(811.2,IEN,0),U,4)
. I PDS="" D SPDS^PXRMPDS(IEN,PDS)
.;If there are codes marked Use In Dialog build the 30 node.
. D BLD30N^PXRMTAXD(IEN)
;
S VERSN=$$GETTAGV^PXRMEXU3(^PXD(811.8,PXRMRIEN,100,3,0),"<PACKAGE_VERSION>")
I TOPFNUM=811.9,VERSN=1.5 D
. N IEN,PXRMEXCH,X
. S IEN=+$O(^PXD(811.9,"B",ATTR("PT01"),""))
. I IEN=0 Q
.;For reminder definitions build the found/not found text counts.
. D SFNFTC^PXRMEXU0(IEN)
.;Build the internal logic and finding strings.
. S X=$G(^PXD(811.9,IEN,30))
. I X'="" D CPPCLS^PXRMLOGX(IEN,X)
. S X=$G(^PXD(811.9,IEN,34))
. I X'="" D CPRESLS^PXRMLOGX(IEN,X)
. D BLDALL^PXRMLOGX(IEN,"","")
;If there are national education topics rename them so they start
;with VA-
I $D(EDULIST),$G(PXRMNAT) D
.;Get the length of the .01 field
. D FIELD^DID(TOPFNUM,.01,"","FIELD LENGTH","ATTR")
. S NAME=""
. F S NAME=$O(EDULIST(NAME)) Q:NAME="" D
.. I $E(NAME,1,3)="VA-" Q
.. S TNAME="VA-"_$E(ATTR("FIELD LENGTH")-3)
.. D RENAME^PXRMUTIL(TOPFNUM,NAME,TNAME)
;I $G(PXRMIGDS) S DUZ(0)=DUZ0S
Q
;
;=================================================
INIEH(FILENUM,IENS,FDA,WPTMP) ;If the file is a clinical reminder file and
;it has an edit history initialize the history.
I (FILENUM<800)!(FILENUM>811.9) Q
N IENS,SFN,TARGET,WP
D FIELD^DID(FILENUM,"CHANGE LOG","","SPECIFIER","TARGET")
S SFN=+$G(TARGET("SPECIFIER"))
I SFN=0 D FIELD^DID(FILENUM,"EDIT HISTORY","","SPECIFIER","TARGET")
S SFN=+$G(TARGET("SPECIFIER"))
I SFN=0 Q
S IENS=$O(FDA(SFN,""))
I IENS="" Q
S FDA(SFN,IENS,.01)=$$FMTE^XLFDT($$NOW^XLFDT,"5Z")
S FDA(SFN,IENS,1)="`"_DUZ
;The word-processing field is set when the packing is done.
S WP=FDA(SFN,IENS,2)
K @WP
S @WP@(1)="Exchange Install"
Q
;
;=================================================
NAMECHG(FDA,NAMECHG,FILENUM) ;If this component has been copied to a new
;name make the change.
N CLASS,IENS,PT01
S IENS=$O(FDA(FILENUM,""))
S PT01=FDA(FILENUM,IENS,.01)
I $D(NAMECHG(FILENUM,PT01)) D
. S FDA(FILENUM,IENS,.01)=NAMECHG(FILENUM,PT01)
. I (FILENUM<801.41)!(FILENUM>811.9) Q
.;Once a component has been copied CLASS can no longer be national.
. S CLASS=$G(FDA(FILENUM,IENS,100))
. I (CLASS="")!(CLASS["N") S FDA(FILENUM,IENS,100)="LOCAL"
.;The Sponsor is also removed.
. K FDA(FILENUM,IENS,101)
Q
;
;=================================================
RTNLD(PXRMRIEN,START,END,ATTR,RTN) ;Load a routine from the repository into
;the array RTN.
N IND,LINE,LN,ROUTINE
S LINE=^PXD(811.8,PXRMRIEN,100,START,0)
S ROUTINE=$P(LINE,";",1)
S ROUTINE=$TR(ROUTINE," ","")
S ATTR("FILE NUMBER")=0
S ATTR("NAME")=$P(LINE,";",1)
S ATTR("NAME")=$TR(ATTR("NAME")," ","")
S ATTR("MIN FIELD LENGTH")=3
S ATTR("FIELD LENGTH")=8
S LN=0
F IND=START:1:END D
. S LN=LN+1
. S LINE=^PXD(811.8,PXRMRIEN,100,IND,0)
. S RTN(LN,0)=LINE
Q
;
;=================================================
RTNSAVE(RTN,NAME) ;Save the routine loaded in RTN to the name
;found in NAMECHG.
N DIE,XCN
;%ZOSF("SAVE") requires a global.
K ^TMP($J,"PXRMRTN")
S DIE="^TMP($J,""PXRMRTN"","
M ^TMP($J,"PXRMRTN")=RTN
S XCN=0
S X=NAME
X ^%ZOSF("SAVE")
K ^TMP($J,"PXRMRTN")
Q
;
;=================================================
WORDPROC(PXRMRIEN,WPTMP,I1,I2,IND,WPLCNT) ;Load WPTMP with the word
;processing field.
N I3
F I3=1:1:WPLCNT D
. S IND=IND+1
. S WPTMP(I1,I2,I3)=$G(^PXD(811.8,PXRMRIEN,100,IND,0))
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPXRMEXIC 12141 printed May 25, 2026@11:48:27 Page 2
PXRMEXIC ;SLC/PKR,PJH - Routines to install repository entry components. ;Mar 12, 2025@10:34:59
+1 ;;2.0;CLINICAL REMINDERS;**6,12,17,16,18,22,24,26,47,45,87**;Feb 04, 2005;Build 35
+2 ;
+3 ; Reference to KILLUPDATING^ORIUTL in ICR# 7465
+4 ;
+5 QUIT
+6 ;=================================================
FILE(PXRMRIEN,SITEIEN,IND120,JND120,ACTION,ATTR,NAMECHG) ;Read and process a
+1 ;file entry in repository entry PXRMRIEN. IND120 and JND120 are the
+2 ;indexes for the component list. ACTION is one of the possible actions.
+3 IF ACTION="S"
QUIT
+4 NEW CLASS,CLASSFIELDNUM,DATA,DUZ0S,EDULIST,FDA,FDAEND,FDASTART,FIELD,FILENUM
+5 NEW IEN,IENS,IENREND,IENROOT,IENRSTR,IENUSED,IND,INDICES
+6 NEW LINE,MSG,NAME,NEW01,PT01,PXNAT,PXRMEDOK,PXRMEXCH
+7 NEW SRCIEN,START,TEMP,TEXT,TFDA,TIENROOT,TIUFPRIV,TNAME,TOPFNUM
+8 NEW UPCNAME,UPCPT01,VERSN,WPLCNT,WPTMP,XUMF
+9 ;I $G(PXRMIGDS) S DUZ0S=DUZ(0),DUZ(0)="^",XUMF=1
+10 ;Set PXRMEDOK so files pointing to sponsors can be installed.
+11 ;Set PXRMEXCH so national entries can be installed and prevent
+12 ;execution of the input transform for custom logic fields.
+13 ;Set PXNAT to allow installation of national PCE data types.
+14 SET (PXNAT,PXRMEDOK,PXRMEXCH)=1
+15 SET TEMP=^PXD(811.8,PXRMRIEN,120,IND120,1,JND120,0)
+16 SET FDASTART=+$PIECE(TEMP,U,2)
+17 SET FDAEND=+$PIECE(TEMP,U,3)
+18 SET IENRSTR=+$PIECE(TEMP,U,4)
+19 SET IENREND=+$PIECE(TEMP,U,5)
+20 FOR IND=FDASTART:1:FDAEND
Begin DoDot:1
+21 SET LINE=^PXD(811.8,PXRMRIEN,100,IND,0)
+22 SET INDICES=$PIECE(LINE,"~",1)
+23 SET DATA=$PIECE(LINE,"~",2)
+24 SET FILENUM=$PIECE(INDICES,";",1)
+25 SET IENS=$PIECE(INDICES,";",2)
+26 IF IND=FDASTART
SET SRCIEN=+IENS
+27 SET FIELD=$PIECE(INDICES,";",3)
+28 IF LINE["WP-start"
Begin DoDot:2
+29 SET DATA="WPTMP("_IND_","_+FIELD_")"
+30 SET WPLCNT=$PIECE(LINE,"~",3)
+31 DO WORDPROC(PXRMRIEN,.WPTMP,IND,+FIELD,.IND,WPLCNT)
End DoDot:2
+32 IF (IND=FDASTART)&((FIELD=.01)!(FIELD=.001))
Begin DoDot:2
+33 ;Save the top level file number.
+34 SET TOPFNUM=FILENUM
+35 ;If the action is copy put it in the first open spot.
+36 IF ACTION="C"
SET IENROOT(SRCIEN)=$$LOIEN^PXRMEXU5(TOPFNUM,0)
+37 ;
+38 ;If the entry does not exist and the action is not copy set the
+39 ;action to install.
+40 IF SITEIEN=0
SET ACTION="I"
+41 ;
+42 ;If the action is install try to install at the source IEN. If
+43 ;an entry already exists at the source IEN put it in the first
+44 ;open spot.
+45 IF ACTION="I"
Begin DoDot:3
+46 SET IENUSED=+$$FIND1^DIC(FILENUM,"","QU","`"_SRCIEN)
+47 SET IENROOT(SRCIEN)=$SELECT(IENUSED=0:SRCIEN,1:$$LOIEN^PXRMEXU5(FILENUM))
End DoDot:3
+48 ;
+49 ;If the action is merge, overwrite,or update install at the site's
+50 ;IEN.
+51 IF (ACTION="M")!(ACTION="O")!(ACTION="U")
SET IENROOT(SRCIEN)=SITEIEN
End DoDot:2
+52 ;
+53 ;This line is use to convert pre-patch 12 disable text to the new
+54 ;value of 1 for disable
+55 IF FILENUM=801.41
IF FIELD=3
IF DATA'=""
IF $LENGTH(DATA)>2
Begin DoDot:2
+56 IF DATA="DISABLE AND DO NOT SEND MESSAGE"
QUIT
+57 SET DATA="DISABLE AND SEND MESSAGE"
End DoDot:2
+58 ;
+59 SET FDA(FILENUM,IENS,FIELD)=DATA
End DoDot:1
+60 ;
+61 SET IENS=$ORDER(FDA(TOPFNUM,""))
+62 ;
+63 ;Initialize the edit history.
+64 DO INIEH(TOPFNUM,IENS,.FDA,.WPTMP)
+65 ;
+66 ;S CLASSFIELDNUM=$$FLDNUM^DILFD(TOPFNUM,"CLASS")
+67 ;I CLASSFIELDNUM>0 D
+68 ;.;If there is no Class, default it to local.
+69 ;. S CLASS=$G(FDA(TOPFNUM,IENS,CLASSFIELDNUM))
+70 ;. I CLASS="" S FDA(TOPFNUM,IENS,100)="LOCAL"
+71 ;
+72 ;Initialize the Change Log/Edit History.
+73 ;S PT01=FDA(TOPFNUM,IENS,.01)
+74 ;S UPCPT01=$$UP^XLFSTR(PT01)
+75 ;D INIEH(PXRMRIEN,TOPFNUM,PT01,UPCPT01,.FDA,.NAMECHG,.WPTMP)
+76 ;
+77 ;If there is a Sponsor does it need to be replaced?
+78 ;S SPONFIELDNUM=$$FLDNUM^DILFD(TOPFNUM,"SPONSOR")
+79 ;I SPONFIELDNUM>0 D
+80 ;. S SPONSOR=$G(FDA(TOPFNUM,IENS,SPONFIELDNUM))
+81 ;. I (SPONSOR'=""),$D(^PXRMD(811.6,"REP",SPONSOR)) D
+82 ;.. S REPSPONIEN=$O(^PXRMD(811.6,"REP",SPONSOR,""))
+83 ;.. S FDA(TOPFNUM,IENS,SPONFIELDNUM)="`"_REPSPONIEN
+84 ;
+85 ;Some older PRD files may contain mixed-case. Make sure
+86 ;the appropriate fields in the FDA are uppercase.
+87 ;D UPPERCASE^PXRMEXUPC(TOPFNUM,.FDA)
+88 ;
+89 ;Build the IENROOT
+90 FOR IND=IENRSTR:1:IENREND
Begin DoDot:1
+91 IF IND=0
QUIT
+92 SET TEMP=^PXD(811.8,PXRMRIEN,100,IND,0)
+93 SET IENROOT($PIECE(TEMP,U,1))=$PIECE(TEMP,U,2)
End DoDot:1
+94 ;Check for name changes, i.e., the copy action.
+95 DO NAMECHG(.FDA,.NAMECHG,TOPFNUM)
+96 ;
+97 ;Special handling for file 142.
+98 IF TOPFNUM=142
Begin DoDot:1
+99 DO SFMVPI^PXRMEXIU(.FDA,.NAMECHG,142.14)
End DoDot:1
if '$DATA(FDA)
QUIT
+100 ;
+101 ;Special handling for file 801
+102 IF TOPFNUM=801
Begin DoDot:1
+103 DO SFMVPI^PXRMEXIU(.FDA,.NAMECHG,801.015)
+104 DO ROC^PXRMEXU5(.FDA,.IENROOT)
End DoDot:1
if PXRMDONE
QUIT
+105 ;
+106 ;Special handling for file 801.1
+107 IF TOPFNUM=801.1
Begin DoDot:1
+108 DO ROCR^PXRMEXU5(.FDA)
End DoDot:1
if PXRMDONE
QUIT
+109 ;
+110 IF TOPFNUM=801.48
DO DLINKSAV^PXRMEXU5(.FDA)
if PXRMDONE
QUIT
+111 ;Special handling for file 801.41
+112 IF TOPFNUM=801.41
Begin DoDot:1
+113 ;Merge only applies when the silent installer is used.
+114 IF ACTION="M"
DO MOU^PXRMEXU5(801.41,SITEIEN,"18*",.FDA,.IENROOT,ACTION,.WPTMP)
+115 DO DLG^PXRMEXU4(.FDA,.NAMECHG)
End DoDot:1
if PXRMDONE
QUIT
+116 ;
+117 ;Special handling for file 810.9
+118 IF TOPFNUM=810.9
DO LOC^PXRMEXU0(.FDA)
+119 ;
+120 ;Special handling for file 811.2
+121 IF TOPFNUM=811.2
DO TAX^PXRMEXU0(.FDA,"CFR")
+122 ;
+123 IF TOPFNUM=801.46
DO DIALOGGF^PXRMEXU5(.FDA,.IENROOT)
+124 ;
+125 ;If the file number is 811.4 the user must have programmer
+126 ;access to install it.
+127 IF (TOPFNUM=811.4)&(DUZ(0)'="@")
Begin DoDot:1
+128 WRITE !,"Only programmers can install Reminder Computed Findings."
End DoDot:1
QUIT
+129 ;
+130 ;Special handling for file 811.5.
+131 IF TOPFNUM=811.5
Begin DoDot:1
+132 ;set default usage if not defined
+133 IF $GET(FDA(811.5,IENS,103))=""
SET FDA(811.5,IENS,103)="*"
+134 ;If the site has any findings already mapped merge them in.
+135 IF (ACTION="M")!(ACTION="U")
DO MOU^PXRMEXU5(811.5,SITEIEN,"20*",.FDA,.IENROOT,ACTION,.WPTMP)
+136 DO SFMVPI^PXRMEXIU(.FDA,.NAMECHG,811.52)
End DoDot:1
if '$DATA(FDA)
QUIT
+137 ;
+138 ;Special handling for file 811.9.
+139 IF TOPFNUM=811.9
Begin DoDot:1
+140 ;Don't execute the input transform for custom logic fields.
+141 SET PXRMEXCH=1
+142 DO DEF^PXRMEXIU(.FDA,.NAMECHG)
End DoDot:1
+143 ;
+144 ;Special handling for file 8925.1
+145 IF TOPFNUM=8925.1
Begin DoDot:1
+146 SET TIUFPRIV=1
+147 DO TIUOBJ^PXRMEXIU(.FDA)
End DoDot:1
+148 ;
+149 ;Special handling for file 9999999.09: Education Topics.
+150 IF TOPFNUM=9999999.09
DO EDU^PXRMEXIU(.FDA,.EDULIST)
+151 ;
+152 ;Special handling for file 9999999.15: Exams.
+153 IF TOPFNUM=9999999.15
DO EXAM^PXRMEXIU(.FDA)
+154 ;
+155 ;Special handling for file 9999999.64: Health Factors.
+156 IF TOPFNUM=9999999.64
DO HF^PXRMEXIU(.FDA)
+157 ;
+158 IF TOPFNUM=101.71
DO EN^PXRMEXUINFOPNL(.FDA)
IF PXRMDONE=1
QUIT
+159 ;
+160 ;If FDA is not defined at this point the user has opted to abort
+161 ;the install.
+162 IF '$DATA(FDA)
QUIT
+163 ;
+164 ;If the action is merge, overwrite, or update do a test install
+165 ;before deleting the original entry.
+166 IF (ACTION="M")!(ACTION="O")!(ACTION="U")
Begin DoDot:1
+167 IF TOPFNUM=101.71
QUIT
+168 ;Make the .01 unique for the test install.
+169 SET IENS=$ORDER(FDA(TOPFNUM,""))
+170 ;Get the length of the .01 field
+171 DO FIELD^DID(TOPFNUM,.01,"","FIELD LENGTH","ATTR")
+172 SET TNAME="tmp"_$EXTRACT(FDA(TOPFNUM,IENS,.01),1,ATTR("FIELD LENGTH")-3)
+173 ;Make sure the test entry does not already exist.
+174 DO DELALL^PXRMEXFI(TOPFNUM,TNAME)
+175 MERGE TFDA=FDA
+176 SET TFDA(TOPFNUM,IENS,.01)=TNAME
+177 KILL TIENROOT
MERGE TIENROOT=IENROOT
+178 SET TIENROOT(SRCIEN)=$$LOIEN^PXRMEXU5(TOPFNUM)
+179 DO UPDATE^DIE("E","TFDA","TIENROOT","MSG")
+180 IF $DATA(MSG)
Begin DoDot:2
+181 KILL TEXT
+182 SET TEXT(1)="FILE^PXRMEXIC, "_ATTR("FILE NAME")_" entry "_$GET(ATTR("PT01"))_" did not get installed!"
+183 SET TEXT(2)="Examine the following error message for the reason."
+184 SET TEXT(3)=""
+185 SET TEXT(4)="The test update failed, UPDATE^DIE returned the following error message:"
+186 DO MES^XPDUTL(.TEXT)
+187 DO AWRITE^PXRMUTIL("MSG")
+188 HANG 2
End DoDot:2
QUIT
+189 ;Delete the test entry.
+190 DO DELALL^PXRMEXFI(TOPFNUM,TNAME)
+191 ;If the original update worked put the entry at its original ien.
+192 ;Delete the existing entry.
+193 DO DELETE^PXRMEXFI(TOPFNUM,SITEIEN)
End DoDot:1
+194 ;
+195 DO UPDATE^DIE($SELECT(TOPFNUM=101.71:"ESU",1:"ES"),"FDA","IENROOT","MSG")
+196 IF TOPFNUM=101.71
DO KILLUPDATING^ORIUTL
+197 ;
+198 IF '$DATA(MSG)
IF ATTR("FILE NUMBER")=9999999.64
Begin DoDot:1
+199 ;Build a list of health factor categories that need the [C] appended
+200 NEW IENS
+201 SET IENS=$ORDER(FDA(9999999.64,""))
+202 IF FDA(9999999.64,IENS,.1)'="CATEGORY"
QUIT
+203 NEW L4C,LEN,NAME
+204 SET NAME=ATTR("NAME")
+205 SET LEN=$LENGTH(NAME)
SET L4C=$EXTRACT(NAME,(LEN-3),LEN)
+206 IF L4C'=" [C]"
Begin DoDot:2
+207 SET UPCNAME=$$UP^XLFSTR(NAME)
+208 SET ^TMP("PXRMHFCAT",$JOB,UPCNAME)=""
End DoDot:2
End DoDot:1
+209 IF $DATA(MSG)
Begin DoDot:1
+210 KILL TEXT
+211 SET TEXT(1)="FILE^PXRMEXIC, "_ATTR("FILE NAME")_" entry "_$GET(ATTR("PT01"))_" did not get installed!"
+212 SET TEXT(2)="Examine the following error message for the reason."
+213 SET TEXT(3)=""
+214 SET TEXT(4)="The update failed, UPDATE^DIE returned the following error message:"
+215 DO MES^XPDUTL(.TEXT)
+216 DO AWRITE^PXRMUTIL("MSG")
WRITE !
DO AWRITE^PXRMUTIL("FDA")
+217 WRITE !
+218 HANG 2
End DoDot:1
+219 ;
+220 IF TOPFNUM=811.2
Begin DoDot:1
+221 ;Finish conversion from pointer based structure to Lexicon based.
+222 NEW IEN,PDS
+223 SET IEN=+$ORDER(^PXD(811.2,"B",ATTR("NAME"),""))
+224 IF IEN=0
QUIT
+225 DO EXCH^PXRMTXCR(IEN,"CFR")
+226 SET PDS=$PIECE(^PXD(811.2,IEN,0),U,4)
+227 IF PDS=""
DO SPDS^PXRMPDS(IEN,PDS)
+228 ;If there are codes marked Use In Dialog build the 30 node.
+229 DO BLD30N^PXRMTAXD(IEN)
End DoDot:1
+230 ;
+231 SET VERSN=$$GETTAGV^PXRMEXU3(^PXD(811.8,PXRMRIEN,100,3,0),"<PACKAGE_VERSION>")
+232 IF TOPFNUM=811.9
IF VERSN=1.5
Begin DoDot:1
+233 NEW IEN,PXRMEXCH,X
+234 SET IEN=+$ORDER(^PXD(811.9,"B",ATTR("PT01"),""))
+235 IF IEN=0
QUIT
+236 ;For reminder definitions build the found/not found text counts.
+237 DO SFNFTC^PXRMEXU0(IEN)
+238 ;Build the internal logic and finding strings.
+239 SET X=$GET(^PXD(811.9,IEN,30))
+240 IF X'=""
DO CPPCLS^PXRMLOGX(IEN,X)
+241 SET X=$GET(^PXD(811.9,IEN,34))
+242 IF X'=""
DO CPRESLS^PXRMLOGX(IEN,X)
+243 DO BLDALL^PXRMLOGX(IEN,"","")
End DoDot:1
+244 ;If there are national education topics rename them so they start
+245 ;with VA-
+246 IF $DATA(EDULIST)
IF $GET(PXRMNAT)
Begin DoDot:1
+247 ;Get the length of the .01 field
+248 DO FIELD^DID(TOPFNUM,.01,"","FIELD LENGTH","ATTR")
+249 SET NAME=""
+250 FOR
SET NAME=$ORDER(EDULIST(NAME))
if NAME=""
QUIT
Begin DoDot:2
+251 IF $EXTRACT(NAME,1,3)="VA-"
QUIT
+252 SET TNAME="VA-"_$EXTRACT(ATTR("FIELD LENGTH")-3)
+253 DO RENAME^PXRMUTIL(TOPFNUM,NAME,TNAME)
End DoDot:2
End DoDot:1
+254 ;I $G(PXRMIGDS) S DUZ(0)=DUZ0S
+255 QUIT
+256 ;
+257 ;=================================================
INIEH(FILENUM,IENS,FDA,WPTMP) ;If the file is a clinical reminder file and
+1 ;it has an edit history initialize the history.
+2 IF (FILENUM<800)!(FILENUM>811.9)
QUIT
+3 NEW IENS,SFN,TARGET,WP
+4 DO FIELD^DID(FILENUM,"CHANGE LOG","","SPECIFIER","TARGET")
+5 SET SFN=+$GET(TARGET("SPECIFIER"))
+6 IF SFN=0
DO FIELD^DID(FILENUM,"EDIT HISTORY","","SPECIFIER","TARGET")
+7 SET SFN=+$GET(TARGET("SPECIFIER"))
+8 IF SFN=0
QUIT
+9 SET IENS=$ORDER(FDA(SFN,""))
+10 IF IENS=""
QUIT
+11 SET FDA(SFN,IENS,.01)=$$FMTE^XLFDT($$NOW^XLFDT,"5Z")
+12 SET FDA(SFN,IENS,1)="`"_DUZ
+13 ;The word-processing field is set when the packing is done.
+14 SET WP=FDA(SFN,IENS,2)
+15 KILL @WP
+16 SET @WP@(1)="Exchange Install"
+17 QUIT
+18 ;
+19 ;=================================================
NAMECHG(FDA,NAMECHG,FILENUM) ;If this component has been copied to a new
+1 ;name make the change.
+2 NEW CLASS,IENS,PT01
+3 SET IENS=$ORDER(FDA(FILENUM,""))
+4 SET PT01=FDA(FILENUM,IENS,.01)
+5 IF $DATA(NAMECHG(FILENUM,PT01))
Begin DoDot:1
+6 SET FDA(FILENUM,IENS,.01)=NAMECHG(FILENUM,PT01)
+7 IF (FILENUM<801.41)!(FILENUM>811.9)
QUIT
+8 ;Once a component has been copied CLASS can no longer be national.
+9 SET CLASS=$GET(FDA(FILENUM,IENS,100))
+10 IF (CLASS="")!(CLASS["N")
SET FDA(FILENUM,IENS,100)="LOCAL"
+11 ;The Sponsor is also removed.
+12 KILL FDA(FILENUM,IENS,101)
End DoDot:1
+13 QUIT
+14 ;
+15 ;=================================================
RTNLD(PXRMRIEN,START,END,ATTR,RTN) ;Load a routine from the repository into
+1 ;the array RTN.
+2 NEW IND,LINE,LN,ROUTINE
+3 SET LINE=^PXD(811.8,PXRMRIEN,100,START,0)
+4 SET ROUTINE=$PIECE(LINE,";",1)
+5 SET ROUTINE=$TRANSLATE(ROUTINE," ","")
+6 SET ATTR("FILE NUMBER")=0
+7 SET ATTR("NAME")=$PIECE(LINE,";",1)
+8 SET ATTR("NAME")=$TRANSLATE(ATTR("NAME")," ","")
+9 SET ATTR("MIN FIELD LENGTH")=3
+10 SET ATTR("FIELD LENGTH")=8
+11 SET LN=0
+12 FOR IND=START:1:END
Begin DoDot:1
+13 SET LN=LN+1
+14 SET LINE=^PXD(811.8,PXRMRIEN,100,IND,0)
+15 SET RTN(LN,0)=LINE
End DoDot:1
+16 QUIT
+17 ;
+18 ;=================================================
RTNSAVE(RTN,NAME) ;Save the routine loaded in RTN to the name
+1 ;found in NAMECHG.
+2 NEW DIE,XCN
+3 ;%ZOSF("SAVE") requires a global.
+4 KILL ^TMP($JOB,"PXRMRTN")
+5 SET DIE="^TMP($J,""PXRMRTN"","
+6 MERGE ^TMP($JOB,"PXRMRTN")=RTN
+7 SET XCN=0
+8 SET X=NAME
+9 XECUTE ^%ZOSF("SAVE")
+10 KILL ^TMP($JOB,"PXRMRTN")
+11 QUIT
+12 ;
+13 ;=================================================
WORDPROC(PXRMRIEN,WPTMP,I1,I2,IND,WPLCNT) ;Load WPTMP with the word
+1 ;processing field.
+2 NEW I3
+3 FOR I3=1:1:WPLCNT
Begin DoDot:1
+4 SET IND=IND+1
+5 SET WPTMP(I1,I2,I3)=$GET(^PXD(811.8,PXRMRIEN,100,IND,0))
End DoDot:1
+6 QUIT
+7 ;