ECV1RPC ;ALB/ACS - Event Capture Spreadsheet Upload Broker Utilities ;12/2/22 15:57
;;2.0;EVENT CAPTURE;**25,33,49,61,131,139,159**;8 May 96;Build 61
;
; Reference to ^TMP supported by SACC 2.3.2.5.1
;
IN(RESULTS,ECDATA) ;
;----------------------------------------------------------------------
;This broker entry point receives a row of data from the Event
;Capture GUI Spreadsheet (a module of the Event Capture GUI app).
;The data is validated and an array is returned to the spreadsheet
;module.
;
; RPC: EC VALIDATE SPREADSHEET DATA
;
;INPUT ECDATA - Contains either the column headers or a row of
; spreadshet data. Fields included are:
; Record number, station, SSN, patient last
; name, patient first name, DSS unit name, DSS
; unit number, DSS unit IEN, procedure code,
; volume, ordering section, encounter d/t,category,
; diag code, associated clinic name,
; Associated Clinic IEN, CPT Mod #1, CPT Mod #2,
; CPT Mod #3, CPT Mod #4, CPT Mod #5, Agent Orange,
; Ionizing Rad, Service connected, SW Asia, MST,
; HNC, Combat Vet, SHAD, Camp Lejeune, Prov #1,
; Prov #2, Prov #3, Prov #4,Prov #5, Prov #6,
; Prov #7, patient status override flag, override
; deceased flag and file duplicate(s) flag.
;
;OUTPUT RESULTS - If an error is found during data validation,
; then the output contains an array of error
; messages:
;
; PIECE Description
; ----- ------------------------
; 1 Record number
; 2 Column number (on spreadsheet)
; containing the record number
; 3 Column number (on spreadsheet)
; containing the data in error
; 4 Error message
;
; - If no errors are found during data validation,
; then the output contains a string of Event
; Capture data for that patient, beginning with
; the string "NO ERRORS":
;
; "NO ERRORS"^Patient SSN IEN^Encounter Date/Time^
; Station IEN^DSS Unit IEN^Category^Procedure^Volume
; ^Ordering Section IEN^User IEN^Primary Diagnosis^
; Associated ClinicCPT Mod #1 IEN^CPT Mod #2 IEN^
; CPT Mod #3 IEN^CPT Mod #4 IEN^CPT Mode #5 IEN^
; AO^Ion Rad^SC^SW Asia^MST^HNC^CV^SHAD^Camp
; Lejeune^Prov 1^Prov 2^Prov 3^Prov 4^Prov 5^Prov 6^
; Prov 7^Patient Status^Sec Dx 1^Sec Dx 2^Sec Dx 3^
; Sec Dx 4^
;
;OTHER ^TMP($J,"COLS") will store the column/data order
; (used as data 'piece') of the input data string.
; For example:
;
; ^TMP($J,"COLS","ECRECPC")=1 => Record number is 1st piece
; ^TMP($J,"COLS","ECSTAPC")=2 => Station is 2nd piece
;
;SPECIAL PROCESSING
; An exception to the above described output exists when no
; exact match is found on the provider. In this case, some
; provider info will be sent back with the error message
; so the user can determine which provider they want. For
; example, provider JONES,WILLIAM is entered by the user, but
; the file contains JONES,WILLIAM H and JONES,WILLIAM J.
; Both of those providers and their associated information
; will be sent with the error message.
;
;State Home Spreadsheet
; If incoming data in ECDATA is from a state home spreadsheet
; then the first piece of ECDATA will be set to 'State Home
; Record'. This identifier will be used when processing the
; location associated with the record.
;----------------------------------------------------------------------
;
INIT ;-- piece numbers (associated with column numbers in the spreadsheet)
N ECRECPC,ECSTAPC,ECSSNPC,ECPATLPC,ECPATFPC,ECDSSPC,ECDCMPC,ECUNITPC
N ECPROCPC,ECVOLPC,ECOSPC,ECPRV1PC,ECENCPC,ECCATPC,ECDXPC ;131
N ECCLNNPC,ECCLNIPC,ECMOD1PC,ECMOD2PC,ECMOD3PC,ECMOD4PC,ECMOD5PC,ECAOPC,ECIRPC,ECSCPC,ECSWAPC,ECMSTPC,ECHNCPC,ECCVPC,ECSHADPC,ECCLPC ;131
N ECPRV2PC,ECPRV3PC,ECPRV4PC,ECPRV5PC,ECPRV6PC,ECPRV7PC ;131
N ECSEC1PC,ECSEC2PC,ECSEC3PC,ECSEC4PC ;159
;-- spreadsheet values entered by user
N ECRECV,ECSTAV,ECSSNV,ECPATLV,ECPATFV,ECPATV,ECDSSV,ECDCMV,ECUNITV
N ECPROCV,ECVOLV,ECOSV,ECPRV1V,ECENCV,ECCATV,ECDXV ;131
N ECCLNNV,ECPSTATV,ECDECPAT,ECFILDUP ;131
N ECPRV2V,ECPRV3V,ECPRV4V,ECPRV5V,ECPRV6V,ECPRV7V,ECCLNIV,ECMOD1V,ECMOD2V,ECMOD3V,ECMOD4V,ECMOD5V,ECAOV,ECIRV,ECSCV,ECSWAV,ECMSTV,ECHNCV,ECCVV,ECSHADV,ECCLV ;131
N ECSEC1V,ECSEC2V,ECSEC3V,ECSEC4V ;159
;-- error flags and derived data
N ECERR,ECERRFLG,ECERRMSG,ECCOLERR,ECPRVIEN,ECOSIEN,ECVSSN,ECDSSIEN
N ECINDEX,ECSSNIEN,ECPCLASS,ECPRVTYP,ECCATIEN,ECDXIEN,ECCLNIEN
N ECPSTAT,ECSOURCE ;139
N ECSECDX1,ECSECDX2,ECSECDX3,ECSECDX4 ;159
;
S U="^"
S (ECINDEX,ECERR)=0
K RESULTS
;
;--Call utility program to set up piece numbers and column header info
I ECDATA["COLHEADERS" D ECHDRS^ECU1RPC(ECDATA) Q
;
I ECDATA["END OF PROCESSING" D CLEANUP Q
I $P(ECDATA,U)="State Home Record" S ECSOURCE="STATE HOME",ECDATA=$P(ECDATA,U,2,999) ;139 For state home records, strip off state home identifier before processing
;
MAIN ;--Call utility program to get piece numbers and set up data values
D GETDATA^ECU1RPC(ECDATA)
;
;--Call validation routines to validate the data
D ^ECV2RPC
D ^ECV3RPC
D ^ECV4RPC
;
FINAL ;If no errors, send data back to spreadsheet module
;note: ECDXIEN and ECCLNIEN will be set to null if the record is
;not being sent to PCE or the DSS Unit is an OOS type unit.
;For OOS type DSS units, the encoutner status values (combat vet, etc.)
;will be returned as null as they aren't needed.
;
I '($D(RESULTS(1))) D
. N RESDATA
. S RESDATA="NO ERRORS"_U_ECSSNIEN_U_ECENCV_U_ECSTAV_U_ECDSSIEN ;131
. S RESDATA=RESDATA_U_ECCATIEN_U_ECPROCV_U_ECVOLV ;131
. S RESDATA=RESDATA_U_ECOSIEN_U_ECDUZ_U_$G(ECDXIEN) ;131
. S RESDATA=RESDATA_U_$G(ECCLNIEN)_U_ECMOD1V_U_ECMOD2V_U_ECMOD3V_U_ECMOD4V_U_ECMOD5V ;131
. S RESDATA=RESDATA_U_ECAOV_U_ECIRV_U_ECSCV_U_ECSWAV_U_ECMSTV_U_ECHNCV_U_ECCVV_U_ECSHADV_U_ECCLV ;131
. S RESDATA=RESDATA_U_ECPRV1V_U_ECPRV2V_U_ECPRV3V_U_ECPRV4V_U_ECPRV5V_U_ECPRV6V_U_ECPRV7V_U_ECPSTAT ;131
. S RESDATA=RESDATA_U_$G(ECSECDX1)_U_$G(ECSECDX2)_U_$G(ECSECDX3)_U_$G(ECSECDX4)_U ;159
. S RESULTS(1)=RESDATA
. Q
Q
;
CLEANUP ;Delete temporary files
I $D(^TMP($J,"COLS")) K ^TMP($J,"COLS")
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HECV1RPC 7039 printed Dec 13, 2024@01:59:17 Page 2
ECV1RPC ;ALB/ACS - Event Capture Spreadsheet Upload Broker Utilities ;12/2/22 15:57
+1 ;;2.0;EVENT CAPTURE;**25,33,49,61,131,139,159**;8 May 96;Build 61
+2 ;
+3 ; Reference to ^TMP supported by SACC 2.3.2.5.1
+4 ;
IN(RESULTS,ECDATA) ;
+1 ;----------------------------------------------------------------------
+2 ;This broker entry point receives a row of data from the Event
+3 ;Capture GUI Spreadsheet (a module of the Event Capture GUI app).
+4 ;The data is validated and an array is returned to the spreadsheet
+5 ;module.
+6 ;
+7 ; RPC: EC VALIDATE SPREADSHEET DATA
+8 ;
+9 ;INPUT ECDATA - Contains either the column headers or a row of
+10 ; spreadshet data. Fields included are:
+11 ; Record number, station, SSN, patient last
+12 ; name, patient first name, DSS unit name, DSS
+13 ; unit number, DSS unit IEN, procedure code,
+14 ; volume, ordering section, encounter d/t,category,
+15 ; diag code, associated clinic name,
+16 ; Associated Clinic IEN, CPT Mod #1, CPT Mod #2,
+17 ; CPT Mod #3, CPT Mod #4, CPT Mod #5, Agent Orange,
+18 ; Ionizing Rad, Service connected, SW Asia, MST,
+19 ; HNC, Combat Vet, SHAD, Camp Lejeune, Prov #1,
+20 ; Prov #2, Prov #3, Prov #4,Prov #5, Prov #6,
+21 ; Prov #7, patient status override flag, override
+22 ; deceased flag and file duplicate(s) flag.
+23 ;
+24 ;OUTPUT RESULTS - If an error is found during data validation,
+25 ; then the output contains an array of error
+26 ; messages:
+27 ;
+28 ; PIECE Description
+29 ; ----- ------------------------
+30 ; 1 Record number
+31 ; 2 Column number (on spreadsheet)
+32 ; containing the record number
+33 ; 3 Column number (on spreadsheet)
+34 ; containing the data in error
+35 ; 4 Error message
+36 ;
+37 ; - If no errors are found during data validation,
+38 ; then the output contains a string of Event
+39 ; Capture data for that patient, beginning with
+40 ; the string "NO ERRORS":
+41 ;
+42 ; "NO ERRORS"^Patient SSN IEN^Encounter Date/Time^
+43 ; Station IEN^DSS Unit IEN^Category^Procedure^Volume
+44 ; ^Ordering Section IEN^User IEN^Primary Diagnosis^
+45 ; Associated ClinicCPT Mod #1 IEN^CPT Mod #2 IEN^
+46 ; CPT Mod #3 IEN^CPT Mod #4 IEN^CPT Mode #5 IEN^
+47 ; AO^Ion Rad^SC^SW Asia^MST^HNC^CV^SHAD^Camp
+48 ; Lejeune^Prov 1^Prov 2^Prov 3^Prov 4^Prov 5^Prov 6^
+49 ; Prov 7^Patient Status^Sec Dx 1^Sec Dx 2^Sec Dx 3^
+50 ; Sec Dx 4^
+51 ;
+52 ;OTHER ^TMP($J,"COLS") will store the column/data order
+53 ; (used as data 'piece') of the input data string.
+54 ; For example:
+55 ;
+56 ; ^TMP($J,"COLS","ECRECPC")=1 => Record number is 1st piece
+57 ; ^TMP($J,"COLS","ECSTAPC")=2 => Station is 2nd piece
+58 ;
+59 ;SPECIAL PROCESSING
+60 ; An exception to the above described output exists when no
+61 ; exact match is found on the provider. In this case, some
+62 ; provider info will be sent back with the error message
+63 ; so the user can determine which provider they want. For
+64 ; example, provider JONES,WILLIAM is entered by the user, but
+65 ; the file contains JONES,WILLIAM H and JONES,WILLIAM J.
+66 ; Both of those providers and their associated information
+67 ; will be sent with the error message.
+68 ;
+69 ;State Home Spreadsheet
+70 ; If incoming data in ECDATA is from a state home spreadsheet
+71 ; then the first piece of ECDATA will be set to 'State Home
+72 ; Record'. This identifier will be used when processing the
+73 ; location associated with the record.
+74 ;----------------------------------------------------------------------
+75 ;
INIT ;-- piece numbers (associated with column numbers in the spreadsheet)
+1 NEW ECRECPC,ECSTAPC,ECSSNPC,ECPATLPC,ECPATFPC,ECDSSPC,ECDCMPC,ECUNITPC
+2 ;131
NEW ECPROCPC,ECVOLPC,ECOSPC,ECPRV1PC,ECENCPC,ECCATPC,ECDXPC
+3 ;131
NEW ECCLNNPC,ECCLNIPC,ECMOD1PC,ECMOD2PC,ECMOD3PC,ECMOD4PC,ECMOD5PC,ECAOPC,ECIRPC,ECSCPC,ECSWAPC,ECMSTPC,ECHNCPC,ECCVPC,ECSHADPC,ECCLPC
+4 ;131
NEW ECPRV2PC,ECPRV3PC,ECPRV4PC,ECPRV5PC,ECPRV6PC,ECPRV7PC
+5 ;159
NEW ECSEC1PC,ECSEC2PC,ECSEC3PC,ECSEC4PC
+6 ;-- spreadsheet values entered by user
+7 NEW ECRECV,ECSTAV,ECSSNV,ECPATLV,ECPATFV,ECPATV,ECDSSV,ECDCMV,ECUNITV
+8 ;131
NEW ECPROCV,ECVOLV,ECOSV,ECPRV1V,ECENCV,ECCATV,ECDXV
+9 ;131
NEW ECCLNNV,ECPSTATV,ECDECPAT,ECFILDUP
+10 ;131
NEW ECPRV2V,ECPRV3V,ECPRV4V,ECPRV5V,ECPRV6V,ECPRV7V,ECCLNIV,ECMOD1V,ECMOD2V,ECMOD3V,ECMOD4V,ECMOD5V,ECAOV,ECIRV,ECSCV,ECSWAV,ECMSTV,ECHNCV,ECCVV,ECSHADV,ECCLV
+11 ;159
NEW ECSEC1V,ECSEC2V,ECSEC3V,ECSEC4V
+12 ;-- error flags and derived data
+13 NEW ECERR,ECERRFLG,ECERRMSG,ECCOLERR,ECPRVIEN,ECOSIEN,ECVSSN,ECDSSIEN
+14 NEW ECINDEX,ECSSNIEN,ECPCLASS,ECPRVTYP,ECCATIEN,ECDXIEN,ECCLNIEN
+15 ;139
NEW ECPSTAT,ECSOURCE
+16 ;159
NEW ECSECDX1,ECSECDX2,ECSECDX3,ECSECDX4
+17 ;
+18 SET U="^"
+19 SET (ECINDEX,ECERR)=0
+20 KILL RESULTS
+21 ;
+22 ;--Call utility program to set up piece numbers and column header info
+23 IF ECDATA["COLHEADERS"
DO ECHDRS^ECU1RPC(ECDATA)
QUIT
+24 ;
+25 IF ECDATA["END OF PROCESSING"
DO CLEANUP
QUIT
+26 ;139 For state home records, strip off state home identifier before processing
IF $PIECE(ECDATA,U)="State Home Record"
SET ECSOURCE="STATE HOME"
SET ECDATA=$PIECE(ECDATA,U,2,999)
+27 ;
MAIN ;--Call utility program to get piece numbers and set up data values
+1 DO GETDATA^ECU1RPC(ECDATA)
+2 ;
+3 ;--Call validation routines to validate the data
+4 DO ^ECV2RPC
+5 DO ^ECV3RPC
+6 DO ^ECV4RPC
+7 ;
FINAL ;If no errors, send data back to spreadsheet module
+1 ;note: ECDXIEN and ECCLNIEN will be set to null if the record is
+2 ;not being sent to PCE or the DSS Unit is an OOS type unit.
+3 ;For OOS type DSS units, the encoutner status values (combat vet, etc.)
+4 ;will be returned as null as they aren't needed.
+5 ;
+6 IF '($DATA(RESULTS(1)))
Begin DoDot:1
+7 NEW RESDATA
+8 ;131
SET RESDATA="NO ERRORS"_U_ECSSNIEN_U_ECENCV_U_ECSTAV_U_ECDSSIEN
+9 ;131
SET RESDATA=RESDATA_U_ECCATIEN_U_ECPROCV_U_ECVOLV
+10 ;131
SET RESDATA=RESDATA_U_ECOSIEN_U_ECDUZ_U_$GET(ECDXIEN)
+11 ;131
SET RESDATA=RESDATA_U_$GET(ECCLNIEN)_U_ECMOD1V_U_ECMOD2V_U_ECMOD3V_U_ECMOD4V_U_ECMOD5V
+12 ;131
SET RESDATA=RESDATA_U_ECAOV_U_ECIRV_U_ECSCV_U_ECSWAV_U_ECMSTV_U_ECHNCV_U_ECCVV_U_ECSHADV_U_ECCLV
+13 ;131
SET RESDATA=RESDATA_U_ECPRV1V_U_ECPRV2V_U_ECPRV3V_U_ECPRV4V_U_ECPRV5V_U_ECPRV6V_U_ECPRV7V_U_ECPSTAT
+14 ;159
SET RESDATA=RESDATA_U_$GET(ECSECDX1)_U_$GET(ECSECDX2)_U_$GET(ECSECDX3)_U_$GET(ECSECDX4)_U
+15 SET RESULTS(1)=RESDATA
+16 QUIT
End DoDot:1
+17 QUIT
+18 ;
CLEANUP ;Delete temporary files
+1 IF $DATA(^TMP($JOB,"COLS"))
KILL ^TMP($JOB,"COLS")
+2 QUIT