DG531014P ;ALB/MCF - DG*5.3*1014 POST-INSTALL ROUTINE ;24 July 2020 3:00 PM
;;5.3;Registration;**1014**;Aug 13, 1993;Build 42
; ICRs:
; 10141 : BMES^XPDUTL
; : MES^XPDUTL
; 5421 : REGREST^XOBWLIB
; 7190 : Read access to file 18.02
; 7191 : R/W access to file 18.12
; 3352 : Provides the use of DIEZ^DIKCUTL3 to recompile all compiled input templates that contain specific fields.
;
Q
EN ; Main entry point for post-install to set up web server and services and recompile input templates
; create HWSC web server and web services entries
N DGSRVR,DGPREFIX,DGKEY,DGREGION
D BMES^XPDUTL(">>> Patch DG*5.3*1014 - Post-install started.")
D BMES^XPDUTL(">>> Patch DG*5.3*1014 - Post-install set up for SSL Configuration...")
D INIT
D SERVICES
D SERVER
D BMES^XPDUTL(">>> Post-install SSL set up complete.")
;
RECOMP ;Recompile input templates
;Recompile all compiled input templates that contain specific fields.
;This is needed because the data dictionary definition of these fields
;has changed and they are being exported via KIDS.
;
N DGFLD
;
D BMES^XPDUTL(">>> Recompile all compiled input templates that contain the following fields:")
;
D BMES^XPDUTL(" o PRIMARY ELIGIBILITY (#.361) field in PATIENT (#2) file")
D MES^XPDUTL(" o ELIGIBILITY (#.01) field in PATIENT ELIGIBILITIES (#2.0361)")
D MES^XPDUTL(" subfile of PATIENT (#2) file")
;build array of file and field numbers for top-level (#2) file fields being exported
;array format: DGFLD(file#,field)=""
S DGFLD(2,.361)=""
S DGFLD(2.0361,.01)=""
;recompile all compiled input templates that contain the fields in the DGLFD array passed by reference
D DIEZ^DIKCUTL3(2,.DGFLD)
K DGFLD
;
D BMES^XPDUTL(">>> Re-compile completed.")
D BMES^XPDUTL(">>> Patch DG*5.3*1014 - Post-install complete.")
Q
INIT ; Initialize variables DGPREFIX, DGSRVR, DGREGION, and DGKEY
N DGCOUNT,DGDATA,DGSTATION,DGEXIT
; PREFIX to more quickly change the server/service names per site or for testing
S DGPREFIX="DG UAM AV " ; include the space at the end of the prefix
S DGSRVR=DGPREFIX_"SERVER"
; Get the current site station number
S DGSTATION=$P($$SITE^VASITE,"^",3) ;Output= Institution file pointer^Institution name^station number with suffix
; Set the default region
S DGREGION="Staging",DGEXIT=0
; Loop to find the matching region for the station number
F DGCOUNT=1:1 S DGDATA=$P($T(REGMAP+DGCOUNT),";;",2) Q:DGDATA="END" D Q:DGEXIT
. I $P(DGDATA,";",1)=DGSTATION S DGREGION=$P(DGDATA,";",3),DGEXIT=1
; Get the matching DGKEY for the region
S DGEXIT=0
F DGCOUNT=1:1 S DGDATA=$P($T(KEYMAP+DGCOUNT),";;",2) Q:DGDATA="END" D Q:DGEXIT
. I $P(DGDATA,";",1)=DGREGION S DGKEY=$P(DGDATA,";",2),DGEXIT=1
D BMES^XPDUTL(">UAM Address Validation Key assigned. Region: "_DGREGION)
Q
SERVICES ; use REGREST^XOBWLIB
N DGI,DGILOWCASE,DGCNTXTRT,DGSRVC
D BMES^XPDUTL(">Updating WEB SERVICE (#18.02) file...")
F DGI="CANDIDATE","VALIDATE" D
. ; use the prefix name from INIT
. S DGSRVC=DGPREFIX_DGI
. S DGILOWCASE=$TR(DGI,"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")
. IF DGI="CANDIDATE" S DGCNTXTRT="services/address_validation/v2/"_DGILOWCASE_"?apikey="_DGKEY
. IF DGI="VALIDATE" S DGCNTXTRT="services/address_validation/v1/"_DGILOWCASE_"?apikey="_DGKEY
. D REGREST^XOBWLIB(DGSRVC,DGCNTXTRT) ; REGREST^XOBWLIB handles all messaging.
Q
SERVER ; set up web server
D MES^XPDUTL(">Updating WEB SERVER (#18.12) file...")
N DGIEN,DGIENS,DGSERVER,DGFDAI,DGERR,DGERR12,DGERR02,DGI,DGSRVC,DGSRVIEN,DGSERVICE
S DGIEN("SRV")=$$FIND1^DIC(18.12,,"B",DGSRVR)
I DGIEN("SRV") S DGIENS("SRV")=DGIEN("SRV")_","
E S DGIENS("SRV")="+1,"
S DGSERVER(18.12,DGIENS("SRV"),.01)=DGSRVR
S DGSERVER(18.12,DGIENS("SRV"),.03)=443
; If the Region is "staging" (non production site) the endpoint is the sandbox, otherwise, use the Production endpoint
S DGSERVER(18.12,DGIENS("SRV"),.04)=$S(DGREGION="Staging":"sandbox-api.domain.ext",1:"api.domain.ext")
S DGSERVER(18.12,DGIENS("SRV"),.06)=1
S DGSERVER(18.12,DGIENS("SRV"),1.01)=0
S DGSERVER(18.12,DGIENS("SRV"),3.01)=1
S DGSERVER(18.12,DGIENS("SRV"),3.02)="encrypt_only_tlsv12"
S DGSERVER(18.12,DGIENS("SRV"),3.03)="443"
I DGIEN("SRV") D FILE^DIE("","DGSERVER","DGERR12") ; update existing entry
I 'DGIEN("SRV") D UPDATE^DIE("","DGSERVER","DGFDAI","DGERR") ; create new entry
I $D(DGFDAI) S DGIENS("SRV")=DGFDAI(1)_",",DGIEN("SRV")=DGFDAI(1)
I '$D(DGERR12("DIERR",1,"TEXT",1)) D MES^XPDUTL(" o WEB SERVER '"_DGSRVR_"' addition/update succeeded.")
I $D(DGERR12("DIERR",1,"TEXT",1)) D MES^XPDUTL(" o WEB SERVER '"_DGSRVR_"' Error: "_DGERR12("DIERR",1,"TEXT",1)) Q
; once server is set up add the web services in the web service
F DGI="CANDIDATE","VALIDATE" D
. S DGSRVC=DGPREFIX_DGI
. S DGIENS("SRC")="+1,"
. S DGSRVIEN=0
. F S DGSRVIEN=$O(^XOB(18.12,DGIEN("SRV"),100,"B",DGSRVIEN)) Q:'DGSRVIEN D
. . I $$GET1^DIQ(18.02,DGSRVIEN,.01)=DGSRVC S DGIENS("SRC")=DGSRVIEN_","
. I DGIENS("SRC")'="+1," Q ; don't update subentry pointers if already exist.
. K DGSERVICE,DGFDAI
. S DGSERVICE(18.121,DGIENS("SRC")_DGIENS("SRV"),.01)=DGSRVC
. S DGSERVICE(18.121,DGIENS("SRC")_DGIENS("SRV"),.06)="ENABLED"
. D UPDATE^DIE("E","DGSERVICE","DGFDAI","DGERR02") ; create new entry
. I $D(DGERR02("DIERR",1,"TEXT",1)) D MES^XPDUTL(" o "_DGERR12("DIERR",1,"TEXT",1))
. I '$D(DGERR02("DIERR",1,"TEXT",1)) D MES^XPDUTL(" o "_DGSRVC_" service successfully authorized on server.")
Q
REGMAP ; Station-to-Region mapping table - Format: ;;Station ID;VISN;Region;VHA Facility Name
;;358;21;Pacific;Manila Outpatient Clinic (Philippines)
;;402;1;North Atlantic;VA Maine Healthcare Systems (Togus)
;;405;1;North Atlantic;White River Junction VA Medical Center
;;436;19;Continental;VA Montana Health Care System (Ft. Harrison, Miles City)
;;437;23;Midwest;Fargo VA Medical Center
;;438;23;Midwest;Royal C. Johnson Veterans Memorial Medical Center (Sioux Falls)
;;442;19;Continental;Cheyenne VA Medical Center
;;459;21;Pacific;VA Pacific Islands Health Care System (Honolulu)
;;460;4;North Atlantic;Wilmington VA Medical Center
;;463;20;Pacific;Alaska VA Healthcare System (Anchorage)
;;501;18;Pacific;New Mexico VA Health Care System (Albuquerque)
;;502;16;Continental;Alexandria VA Health Care System (Pineville)
;;503;4;North Atlantic;Altoona - James E. Van Zandt VA Medical Center
;;504;17;Continental;Amarillo VA Health Care System
;;506;11;Midwest;VA Ann Arbor Healthcare System
;;508;7;Southeast;Atlanta VA Health Care System
;;509;7;Southeast;Charlie Norwood VA Medical Center (Augusta)
;;512;5;North Atlantic;VA Maryland Health Care System (Baltimore, Loch Raven, Perry Point)
;;515;11;Midwest;Battle Creek VA Medical Center
;;516;8;Southeast;C.W. Bill Young VA Medical Center (Bay Pines)
;;517;5;North Atlantic;Beckley VA Medical Center
;;518;1;North Atlantic;Edith Nourse Rogers Memorial Veterans Hospital (Bedford VA)
;;519;17;Continental;West Texas VA Health Care System (Big Spring)
;;520;16;Continental;Gulf Coast Veterans Health Care System (Biloxi)
;;521;7;Southeast;Birmingham VA Medical Center
;;523;1;North Atlantic;VA Boston Health Care System (Jamaica Plain, Brockton, West Roxbury)
;;526;3;North Atlantic;James J. Peters VA Medical Center (Bronx, NY)
;;528;2;North Atlantic;VA Western New York Healthcare System (Buffalo and Batavia)
;;529;4;North Atlantic;VA Butler Healthcare
;;531;20;Pacific;Boise VA Medical Center
;;534;7;Southeast;Ralph H. Johnson VA Medical Center (Charleston)
;;537;12;Midwest;Jesse Brown VA Medical Center (Chicago Westside, Chicago Lakeside)
;;538;10;Midwest;Chillicothe VA Medical Center
;;539;10;Midwest;Cincinnati VA Medical Center
;;540;5;North Atlantic;Louis A. Johnson VA Medical Center (Clarksburg)
;;541;10;Midwest;Louis Stokes Cleveland VA Medical Center
;;542;4;North Atlantic;Coatesville VA Medical Center
;;544;7;Southeast;Wm. Jennings Bryan Dorn VA Medical Center (Columbia)
;;546;8;Southeast;Miami VA Healthcare System
;;548;8;Southeast;West Palm Beach VA Medical Center
;;549;17;Continental;VA North Texas Health Care System (Dallas, Bonham)
;;550;11;Midwest;VA Illiana Health Care System (Danville)
;;552;10;Midwest;Dayton VA Medical Center
;;553;11;Midwest;John D. Dingell VA Medical Center (Detroit)
;;554;19;Continental;VA Eastern Colorado Health Care System (ECHCS) (Denver, Fort Lyon)
;;556;12;Midwest;Captain James A. Lovell Federal Health Care Center (North Chicago)
;;557;7;Southeast;Carl Vinson VA Medical Center (Dublin)
;;558;6;North Atlantic;Durham VA Medical Center
;;561;3;North Atlantic;VA New Jersey Health Care System (East Orange, Lyons)
;;562;4;North Atlantic;Erie VA Medical Center
;;564;16;Continental;Veterans Health Care System of the Ozarks (Fayetteville)
;;565;6;North Atlantic;Fayetteville VA Medical Center
;;568;23;Midwest;VA Black Hills Health Care System (Fort Meade, Hot Springs)
;;570;21;Pacific;Central California VA Health Care System (Fresno)
;;573;8;Southeast;VA North Florida / South Georgia VA Health Care System (Gainesville, Lake City)
;;575;19;Continental;Grand Junction VA Medical Center
;;578;12;Midwest;Edward Hines Jr. VA Hospital (Hines)
;;580;16;Continental;Michael E. DeBakey VA Medical Center (Houston)
;;581;5;North Atlantic;Huntington VA Medical Center
;;583;11;Midwest;Richard L. Roudebush VA Medical Center (Indianapolis)
;;585;12;Midwest;Oscar G. Johnson VA Medical Center (Iron Mountain)
;;586;16;Continental;G.V. (Sonny) Montgomery VA Medical Center (Jackson)
;;589;15;Midwest;VA Eastern Kansas Health Care System (Kansas City, Columbia, Topeka, Leavenworth, Wichita) (formerly VA Heartland - West)
;;590;6;North Atlantic;Hampton VA Medical Center
;;593;21;Pacific;VA Southern Nevada Healthcare System (Las Vegas)
;;595;4;North Atlantic;Lebanon VA Medical Center
;;596;9;Southeast;Lexington VA Medical Center (Leestown, Cooper)
;;598;16;Continental;Central Arkansas Veterans Healthcare System (North Little Rock, Little Rock)
;;600;22;Pacific;VA Long Beach Heathcare System
;;603;9;Southeast;Robley Rex VA Medical Center (Louisville)
;;605;22;Pacific;Jerry L. Pettis Memorial VA Medical Center (Loma Linda)
;;607;12;Midwest;William S. Middleton Memorial Veterans Hospital (Madison)
;;608;1;North Atlantic;Manchester VA Medical Center
;;610;11;Midwest;VA Northern Indiana Health Care System (Marion, Fort Wayne)
;;612;21;Pacific;VA Northern California Health Care System (Mather)
;;613;5;North Atlantic;Martinsburg VA Medical Center
;;614;9;Southeast;Memphis VA Medical Center
;;618;23;Midwest;Minneapolis VA Medical Center
;;619;7;Southeast;Central Alabama Veterans Health Care System (Tuskegee, Montgomery)
;;620;3;North Atlantic;VA Hudson Valley Health Care System (Montrose, Castle Point)
;;621;9;Southeast;James H. Quillen VA Medical Center (Mountain Home)
;;623;19;Continental;Jack C. Montgomery VA Medical Center (Muskogee)
;;626;9;Southeast;VA Tennessee Valley Health Care System (Nashville, Murfreesboro)
;;629;16;Continental;Southeast Louisiana Veterans Health Care System (New Orleans)
;;630;3;North Atlantic;VA New York Harbor Health Care System (Brooklyn, Manhattan)
;;631;1;North Atlantic;VA Central Western Massachusetts Healthcare System (Formerly Northampton VA Medical Center)
;;632;3;North Atlantic;Northport VA Medical Center
;;635;19;Continental;Oklahoma City VA Medical Center
;;636;23;Midwest;VA Nebraska-Western Iowa Health Care System (Omaha, Lincoln, Grand Island of NE, Des Moines, Knoxville, Iowa City of IA) aka VA Central Plains Health Care System
;;637;6;North Atlantic;Asheville VA Medical Center
;;640;21;Pacific;VA Palo Alto Health Care System (Menlo Park, Palo Alto, Livermore)
;;642;4;North Atlantic;Philadelphia VA Medical Center
;;644;18;Pacific;Phoenix VA Health Care System
;;646;4;North Atlantic;VA Pittsburgh Health Care System (Pittsburgh University Dr., H. J. Heinz Campus)
;;648;20;Pacific;VA Portland Health Care System (Portland, Vancouver)
;;649;18;Pacific;Northern Arizona VA Health Care System (Prescott)
;;650;1;North Atlantic;Providence VA Medical Center
;;652;6;North Atlantic;Hunter Holmes McGuire VA Medical Center (Richmond)
;;653;20;Pacific;VA Roseburg Healthcare System
;;654;21;Pacific;VA Sierra Nevada Health Care System (Reno)
;;655;11;Midwest;Aleda E. Lutz VA Medical Center (Saginaw)
;;656;23;Midwest;St. Cloud VA Health Care System
;;657;15;Midwest;VA St. Louis Health Care System (St. Louis, Poplar Bluff, Marion) (formerly VA Heartland East)
;;658;6;North Atlantic;Salem VA Medical Center
;;659;6;North Atlantic;W.G. (Bill) Hefner VA Medical Center (Salisbury)
;;660;19;Continental;VA Salt Lake City Health Care System
;;662;21;Pacific;San Francisco VA Medical Center
;;663;20;Pacific;VA Puget Sound Health Care System (Seattle, American Lake)
;;664;22;Pacific;VA San Diego Healthcare System
;;666;19;Continental;Sheridan VA Medical Center
;;667;16;Continental;Overton Brooks VA Medical Center (Shreveport)
;;668;20;Pacific;Mann-Grandstaff VA Medical Center (Spokane)
;;671;17;Continental;South Texas Veterans Health Care System (San Antonio, Kerrville)
;;672;8;Southeast;VA Caribbean Healthcare System (San Juan)
;;673;8;Southeast;James A. Haley Veterans' Hospital (Tampa)
;;674;17;Continental;Central Texas Veterans Health Care System (Temple, Waco)
;;675;8;Southeast;Orlando VA Medical Center
;;676;12;Midwest;Tomah VA Medical Center
;;678;18;Pacific;Southern Arizona VA Health Care System (Tucson)
;;679;7;Southeast;Tuscaloosa VA Medical Center
;;687;20;Pacific;Jonathan M. Wainwright Memorial VA Medical Center (Walla Walla)
;;688;5;North Atlantic;Washington DC VA Medical Center
;;689;1;North Atlantic;VA Connecticut Health Care System (West Haven, Newington)
;;691;22;Pacific;VA Greater Los Angeles Healthcare System (Los Angeles, West Los Angeles)
;;692;20;Pacific;VA Southern Oregon Rehabilitation Center & Clinics (White City)
;;693;4;North Atlantic;Wilkes-Barre VA Medical Center
;;695;12;Midwest;Clement J. Zablocki Veterans Affairs Medical Center (Milwaukee)
;;740;17;Continental;VA Health Care Center at Harlingen
;;740;17;Continental;VA Texas Valley Coastal Bend Health Care System
;;741;;Continental;HEALTH ADMIN CENTER, CO
;;756;17;Continental;El Paso VA Health Care System
;;757;10;Midwest;Chalmers P. Wylie VA Ambulatory Care Center (Columbus)
;;528A5;2;North Atlantic;Canandaigua VA Medical Center
;;528A6;2;North Atlantic;Bath VA Medical Center
;;528A7;2;North Atlantic;Syracuse VA Medical Center
;;528A8;2;North Atlantic;Albany VA Medical Center (Samuel S. Stratton)
;;589A4;15;Midwest;Columbia VA Medical Center
;;589A5;15;Midwest;East Kansas Health Care System
;;589A7;15;Midwest;Wichita Medical Center
;;636A6;23;Midwest;VA Central Iowa Health Care System (Des Moines)
;;636A8;23;Midwest;Iowa City VA Health Care System
;;657A4;15;Midwest;John J. Pershing VA Medical Center (Popular Bluff)
;;657A5;15;Midwest;Marion Medical Center
;;VISN 2;2;North Atlantic;VISN 2 - Upstate New York Health Care System (Buffalo, Batavia, Canandaigua, Syracuse, Bath, Albany
;;END
KEYMAP ; Region 1: North Atlantic, 2: Southeast, 3: Midwest, 4: Continental, 5: Pacific - Format: ;;Region;Key
;;North Atlantic;2xyTcbuRebCNCQi2UjFofcqxU77euN4s
;;Southeast;FKzEuQgt4KGg2ZvNcaDiO94Yoke8SOnM
;;Midwest;YN6kHDcRDNL8zzre8RGI2haDrtSWU365
;;Continental;oIXW6ik6Ly5zwWkK22TP0BSHZXlxCePU
;;Pacific;hs13RWTYTBcg0EsiaVp59tRCuE4f9CqL
;;Staging;cWhVcsiDfLFQ5TaFskVixKR5Wv5RsZd7
;;END
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HDG531014P 15787 printed Nov 22, 2024@17:45:38 Page 2
DG531014P ;ALB/MCF - DG*5.3*1014 POST-INSTALL ROUTINE ;24 July 2020 3:00 PM
+1 ;;5.3;Registration;**1014**;Aug 13, 1993;Build 42
+2 ; ICRs:
+3 ; 10141 : BMES^XPDUTL
+4 ; : MES^XPDUTL
+5 ; 5421 : REGREST^XOBWLIB
+6 ; 7190 : Read access to file 18.02
+7 ; 7191 : R/W access to file 18.12
+8 ; 3352 : Provides the use of DIEZ^DIKCUTL3 to recompile all compiled input templates that contain specific fields.
+9 ;
+10 QUIT
EN ; Main entry point for post-install to set up web server and services and recompile input templates
+1 ; create HWSC web server and web services entries
+2 NEW DGSRVR,DGPREFIX,DGKEY,DGREGION
+3 DO BMES^XPDUTL(">>> Patch DG*5.3*1014 - Post-install started.")
+4 DO BMES^XPDUTL(">>> Patch DG*5.3*1014 - Post-install set up for SSL Configuration...")
+5 DO INIT
+6 DO SERVICES
+7 DO SERVER
+8 DO BMES^XPDUTL(">>> Post-install SSL set up complete.")
+9 ;
RECOMP ;Recompile input templates
+1 ;Recompile all compiled input templates that contain specific fields.
+2 ;This is needed because the data dictionary definition of these fields
+3 ;has changed and they are being exported via KIDS.
+4 ;
+5 NEW DGFLD
+6 ;
+7 DO BMES^XPDUTL(">>> Recompile all compiled input templates that contain the following fields:")
+8 ;
+9 DO BMES^XPDUTL(" o PRIMARY ELIGIBILITY (#.361) field in PATIENT (#2) file")
+10 DO MES^XPDUTL(" o ELIGIBILITY (#.01) field in PATIENT ELIGIBILITIES (#2.0361)")
+11 DO MES^XPDUTL(" subfile of PATIENT (#2) file")
+12 ;build array of file and field numbers for top-level (#2) file fields being exported
+13 ;array format: DGFLD(file#,field)=""
+14 SET DGFLD(2,.361)=""
+15 SET DGFLD(2.0361,.01)=""
+16 ;recompile all compiled input templates that contain the fields in the DGLFD array passed by reference
+17 DO DIEZ^DIKCUTL3(2,.DGFLD)
+18 KILL DGFLD
+19 ;
+20 DO BMES^XPDUTL(">>> Re-compile completed.")
+21 DO BMES^XPDUTL(">>> Patch DG*5.3*1014 - Post-install complete.")
+22 QUIT
INIT ; Initialize variables DGPREFIX, DGSRVR, DGREGION, and DGKEY
+1 NEW DGCOUNT,DGDATA,DGSTATION,DGEXIT
+2 ; PREFIX to more quickly change the server/service names per site or for testing
+3 ; include the space at the end of the prefix
SET DGPREFIX="DG UAM AV "
+4 SET DGSRVR=DGPREFIX_"SERVER"
+5 ; Get the current site station number
+6 ;Output= Institution file pointer^Institution name^station number with suffix
SET DGSTATION=$PIECE($$SITE^VASITE,"^",3)
+7 ; Set the default region
+8 SET DGREGION="Staging"
SET DGEXIT=0
+9 ; Loop to find the matching region for the station number
+10 FOR DGCOUNT=1:1
SET DGDATA=$PIECE($TEXT(REGMAP+DGCOUNT),";;",2)
if DGDATA="END"
QUIT
Begin DoDot:1
+11 IF $PIECE(DGDATA,";",1)=DGSTATION
SET DGREGION=$PIECE(DGDATA,";",3)
SET DGEXIT=1
End DoDot:1
if DGEXIT
QUIT
+12 ; Get the matching DGKEY for the region
+13 SET DGEXIT=0
+14 FOR DGCOUNT=1:1
SET DGDATA=$PIECE($TEXT(KEYMAP+DGCOUNT),";;",2)
if DGDATA="END"
QUIT
Begin DoDot:1
+15 IF $PIECE(DGDATA,";",1)=DGREGION
SET DGKEY=$PIECE(DGDATA,";",2)
SET DGEXIT=1
End DoDot:1
if DGEXIT
QUIT
+16 DO BMES^XPDUTL(">UAM Address Validation Key assigned. Region: "_DGREGION)
+17 QUIT
SERVICES ; use REGREST^XOBWLIB
+1 NEW DGI,DGILOWCASE,DGCNTXTRT,DGSRVC
+2 DO BMES^XPDUTL(">Updating WEB SERVICE (#18.02) file...")
+3 FOR DGI="CANDIDATE","VALIDATE"
Begin DoDot:1
+4 ; use the prefix name from INIT
+5 SET DGSRVC=DGPREFIX_DGI
+6 SET DGILOWCASE=$TRANSLATE(DGI,"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")
+7 IF DGI="CANDIDATE"
SET DGCNTXTRT="services/address_validation/v2/"_DGILOWCASE_"?apikey="_DGKEY
+8 IF DGI="VALIDATE"
SET DGCNTXTRT="services/address_validation/v1/"_DGILOWCASE_"?apikey="_DGKEY
+9 ; REGREST^XOBWLIB handles all messaging.
DO REGREST^XOBWLIB(DGSRVC,DGCNTXTRT)
End DoDot:1
+10 QUIT
SERVER ; set up web server
+1 DO MES^XPDUTL(">Updating WEB SERVER (#18.12) file...")
+2 NEW DGIEN,DGIENS,DGSERVER,DGFDAI,DGERR,DGERR12,DGERR02,DGI,DGSRVC,DGSRVIEN,DGSERVICE
+3 SET DGIEN("SRV")=$$FIND1^DIC(18.12,,"B",DGSRVR)
+4 IF DGIEN("SRV")
SET DGIENS("SRV")=DGIEN("SRV")_","
+5 IF '$TEST
SET DGIENS("SRV")="+1,"
+6 SET DGSERVER(18.12,DGIENS("SRV"),.01)=DGSRVR
+7 SET DGSERVER(18.12,DGIENS("SRV"),.03)=443
+8 ; If the Region is "staging" (non production site) the endpoint is the sandbox, otherwise, use the Production endpoint
+9 SET DGSERVER(18.12,DGIENS("SRV"),.04)=$SELECT(DGREGION="Staging":"sandbox-api.domain.ext",1:"api.domain.ext")
+10 SET DGSERVER(18.12,DGIENS("SRV"),.06)=1
+11 SET DGSERVER(18.12,DGIENS("SRV"),1.01)=0
+12 SET DGSERVER(18.12,DGIENS("SRV"),3.01)=1
+13 SET DGSERVER(18.12,DGIENS("SRV"),3.02)="encrypt_only_tlsv12"
+14 SET DGSERVER(18.12,DGIENS("SRV"),3.03)="443"
+15 ; update existing entry
IF DGIEN("SRV")
DO FILE^DIE("","DGSERVER","DGERR12")
+16 ; create new entry
IF 'DGIEN("SRV")
DO UPDATE^DIE("","DGSERVER","DGFDAI","DGERR")
+17 IF $DATA(DGFDAI)
SET DGIENS("SRV")=DGFDAI(1)_","
SET DGIEN("SRV")=DGFDAI(1)
+18 IF '$DATA(DGERR12("DIERR",1,"TEXT",1))
DO MES^XPDUTL(" o WEB SERVER '"_DGSRVR_"' addition/update succeeded.")
+19 IF $DATA(DGERR12("DIERR",1,"TEXT",1))
DO MES^XPDUTL(" o WEB SERVER '"_DGSRVR_"' Error: "_DGERR12("DIERR",1,"TEXT",1))
QUIT
+20 ; once server is set up add the web services in the web service
+21 FOR DGI="CANDIDATE","VALIDATE"
Begin DoDot:1
+22 SET DGSRVC=DGPREFIX_DGI
+23 SET DGIENS("SRC")="+1,"
+24 SET DGSRVIEN=0
+25 FOR
SET DGSRVIEN=$ORDER(^XOB(18.12,DGIEN("SRV"),100,"B",DGSRVIEN))
if 'DGSRVIEN
QUIT
Begin DoDot:2
+26 IF $$GET1^DIQ(18.02,DGSRVIEN,.01)=DGSRVC
SET DGIENS("SRC")=DGSRVIEN_","
End DoDot:2
+27 ; don't update subentry pointers if already exist.
IF DGIENS("SRC")'="+1,"
QUIT
+28 KILL DGSERVICE,DGFDAI
+29 SET DGSERVICE(18.121,DGIENS("SRC")_DGIENS("SRV"),.01)=DGSRVC
+30 SET DGSERVICE(18.121,DGIENS("SRC")_DGIENS("SRV"),.06)="ENABLED"
+31 ; create new entry
DO UPDATE^DIE("E","DGSERVICE","DGFDAI","DGERR02")
+32 IF $DATA(DGERR02("DIERR",1,"TEXT",1))
DO MES^XPDUTL(" o "_DGERR12("DIERR",1,"TEXT",1))
+33 IF '$DATA(DGERR02("DIERR",1,"TEXT",1))
DO MES^XPDUTL(" o "_DGSRVC_" service successfully authorized on server.")
End DoDot:1
+34 QUIT
REGMAP ; Station-to-Region mapping table - Format: ;;Station ID;VISN;Region;VHA Facility Name
+1 ;;358;21;Pacific;Manila Outpatient Clinic (Philippines)
+2 ;;402;1;North Atlantic;VA Maine Healthcare Systems (Togus)
+3 ;;405;1;North Atlantic;White River Junction VA Medical Center
+4 ;;436;19;Continental;VA Montana Health Care System (Ft. Harrison, Miles City)
+5 ;;437;23;Midwest;Fargo VA Medical Center
+6 ;;438;23;Midwest;Royal C. Johnson Veterans Memorial Medical Center (Sioux Falls)
+7 ;;442;19;Continental;Cheyenne VA Medical Center
+8 ;;459;21;Pacific;VA Pacific Islands Health Care System (Honolulu)
+9 ;;460;4;North Atlantic;Wilmington VA Medical Center
+10 ;;463;20;Pacific;Alaska VA Healthcare System (Anchorage)
+11 ;;501;18;Pacific;New Mexico VA Health Care System (Albuquerque)
+12 ;;502;16;Continental;Alexandria VA Health Care System (Pineville)
+13 ;;503;4;North Atlantic;Altoona - James E. Van Zandt VA Medical Center
+14 ;;504;17;Continental;Amarillo VA Health Care System
+15 ;;506;11;Midwest;VA Ann Arbor Healthcare System
+16 ;;508;7;Southeast;Atlanta VA Health Care System
+17 ;;509;7;Southeast;Charlie Norwood VA Medical Center (Augusta)
+18 ;;512;5;North Atlantic;VA Maryland Health Care System (Baltimore, Loch Raven, Perry Point)
+19 ;;515;11;Midwest;Battle Creek VA Medical Center
+20 ;;516;8;Southeast;C.W. Bill Young VA Medical Center (Bay Pines)
+21 ;;517;5;North Atlantic;Beckley VA Medical Center
+22 ;;518;1;North Atlantic;Edith Nourse Rogers Memorial Veterans Hospital (Bedford VA)
+23 ;;519;17;Continental;West Texas VA Health Care System (Big Spring)
+24 ;;520;16;Continental;Gulf Coast Veterans Health Care System (Biloxi)
+25 ;;521;7;Southeast;Birmingham VA Medical Center
+26 ;;523;1;North Atlantic;VA Boston Health Care System (Jamaica Plain, Brockton, West Roxbury)
+27 ;;526;3;North Atlantic;James J. Peters VA Medical Center (Bronx, NY)
+28 ;;528;2;North Atlantic;VA Western New York Healthcare System (Buffalo and Batavia)
+29 ;;529;4;North Atlantic;VA Butler Healthcare
+30 ;;531;20;Pacific;Boise VA Medical Center
+31 ;;534;7;Southeast;Ralph H. Johnson VA Medical Center (Charleston)
+32 ;;537;12;Midwest;Jesse Brown VA Medical Center (Chicago Westside, Chicago Lakeside)
+33 ;;538;10;Midwest;Chillicothe VA Medical Center
+34 ;;539;10;Midwest;Cincinnati VA Medical Center
+35 ;;540;5;North Atlantic;Louis A. Johnson VA Medical Center (Clarksburg)
+36 ;;541;10;Midwest;Louis Stokes Cleveland VA Medical Center
+37 ;;542;4;North Atlantic;Coatesville VA Medical Center
+38 ;;544;7;Southeast;Wm. Jennings Bryan Dorn VA Medical Center (Columbia)
+39 ;;546;8;Southeast;Miami VA Healthcare System
+40 ;;548;8;Southeast;West Palm Beach VA Medical Center
+41 ;;549;17;Continental;VA North Texas Health Care System (Dallas, Bonham)
+42 ;;550;11;Midwest;VA Illiana Health Care System (Danville)
+43 ;;552;10;Midwest;Dayton VA Medical Center
+44 ;;553;11;Midwest;John D. Dingell VA Medical Center (Detroit)
+45 ;;554;19;Continental;VA Eastern Colorado Health Care System (ECHCS) (Denver, Fort Lyon)
+46 ;;556;12;Midwest;Captain James A. Lovell Federal Health Care Center (North Chicago)
+47 ;;557;7;Southeast;Carl Vinson VA Medical Center (Dublin)
+48 ;;558;6;North Atlantic;Durham VA Medical Center
+49 ;;561;3;North Atlantic;VA New Jersey Health Care System (East Orange, Lyons)
+50 ;;562;4;North Atlantic;Erie VA Medical Center
+51 ;;564;16;Continental;Veterans Health Care System of the Ozarks (Fayetteville)
+52 ;;565;6;North Atlantic;Fayetteville VA Medical Center
+53 ;;568;23;Midwest;VA Black Hills Health Care System (Fort Meade, Hot Springs)
+54 ;;570;21;Pacific;Central California VA Health Care System (Fresno)
+55 ;;573;8;Southeast;VA North Florida / South Georgia VA Health Care System (Gainesville, Lake City)
+56 ;;575;19;Continental;Grand Junction VA Medical Center
+57 ;;578;12;Midwest;Edward Hines Jr. VA Hospital (Hines)
+58 ;;580;16;Continental;Michael E. DeBakey VA Medical Center (Houston)
+59 ;;581;5;North Atlantic;Huntington VA Medical Center
+60 ;;583;11;Midwest;Richard L. Roudebush VA Medical Center (Indianapolis)
+61 ;;585;12;Midwest;Oscar G. Johnson VA Medical Center (Iron Mountain)
+62 ;;586;16;Continental;G.V. (Sonny) Montgomery VA Medical Center (Jackson)
+63 ;;589;15;Midwest;VA Eastern Kansas Health Care System (Kansas City, Columbia, Topeka, Leavenworth, Wichita) (formerly VA Heartland - West)
+64 ;;590;6;North Atlantic;Hampton VA Medical Center
+65 ;;593;21;Pacific;VA Southern Nevada Healthcare System (Las Vegas)
+66 ;;595;4;North Atlantic;Lebanon VA Medical Center
+67 ;;596;9;Southeast;Lexington VA Medical Center (Leestown, Cooper)
+68 ;;598;16;Continental;Central Arkansas Veterans Healthcare System (North Little Rock, Little Rock)
+69 ;;600;22;Pacific;VA Long Beach Heathcare System
+70 ;;603;9;Southeast;Robley Rex VA Medical Center (Louisville)
+71 ;;605;22;Pacific;Jerry L. Pettis Memorial VA Medical Center (Loma Linda)
+72 ;;607;12;Midwest;William S. Middleton Memorial Veterans Hospital (Madison)
+73 ;;608;1;North Atlantic;Manchester VA Medical Center
+74 ;;610;11;Midwest;VA Northern Indiana Health Care System (Marion, Fort Wayne)
+75 ;;612;21;Pacific;VA Northern California Health Care System (Mather)
+76 ;;613;5;North Atlantic;Martinsburg VA Medical Center
+77 ;;614;9;Southeast;Memphis VA Medical Center
+78 ;;618;23;Midwest;Minneapolis VA Medical Center
+79 ;;619;7;Southeast;Central Alabama Veterans Health Care System (Tuskegee, Montgomery)
+80 ;;620;3;North Atlantic;VA Hudson Valley Health Care System (Montrose, Castle Point)
+81 ;;621;9;Southeast;James H. Quillen VA Medical Center (Mountain Home)
+82 ;;623;19;Continental;Jack C. Montgomery VA Medical Center (Muskogee)
+83 ;;626;9;Southeast;VA Tennessee Valley Health Care System (Nashville, Murfreesboro)
+84 ;;629;16;Continental;Southeast Louisiana Veterans Health Care System (New Orleans)
+85 ;;630;3;North Atlantic;VA New York Harbor Health Care System (Brooklyn, Manhattan)
+86 ;;631;1;North Atlantic;VA Central Western Massachusetts Healthcare System (Formerly Northampton VA Medical Center)
+87 ;;632;3;North Atlantic;Northport VA Medical Center
+88 ;;635;19;Continental;Oklahoma City VA Medical Center
+89 ;;636;23;Midwest;VA Nebraska-Western Iowa Health Care System (Omaha, Lincoln, Grand Island of NE, Des Moines, Knoxville, Iowa City of IA) aka VA Central Plains Health Care System
+90 ;;637;6;North Atlantic;Asheville VA Medical Center
+91 ;;640;21;Pacific;VA Palo Alto Health Care System (Menlo Park, Palo Alto, Livermore)
+92 ;;642;4;North Atlantic;Philadelphia VA Medical Center
+93 ;;644;18;Pacific;Phoenix VA Health Care System
+94 ;;646;4;North Atlantic;VA Pittsburgh Health Care System (Pittsburgh University Dr., H. J. Heinz Campus)
+95 ;;648;20;Pacific;VA Portland Health Care System (Portland, Vancouver)
+96 ;;649;18;Pacific;Northern Arizona VA Health Care System (Prescott)
+97 ;;650;1;North Atlantic;Providence VA Medical Center
+98 ;;652;6;North Atlantic;Hunter Holmes McGuire VA Medical Center (Richmond)
+99 ;;653;20;Pacific;VA Roseburg Healthcare System
+100 ;;654;21;Pacific;VA Sierra Nevada Health Care System (Reno)
+101 ;;655;11;Midwest;Aleda E. Lutz VA Medical Center (Saginaw)
+102 ;;656;23;Midwest;St. Cloud VA Health Care System
+103 ;;657;15;Midwest;VA St. Louis Health Care System (St. Louis, Poplar Bluff, Marion) (formerly VA Heartland East)
+104 ;;658;6;North Atlantic;Salem VA Medical Center
+105 ;;659;6;North Atlantic;W.G. (Bill) Hefner VA Medical Center (Salisbury)
+106 ;;660;19;Continental;VA Salt Lake City Health Care System
+107 ;;662;21;Pacific;San Francisco VA Medical Center
+108 ;;663;20;Pacific;VA Puget Sound Health Care System (Seattle, American Lake)
+109 ;;664;22;Pacific;VA San Diego Healthcare System
+110 ;;666;19;Continental;Sheridan VA Medical Center
+111 ;;667;16;Continental;Overton Brooks VA Medical Center (Shreveport)
+112 ;;668;20;Pacific;Mann-Grandstaff VA Medical Center (Spokane)
+113 ;;671;17;Continental;South Texas Veterans Health Care System (San Antonio, Kerrville)
+114 ;;672;8;Southeast;VA Caribbean Healthcare System (San Juan)
+115 ;;673;8;Southeast;James A. Haley Veterans' Hospital (Tampa)
+116 ;;674;17;Continental;Central Texas Veterans Health Care System (Temple, Waco)
+117 ;;675;8;Southeast;Orlando VA Medical Center
+118 ;;676;12;Midwest;Tomah VA Medical Center
+119 ;;678;18;Pacific;Southern Arizona VA Health Care System (Tucson)
+120 ;;679;7;Southeast;Tuscaloosa VA Medical Center
+121 ;;687;20;Pacific;Jonathan M. Wainwright Memorial VA Medical Center (Walla Walla)
+122 ;;688;5;North Atlantic;Washington DC VA Medical Center
+123 ;;689;1;North Atlantic;VA Connecticut Health Care System (West Haven, Newington)
+124 ;;691;22;Pacific;VA Greater Los Angeles Healthcare System (Los Angeles, West Los Angeles)
+125 ;;692;20;Pacific;VA Southern Oregon Rehabilitation Center & Clinics (White City)
+126 ;;693;4;North Atlantic;Wilkes-Barre VA Medical Center
+127 ;;695;12;Midwest;Clement J. Zablocki Veterans Affairs Medical Center (Milwaukee)
+128 ;;740;17;Continental;VA Health Care Center at Harlingen
+129 ;;740;17;Continental;VA Texas Valley Coastal Bend Health Care System
+130 ;;741;;Continental;HEALTH ADMIN CENTER, CO
+131 ;;756;17;Continental;El Paso VA Health Care System
+132 ;;757;10;Midwest;Chalmers P. Wylie VA Ambulatory Care Center (Columbus)
+133 ;;528A5;2;North Atlantic;Canandaigua VA Medical Center
+134 ;;528A6;2;North Atlantic;Bath VA Medical Center
+135 ;;528A7;2;North Atlantic;Syracuse VA Medical Center
+136 ;;528A8;2;North Atlantic;Albany VA Medical Center (Samuel S. Stratton)
+137 ;;589A4;15;Midwest;Columbia VA Medical Center
+138 ;;589A5;15;Midwest;East Kansas Health Care System
+139 ;;589A7;15;Midwest;Wichita Medical Center
+140 ;;636A6;23;Midwest;VA Central Iowa Health Care System (Des Moines)
+141 ;;636A8;23;Midwest;Iowa City VA Health Care System
+142 ;;657A4;15;Midwest;John J. Pershing VA Medical Center (Popular Bluff)
+143 ;;657A5;15;Midwest;Marion Medical Center
+144 ;;VISN 2;2;North Atlantic;VISN 2 - Upstate New York Health Care System (Buffalo, Batavia, Canandaigua, Syracuse, Bath, Albany
+145 ;;END
KEYMAP ; Region 1: North Atlantic, 2: Southeast, 3: Midwest, 4: Continental, 5: Pacific - Format: ;;Region;Key
+1 ;;North Atlantic;2xyTcbuRebCNCQi2UjFofcqxU77euN4s
+2 ;;Southeast;FKzEuQgt4KGg2ZvNcaDiO94Yoke8SOnM
+3 ;;Midwest;YN6kHDcRDNL8zzre8RGI2haDrtSWU365
+4 ;;Continental;oIXW6ik6Ly5zwWkK22TP0BSHZXlxCePU
+5 ;;Pacific;hs13RWTYTBcg0EsiaVp59tRCuE4f9CqL
+6 ;;Staging;cWhVcsiDfLFQ5TaFskVixKR5Wv5RsZd7
+7 ;;END