| 1 | ECV1RPC ;ALB/ACS;Event Capture Spreadsheet Upload Broker Utilities ;13 Oct 00
 | 
|---|
| 2 |  ;;2.0; EVENT CAPTURE ;**25,33,49,61**;8 May 96
 | 
|---|
| 3 |  ;
 | 
|---|
| 4 | IN(RESULTS,ECDATA) ;
 | 
|---|
| 5 |  ;-----------------------------------------------------------------------
 | 
|---|
| 6 |  ;This broker entry point receives a row of data from the Event
 | 
|---|
| 7 |  ;Capture GUI Spreadsheet (a module of the Event Capture GUI app).
 | 
|---|
| 8 |  ;The data is validated and an array is returned to the spreadsheet
 | 
|---|
| 9 |  ;module.
 | 
|---|
| 10 |  ;
 | 
|---|
| 11 |  ;          RPC: EC VALIDATE SPREADSHEET DATA
 | 
|---|
| 12 |  ;
 | 
|---|
| 13 |  ;INPUT     ECDATA  - Contains either the column headers or a row of
 | 
|---|
| 14 |  ;                    spreadshet data.  Fields included are:
 | 
|---|
| 15 |  ;                    Record number, station, SSN, patient last
 | 
|---|
| 16 |  ;                    name, patient first name, DSS unit IEN, DSS
 | 
|---|
| 17 |  ;                    unit number, DSS unit name, procedure code,
 | 
|---|
| 18 |  ;                    volume, ordering section, provider last name,
 | 
|---|
| 19 |  ;                    provider first name, encounter date/time,
 | 
|---|
| 20 |  ;                    event code category, diag code, associated clinic,
 | 
|---|
| 21 |  ;                    patient status override flag, override deceased
 | 
|---|
| 22 |  ;                    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^0^Procedure^Volume^
 | 
|---|
| 44 |  ;                    Provider IEN^Ordering Section IEN^Provider IEN^
 | 
|---|
| 45 |  ;                    Patient Status^
 | 
|---|
| 46 |  ;                 
 | 
|---|
| 47 |  ;OTHER     ^TMP($J,"COLS") will store the column/data order
 | 
|---|
| 48 |  ;          (used as data 'piece') of the input data string.
 | 
|---|
| 49 |  ;          For example:
 | 
|---|
| 50 |  ;
 | 
|---|
| 51 |  ;          ^TMP($J,"COLS","ECRECPC")=1   => Record number is 1st piece
 | 
|---|
| 52 |  ;          ^TMP($J,"COLS","ECSTAPC")=2   => Station is 2nd piece
 | 
|---|
| 53 |  ;
 | 
|---|
| 54 |  ;SPECIAL PROCESSING
 | 
|---|
| 55 |  ;          An exception to the above described output exists when no
 | 
|---|
| 56 |  ;          exact match is found on the provider.  In this case, some
 | 
|---|
| 57 |  ;          provider info will be sent back with the error message
 | 
|---|
| 58 |  ;          so the user can determine which provider they want.  For
 | 
|---|
| 59 |  ;          example, provider JONES,WILLIAM is entered by the user, but
 | 
|---|
| 60 |  ;          the file contains JONES,WILLIAM H and JONES,WILLIAM J.
 | 
|---|
| 61 |  ;          Both of those providers and their associated information 
 | 
|---|
| 62 |  ;          will be sent with the error message.
 | 
|---|
| 63 |  ;       
 | 
|---|
| 64 |  ;
 | 
|---|
| 65 |  ;-----------------------------------------------------------------------
 | 
|---|
| 66 |  ;
 | 
|---|
| 67 | INIT ;-- piece numbers (associated with column numbers in the spreadsheet)
 | 
|---|
| 68 |  N ECRECPC,ECSTAPC,ECSSNPC,ECPATLPC,ECPATFPC,ECDSSPC,ECDCMPC,ECUNITPC
 | 
|---|
| 69 |  N ECPROCPC,ECVOLPC,ECOSPC,ECPRVLPC,ECPRVFPC,ECENCPC,ECCATPC,ECDXPC
 | 
|---|
| 70 |  N ECCLNPC
 | 
|---|
| 71 |  ;-- spreadsheet values entered by user
 | 
|---|
| 72 |  N ECRECV,ECSTAV,ECSSNV,ECPATLV,ECPATFV,ECPATV,ECDSSV,ECDCMV,ECUNITV
 | 
|---|
| 73 |  N ECPROCV,ECVOLV,ECOSV,ECPROVLV,ECPROVFV,ECPROVV,ECENCV,ECCATV,ECDXV
 | 
|---|
| 74 |  N ECCLNV,ECPSTATV,ECDECPAT,ECFILDUP
 | 
|---|
| 75 |  ;-- error flags and derived data
 | 
|---|
| 76 |  N ECERR,ECERRFLG,ECERRMSG,ECCOLERR,ECPRVIEN,ECOSIEN,ECVSSN,ECDSSIEN
 | 
|---|
| 77 |  N ECINDEX,ECSSNIEN,ECPCLASS,ECPRVTYP,ECCATIEN,ECDXIEN,ECCLNIEN
 | 
|---|
| 78 |  N ECPSTAT
 | 
|---|
| 79 |  ;
 | 
|---|
| 80 |  S U="^"
 | 
|---|
| 81 |  S (ECINDEX,ECERR)=0
 | 
|---|
| 82 |  K RESULTS
 | 
|---|
| 83 |  ;
 | 
|---|
| 84 |  ;--Call utility program to set up piece numbers and column header info
 | 
|---|
| 85 |  I ECDATA["COLHEADERS" D ECHDRS^ECU1RPC(ECDATA) Q
 | 
|---|
| 86 |  ;
 | 
|---|
| 87 |  I ECDATA["END OF PROCESSING" D CLEANUP Q
 | 
|---|
| 88 |  ;
 | 
|---|
| 89 | MAIN ;--Call utility program to get piece numbers and set up data values
 | 
|---|
| 90 |  D GETDATA^ECU1RPC(ECDATA)
 | 
|---|
| 91 |  ;
 | 
|---|
| 92 |  ;--Call validation routines to validate the data
 | 
|---|
| 93 |  D ^ECV2RPC
 | 
|---|
| 94 |  D ^ECV3RPC
 | 
|---|
| 95 |  D ^ECV4RPC
 | 
|---|
| 96 |  ;
 | 
|---|
| 97 | FINAL ;If no errors, send data back to spreadsheet module
 | 
|---|
| 98 |  ;note: ECDXIEN and ECCLNIEN will not be sent back if the record is 
 | 
|---|
| 99 |  ;not being sent to PCE.
 | 
|---|
| 100 |  ;
 | 
|---|
| 101 |  I '($D(RESULTS(1))) D
 | 
|---|
| 102 |  . N RESDATA
 | 
|---|
| 103 |  . S RESDATA="NO ERRORS"_"^"_ECSSNIEN_"^"_ECENCV_"^"_ECSTAV_"^"_ECDSSIEN
 | 
|---|
| 104 |  . S RESDATA=RESDATA_"^"_ECCATIEN_"^"_ECPROCV_"^"_ECVOLV_"^"_ECPRVIEN
 | 
|---|
| 105 |  . S RESDATA=RESDATA_"^"_ECOSIEN_"^"_ECDUZ_"^"_$G(ECDXIEN)
 | 
|---|
| 106 |  . S RESDATA=RESDATA_"^"_$G(ECCLNIEN)_"^"_ECPSTAT_"^"
 | 
|---|
| 107 |  . S RESULTS(1)=RESDATA
 | 
|---|
| 108 |  . Q
 | 
|---|
| 109 |  Q
 | 
|---|
| 110 |  ;
 | 
|---|
| 111 | CLEANUP ;Delete temporary files
 | 
|---|
| 112 |  I $D(^TMP($J,"COLS")) K ^TMP($J,"COLS")
 | 
|---|
| 113 |  Q
 | 
|---|