MDPRE16 ;HINES OIFO/DP - Installation Tasks;02 Mar 2008
;;1.0;CLINICAL PROCEDURES;**16**;Apr 01, 2004;Build 280
;Per VHA Directive 2004-038, this routine should not be modified.
;
; This routine uses the following IAs:
; # 2263 - XPAR calls TOOLKIT (supported)
; #10141 - MES^XPDUTL Kernel (supported)
;
CORE ; Update core files
D:$$VFIELD^DILFD(704.002,.03)
.D:$$GET1^DID(704.002,.03,"","TYPE")["POINTER"
..D MES^XPDUTL(" Updating source field in CP_HL7_LOG file...")
..F X=0:0 S X=$O(^MDC(704.002,X)) Q:'X D
...S Y=$P(^MDC(704.002,X,0),U,3) Q:+Y'=Y
...S Y=$P($G(^MDC(704.108,Y,.2)),U,2)
...S $P(^MDC(704.002,X,0),U,3)=Y
D:$$VFILE^DILFD(704.122)
.D:$$GET1^DID(704.122,"","","NAME")="CARE_ACTION_SCHEDULE"
..D MES^XPDUTL(" Removing obsolete KARDEX structures...")
..N DIU
..S DIU="^MDC(704.121,",DIU(0)="DT" D EN^DIU2
..S DIU="^MDC(704.122,",DIU(0)="DT" D EN^DIU2
;
TERM ; Terminology Pre-Init tasks
; Remove existing CDM files so new xrefs etc. come in clean
D MES^XPDUTL(" Removing existing Clinical Data Model files.")
N MD,DIU
F MD=704.103,704.104,704.105,704.106,704.107,704.108,704.109 D:$$VFILE^DILFD(MD)
.S DIU=MD,DIU(0)="DT" D EN^DIU2
;
FLOW ; Flowsheet pre-init tasks
; Update supplemental pages
D:$$GET1^DID(704.1122,.01,"","TYPE")["POINTER"
.N MDFDA,MDX,MDGUID
.D MES^XPDUTL(" Updating Supplemental Pages...")
.F MDX=0:0 S MDX=$O(^MDC(704.1122,MDX)) Q:'MDX D
..D GETGUID^MDCLIO1(.MDGUID)
..S $P(^MDC(704.1122,MDX,0),U,10)=+^MDC(704.1122,MDX,0)
..S MDFDA(704.1122,MDX_",",.01)=MDGUID
..D FILE^DIE("","MDFDA")
;
D MES^XPDUTL(" MD*1.0*16 Pre-Init Tasks Done.")
Q
;
EXPORT ; KIDS export call
;
; Export the command file into the KIDS global
;
N MDCMD,MDX,MDTXT,DD,DA,IENS,FLD
D MES^XPDUTL(" Preparing Command File for export...")
D GETLST^XPAR(.MDCMD,"SYS","MD COMMANDS","Q")
F MDX=0:0 S MDX=$O(MDCMD(MDX)) Q:'MDX D
.S MDCMD=$P(MDCMD(MDX),U,1)
.D GETWP^XPAR(.MDTXT,"SYS","MD COMMANDS",MDCMD)
.M @XPDGREF@("MD COMMANDS",MDCMD)=MDTXT
D MES^XPDUTL(" Command File moved to KIDS distribution global.")
;
; Export the CDM into the KIDS distribution global
;
D MES^XPDUTL(" Preparing Clinical Data Model for export...")
K ^TMP($J)
F DD=704.101,704.103,704.104,704.105,704.106,704.107,704.108,704.109 D
.F DA=0:0 S DA=$O(^MDC(DD,DA)) Q:'DA D
..I DD=704.108 Q:'$P(^MDC(DD,DA,0),U,9) ; skip inactive mapping tables
..I DD=704.109 Q:'$P(^MDC(704.108,$P(^MDC(704.109,DA,0),U,1),0),U,9) ; skip inactive mapping table entries
..S IENS=DA_"," D GETS^DIQ(DD,IENS,"*","",$NA(^TMP($J)))
.S IENS="" F S IENS=$O(^TMP($J,DD,IENS)) Q:IENS="" D
..F FLD=0:0 S FLD=$O(^TMP($J,DD,IENS,FLD)) Q:'FLD D
...S Y=$O(@XPDGREF@("CDM",""),-1)+1
...S @XPDGREF@("CDM",Y)=DD_";"_(+IENS)_";"_FLD_U_^TMP($J,DD,IENS,FLD)
.K ^TMP($J,DD)
D MES^XPDUTL(" Clinical Data Model moved to KIDS distribution global.")
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMDPRE16 3025 printed Dec 13, 2024@01:43:48 Page 2
MDPRE16 ;HINES OIFO/DP - Installation Tasks;02 Mar 2008
+1 ;;1.0;CLINICAL PROCEDURES;**16**;Apr 01, 2004;Build 280
+2 ;Per VHA Directive 2004-038, this routine should not be modified.
+3 ;
+4 ; This routine uses the following IAs:
+5 ; # 2263 - XPAR calls TOOLKIT (supported)
+6 ; #10141 - MES^XPDUTL Kernel (supported)
+7 ;
CORE ; Update core files
+1 if $$VFIELD^DILFD(704.002,.03)
Begin DoDot:1
+2 if $$GET1^DID(704.002,.03,"","TYPE")["POINTER"
Begin DoDot:2
+3 DO MES^XPDUTL(" Updating source field in CP_HL7_LOG file...")
+4 FOR X=0:0
SET X=$ORDER(^MDC(704.002,X))
if 'X
QUIT
Begin DoDot:3
+5 SET Y=$PIECE(^MDC(704.002,X,0),U,3)
if +Y'=Y
QUIT
+6 SET Y=$PIECE($GET(^MDC(704.108,Y,.2)),U,2)
+7 SET $PIECE(^MDC(704.002,X,0),U,3)=Y
End DoDot:3
End DoDot:2
End DoDot:1
+8 if $$VFILE^DILFD(704.122)
Begin DoDot:1
+9 if $$GET1^DID(704.122,"","","NAME")="CARE_ACTION_SCHEDULE"
Begin DoDot:2
+10 DO MES^XPDUTL(" Removing obsolete KARDEX structures...")
+11 NEW DIU
+12 SET DIU="^MDC(704.121,"
SET DIU(0)="DT"
DO EN^DIU2
+13 SET DIU="^MDC(704.122,"
SET DIU(0)="DT"
DO EN^DIU2
End DoDot:2
End DoDot:1
+14 ;
TERM ; Terminology Pre-Init tasks
+1 ; Remove existing CDM files so new xrefs etc. come in clean
+2 DO MES^XPDUTL(" Removing existing Clinical Data Model files.")
+3 NEW MD,DIU
+4 FOR MD=704.103,704.104,704.105,704.106,704.107,704.108,704.109
if $$VFILE^DILFD(MD)
Begin DoDot:1
+5 SET DIU=MD
SET DIU(0)="DT"
DO EN^DIU2
End DoDot:1
+6 ;
FLOW ; Flowsheet pre-init tasks
+1 ; Update supplemental pages
+2 if $$GET1^DID(704.1122,.01,"","TYPE")["POINTER"
Begin DoDot:1
+3 NEW MDFDA,MDX,MDGUID
+4 DO MES^XPDUTL(" Updating Supplemental Pages...")
+5 FOR MDX=0:0
SET MDX=$ORDER(^MDC(704.1122,MDX))
if 'MDX
QUIT
Begin DoDot:2
+6 DO GETGUID^MDCLIO1(.MDGUID)
+7 SET $PIECE(^MDC(704.1122,MDX,0),U,10)=+^MDC(704.1122,MDX,0)
+8 SET MDFDA(704.1122,MDX_",",.01)=MDGUID
+9 DO FILE^DIE("","MDFDA")
End DoDot:2
End DoDot:1
+10 ;
+11 DO MES^XPDUTL(" MD*1.0*16 Pre-Init Tasks Done.")
+12 QUIT
+13 ;
EXPORT ; KIDS export call
+1 ;
+2 ; Export the command file into the KIDS global
+3 ;
+4 NEW MDCMD,MDX,MDTXT,DD,DA,IENS,FLD
+5 DO MES^XPDUTL(" Preparing Command File for export...")
+6 DO GETLST^XPAR(.MDCMD,"SYS","MD COMMANDS","Q")
+7 FOR MDX=0:0
SET MDX=$ORDER(MDCMD(MDX))
if 'MDX
QUIT
Begin DoDot:1
+8 SET MDCMD=$PIECE(MDCMD(MDX),U,1)
+9 DO GETWP^XPAR(.MDTXT,"SYS","MD COMMANDS",MDCMD)
+10 MERGE @XPDGREF@("MD COMMANDS",MDCMD)=MDTXT
End DoDot:1
+11 DO MES^XPDUTL(" Command File moved to KIDS distribution global.")
+12 ;
+13 ; Export the CDM into the KIDS distribution global
+14 ;
+15 DO MES^XPDUTL(" Preparing Clinical Data Model for export...")
+16 KILL ^TMP($JOB)
+17 FOR DD=704.101,704.103,704.104,704.105,704.106,704.107,704.108,704.109
Begin DoDot:1
+18 FOR DA=0:0
SET DA=$ORDER(^MDC(DD,DA))
if 'DA
QUIT
Begin DoDot:2
+19 ; skip inactive mapping tables
IF DD=704.108
if '$PIECE(^MDC(DD,DA,0),U,9)
QUIT
+20 ; skip inactive mapping table entries
IF DD=704.109
if '$PIECE(^MDC(704.108,$PIECE(^MDC(704.109,DA,0),U,1),0),U,9)
QUIT
+21 SET IENS=DA_","
DO GETS^DIQ(DD,IENS,"*","",$NAME(^TMP($JOB)))
End DoDot:2
+22 SET IENS=""
FOR
SET IENS=$ORDER(^TMP($JOB,DD,IENS))
if IENS=""
QUIT
Begin DoDot:2
+23 FOR FLD=0:0
SET FLD=$ORDER(^TMP($JOB,DD,IENS,FLD))
if 'FLD
QUIT
Begin DoDot:3
+24 SET Y=$ORDER(@XPDGREF@("CDM",""),-1)+1
+25 SET @XPDGREF@("CDM",Y)=DD_";"_(+IENS)_";"_FLD_U_^TMP($JOB,DD,IENS,FLD)
End DoDot:3
End DoDot:2
+26 KILL ^TMP($JOB,DD)
End DoDot:1
+27 DO MES^XPDUTL(" Clinical Data Model moved to KIDS distribution global.")
+28 QUIT