Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: VPSMRAR0

VPSMRAR0.m

Go to the documentation of this file.
VPSMRAR0  ;DALOI/KML,WOIFO/BT - Update of VPS MRAR PDO file ;1/15/15 15:30
 ;;1.0;VA POINT OF SERVICE (KIOSKS);**3**;Jan 15, 2015;Build 64
 ;;Per VHA Directive 2004-038, this routine should not be modified.
 ;
 Q
 ;
TABLE(ARRAY) ;build array of valid fields defined to VPS MRAR PDO (#853.5)
 ;input/output - ARRAY passed in by reference
 ; example of Array subset
 ; ARRAY("DEVICE ID")="853.51^.02"
 ; ARRAY("MODULE FUNCTION STATUS")="853.51^.07"
 N LN,LINE,STRING
 K ARRAY
 F LN=2:1 S LINE=$T(MRARFLDS+LN),STRING=$P(LINE,";;",2) Q:STRING=""  S ARRAY($P(STRING,U,3))=$P(STRING,U,1,2)_U_$P(STRING,U,4)_U_$P(STRING,U,5)
 Q
 ;
ERROR(FDAERR,STRING,MSG) ;
 ; INPUT
 ;   FDAERR : error array that was created when attempting to file the changes
 ;   STRING : Field Name^IENS^Field Value
 ;            IENS is composite string assigned to a subscript in the local array passed in by Vecna for the specific field
 ;   MSG    : message to be appended to the returned result
 ;
 ; OUTPUT
 ;   No Exception   : Field Name^IENS^Field Value^1
 ;   With Exception : Field Name^IENS^Field Value^99^error
 ;
 N RESULT
 N ERRNUM S ERRNUM=0
 S ERRNUM=$O(FDAERR("DIERR",ERRNUM))
 N ERRTXT S ERRTXT=FDAERR("DIERR",ERRNUM,"TEXT",1)
 N EXIST S EXIST=ERRTXT["already exists"
 S:EXIST RESULT=$$RESULT(STRING,1,"") ; not an exception as far as Vecna is concerned.
 S:'EXIST RESULT=$$RESULT(STRING,99,ERRTXT_$S(MSG'="":" "_MSG,1:""))
 Q RESULT
 ;
RESULT(DATA,RETCODE,ERRMSG) ; return result with a structure recognized by vecna
 ; INPUT
 ;   DATA    : Field Name^IENS^Field Value
 ;             IENS is composite string assigned to a subscript in the local array passed in by Vecna for the specific field
 ;   RETCODE : Return Code
 ;   ERRMSG  : Error Message (optional)
 ;
 ; OUTPUT
 ;   result string with a structure that Vecna can recognize
 ;
 N RESULT
 S RESULT=$P(DATA,U,1,3)
 S $P(RESULT,U,4)=RETCODE
 S:ERRMSG'="" $P(RESULT,U,5)=ERRMSG
 Q RESULT
 ;
GREQFLD(VARRAY,DDARRY,REQFLDS) ;Build REQFLDS array. Each sub file must have the required field in the array otherwise generates error
 ; INPUTS
 ;   VARRAY  : encounter, statistics, allergy and medication related data sent in a subscripted array by kiosk client
 ;             VARRAY(n) = FIELD NAME^ARRAY IENS^FIELD VALUE
 ;   DDARRY  : array of DD definitions defined at 853.51, 853.52, 853.53, 853.57 used for 
 ;             validating and filing the data sent by kiosk client
 ;             each subscript at this array is constructed as: 
 ;             DDARRY(n) = FILE NUMBER^FIELD NUMBER^FIELD NAME
 ; OUTPUT
 ;   REQFLDS : array of required field name by required fieldname and entry number
 ;             if the required field name and value exists in VARRAY, the node (REQFLDS(reqfieldname, entry#)) will be defined.
 ;
 ; Required fields for Sub File 853.51
 S REQFLDS("KIOSK GROUP")=0
 S REQFLDS("ENCOUNTER CLINIC")=0
 S REQFLDS("INTERFACE MODULE")=0
 S REQFLDS("LOCAL ALLERGY ID")=1
 S REQFLDS("REMOTE ALLERGY ID")=1
 S REQFLDS("REMOTE ALLERGY NAME")=1
 S REQFLDS("MED ID")=1
 S REQFLDS("MEDICATION NAME")=1
 S REQFLDS("ADD ALLERGY-VET")=1
 S REQFLDS("ADD ALLERGY-PROVIDER")=1
 S REQFLDS("PATIENT-FACING ADD MEDICATION")=1
 S REQFLDS("STAFF VIEW ADD MEDICATION")=1
 S REQFLDS("VET VIEW ADD MEDICATION")=1
 S REQFLDS("LOCAL REACTION ID")=2
 S REQFLDS("REMOTE REACTION ID")=2
 S REQFLDS("REMOTE REACTION NAME")=2
 ;
 N DDFLD,VPSFILE,FLDVAL,ENTRY2,ENTRY3
 N SUB S SUB=""
 ;
 F  S SUB=$O(VARRAY(SUB)) Q:SUB=""  D
 . S DDFLD=$P(VARRAY(SUB),U) ; name of field label passed in by Vecna
 . Q:DDFLD=""  ;will generate error in the filing stage
 . S ENTRY2=$P($P(VARRAY(SUB),U,2),",",2) ;Allergy or Medication Entry #
 . S ENTRY3=$P($P(VARRAY(SUB),U,2),",",3) ;Reaction Entry #
 . I $D(REQFLDS(DDFLD)) D
 . . S FLDVAL=$$STRIP^XLFSTR($P(VARRAY(SUB),U,3)," ") ;IA #10104
 . . I REQFLDS(DDFLD)=0 S REQFLDS(DDFLD,0)=1
 . . I REQFLDS(DDFLD)=1,FLDVAL'="",ENTRY2'="" S REQFLDS(DDFLD,ENTRY2)=1
 . . I REQFLDS(DDFLD)=2,FLDVAL'="",ENTRY2'="",ENTRY3'="" S REQFLDS(DDFLD,ENTRY2,ENTRY3)=1
 Q
 ;
ADDMRAR(SUBFIL,SUBS,ENTRYNO,DIEFLAG) ;Add multiple entry
 ; INPUTS 
 ;   PTIEN   : D0 - Patient DFN for 853.5 entry
 ;   DTIEN   : D1 - transaction date/time ien for 853.51 sub-entry
 ;   ENTRYNO : Entry Number
 ;   DIEFLAG : Filing Type (I = Internal, E = External)
 ; OUTPUT
 ;   Success : > 0
 ;   Failed : 0
 N VPSFDA S VPSFDA(SUBFIL,"+1,"_SUBS_",",.01)=ENTRYNO
 K ^TMP("DIERR",$J)
 D UPDATE^DIE($G(DIEFLAG),"VPSFDA")
 N ADDOK S ADDOK='$D(^TMP("DIERR",$J))
 K ^TMP("DIERR",$J)
 Q ADDOK
 ; 
FILE(FIL,WP,IENS,FLD,DIEFLAG,DATA) ; Store field in FIL
 ; INPUTS 
 ;   FIL     : File # where the data will be filed
 ;   WP      : Boolean indicates whether or not the field is a WP field
 ;   IENS    : IENS sub script where the data will be filed
 ;   FLD     : Field # where the data will be filed
 ;   DIEFLAG : Filing Type (I = Internal, E = External)
 ;   DATA    : Field Name^IENS^Field Value
 ; 
 ; OUTPUT
 ;   success : RESULT = Field Name^IENS^Field Value^1
 ;   failed  : RESULT = Field Name^IENS^Field Value^99^error text describing why data did not get filed
 ;
 N VPSERR
 ;
 I WP D  ; comments need to be filed using WP^DIE
 . S DATA(1)=$P(DATA,U,3)
 . D WP^DIE(FIL,IENS,FLD,"","DATA","VPSERR")
 ;
 I 'WP D  ; file other non-comments fields
 . N VPSFDA
 . S VPSFDA(FIL,IENS,FLD)=$P(DATA,U,3)
 . D FILE^DIE(DIEFLAG,"VPSFDA","VPSERR")
 ;
 I '$D(VPSERR) S RESULT=$$RESULT(DATA,1,"") ; data for specific field was filed successfully into PDO record
 I $D(VPSERR) S RESULT=$$ERROR(.VPSERR,DATA,"")
 ;
 Q RESULT
 ; 
MRARFLDS ; list of encounter, MRAR, and Kiosk statistics fields defined in VPS MRAR PDO file (#853.5)
 ;;FILE NUMBER^FIELD NUMBER^FIELD NAME^comments
 ;;853.51^.02^DEVICE ID^E
 ;;853.51^.03^KIOSK GROUP^E
 ;;853.51^.04^ENCOUNTER CLINIC^I^44
 ;;853.51^.05^APPT DATE/TIME^D
 ;;853.51^.06^PROVIDER^I^200
 ;;853.51^.12^MRAR SESSION ID^E
 ;;853.51^1^AR INITIATED DT^D
 ;;853.51^2^AR COMPLETED DT^D
 ;;853.51^5^AR INCOMPLETE DT^D
 ;;853.51^6^AR INCOMPLETE REASON TYPE^E
 ;;853.51^7^AR SESSION OUTCOME^E
 ;;853.51^8^ADD ALLERGY INITIATED DT^D
 ;;853.51^9^ADD ALLERGY COMPLETED DT^D
 ;;853.51^10^ALLER CHANGE COMPLETED DT^D
 ;;853.51^11^ALLER CHANGE INITIATED DT^D
 ;;853.51^12^AR FREE TEXT USED^E
 ;;853.51^13^AR FREE TEXT COMPLETED DT^D
 ;;853.51^14^VET VIEW ADD ALLERGY COMP DT^D
 ;;853.51^15^VET VIEW ADD ALLER INIT DT^D
 ;;853.51^16^VET VIEW CHANGE ALLER COMP DT^D
 ;;853.51^17^VET VIEW CHANGE ALLER INIT DT^D
 ;;853.51^18^MR CHANGE REASON INITIATED DT^D
 ;;853.51^19^OTH ALLERGY UNK PATIENT^E
 ;;853.51^20^NO KNOWN DRUG ALLERGIES^E
 ;;853.51^22^MR MULTIPLE SESSIONS^E
 ;;853.51^23^MR FREE TEXT USED^E
 ;;853.51^24^VET VIEW CHG DOD MED COMP DT^D
 ;;853.51^25^VET VIEW CHG DOD MED INIT DT^D
 ;;853.51^26^VET VIEW CHG NONVA MED COMP DT^D
 ;;853.51^27^VET VIEW CHG NONVA MED INIT DT^D
 ;;853.51^28^VET VIEW CHG LOCAL MED COMP DT^D
 ;;853.51^29^VET VIEW CHG LOCAL MED INIT DT^D
 ;;853.51^31^VET VIEW CHG REMOT MED COMP DT^D
 ;;853.51^32^VET VIEW CHG REMOT MED INIT DT^D
 ;;853.51^33^WEB ID^E
 ;;853.51^70^PDO FIRST INVOKED DT^D
 ;;853.51^72^PDO INVOCATION ERROR^E
 ;;853.51^73^PDO NEXT INVOKED DT^D
 ;;853.51^74^STAFF MODULE COMPLETED DT^D
 ;;853.51^76^STAFF MODULE SIGNED DT^D
 ;;853.51^77^MR INITIATED DT^D
 ;;853.51^78^MR COMPLETED DT^D
 ;;853.51^80^MR CHANGE MED INITIATED DT^D
 ;;853.51^81^MR CHANGE MED COMPLETED DT^D
 ;;853.51^82^MR CHANGE REASON COMPLETED DT^D
 ;;853.51^83^MR INCOMPLETE REASON TYPE^E
 ;;853.51^84^MR FREE TEXT SECTION DONE DT^D
 ;;853.51^85^MR SESSION OUTCOME^E
 ;;853.51^86^MR ADD MED INITIATED DT^D
 ;;853.51^87^MR ADD MED COMPLETED DT^D
 ;;853.51^88^VET VIEW ADD MED INITIATED DT^D
 ;;853.51^89^VET VIEW ADD MED COMPLETED DT^D
 ;;853.51^92^VET VIEW CHG ALL MED INIT DT^D
 ;;853.51^93^VET VIEW CHG ALL MED COMP DT^D
 ;;853.51^95^MR INCOMPLETE DT^D
 ;;853.51^105^TIU NOTE^I^8925
 ;;853.5121^.01^MRAR CONDUCTED WITH^E
 ;;853.52^.02^LOCAL ALLERGY ID^I^120.8
 ;;853.52^.03^REMOTE ALLERGY ID^E
 ;;853.52^.05^REMOTE ALLERGY NAME^E
 ;;853.52^.06^AR PATIENT RESPONSE^E
 ;;853.52^.09^REMOTE FACILITY^I^4
 ;;853.52^16^ALLERGY-MARK FOR FOLLOWUP^E
 ;;853.525^.01^ALLERGY CHANGED^I^853.3
 ;;853.526^.01^ALLERGY CONFIRMED^I^853.3
 ;;853.527^.01^ALLERGY DISCREPANCY^I^853.3
 ;;853.52^1^ALLERGY COMMENTS PATIENT^word processing field
 ;;853.52^2^ALLERGY COMMENTS STAFF VIEW^word processing field
 ;;853.52^3^ALLERGY COMMENTS VET VIEW^word processing field
 ;;853.52^4^ALLERGY DOD^E
 ;;853.53^1^ADD ALLERGY-VET^word processing field
 ;;853.53^1.5^ADD ALLERGY-PROVIDER^word processing field
 ;;853.53^2^ADD ALLERGY REACTION (STAFF)^E
 ;;853.53^3^ADD ALLERGY ADDED BY^E
 ;;853.53^4^ADD ALLERGY-MARK FOR FOLLOWUP^E
 ;;853.53^5^ADD ALLERGY NOT KNOWN^E
 ;;853.54^1^PRESCRIPTION ID^E
 ;;853.54^2^PROVIDER NAME^E
 ;;853.54^3^FILL LOCATION^I^4
 ;;853.54^4^LAST FILL DATE^D
 ;;853.54^5^DAYS SUPPLIED^E
 ;;853.54^6^# REFILLS LEFT^E
 ;;853.54^7^NEXT FILL DATE^D
 ;;853.54^8^MED EXPIRE DATE^D
 ;;853.54^9^MED ID^E
 ;;853.54^10^MEDICATION NAME^E
 ;;853.54^11^MR PRESET PATIENT RESPONSE^E
 ;;853.54^12^RX STATUS^E
 ;;853.54^13^MED SIG^E
 ;;853.54^14^MED DOSAGE^E
 ;;853.54^15^MED DOSAGE FORM^E
 ;;853.54^16^MEDS-MARK FOR FOLLOWUP^E
 ;;853.54^17^MED ROUTE^E
 ;;853.54^18^MED IMAGE INDICATOR^E
 ;;853.54^19^MED FINISHING PERSON^E
 ;;853.54^20^NATIONAL DRUG SID^E
 ;;853.54^21^NON-VA^E
 ;;853.54^22^MAX REFILLS^E
 ;;853.54^26^RX PATIENT STATUS^E
 ;;853.54^27^RX NUMBER^E
 ;;853.54^28^RX OUTPATIENT ID^E
 ;;853.54^29^RX SC FLAG^E
 ;;853.54^33^CANCEL DT^D
 ;;853.54^34^CMOP STATUS^E
 ;;853.54^35^COUNSELED FLAG^E
 ;;853.54^36^COUNSELING UNDERSTOOD FLAG^E
 ;;853.54^37^DIVISION SID^E
 ;;853.54^38^ENTERED BY^E
 ;;853.54^39^MED ISSUE DT^D
 ;;853.54^40^COPAY TRANSACTION^E
 ;;853.54^41^EBILL ACTION NUMBER^E
 ;;853.54^42^ETL BATCH ID FAILURE^E
 ;;853.54^43^RELEASE DT^D
 ;;853.54^44^QUANTITY SUPPLIED^E
 ;;853.54^45^MED REMOTE^E
 ;;853.54^46^REMOTE MED FACILITY^E
 ;;853.54^47^DRUG NAME W/O DOSE^E
 ;;853.54^48^HIGH RISK MED CLASS^E
 ;;853.54^49^HIGH RISK MED NAME^E
 ;;853.54^50^HIGH RISK MED YEAR^E
 ;;853.54^51^MED IMAGE^E
 ;;853.54^56^PRODUCT SOURCE^E
 ;;853.54^57^PRODUCT NAME^I^50.68
 ;;853.54^58^VET VIEW MED IMAGE INDICATOR^E
 ;;853.54^23^MEDICATION COMMENTS PATIENT^word processing field
 ;;853.54^24^MEDICATION COMMENTS STAFF VIEW^word processing field
 ;;853.54^25^MEDICATION COMMENTS VET VIEW^word processing field
 ;;853.5452^.01^MED DISCREPANCY^I^853.7
 ;;853.5454^.01^MED CHANGED^I^853.7
 ;;853.5455^.01^MED CONFIRMED^I^853.7
 ;;853.55^1^PATIENT-FACING ADD MEDICATION^E
 ;;853.55^2^STAFF VIEW ADD MEDICATION^E
 ;;853.55^3^VET VIEW ADD MEDICATION^E
 ;;853.55^4^VET PLANS TO DISCUSS ADD MED^E
 ;;853.55^5^ADD MED FREQUENCY (PATIENT)^E
 ;;853.55^6^ADD MED DIRECTIONS (PATIENT)^E
 ;;853.55^7^ADD MED COMMENTS-STAFF VIEW^word processing field
 ;;853.55^8^ADD MED DOSE (STAFF)^E
 ;;853.55^9^ADD MEDS-MARK FOR FOLLOW-UP^E
 ;;853.55^10^ADD MED INDICATION (STAFF)^E
 ;;853.55^11^ADD MED TIME (PATIENT)^E
 ;;853.55^12^ADD MED COMMENTS-VET VIEW^word processing field
 ;;853.57^.02^LOCAL REACTION ID^I^120.83
 ;;853.57^.03^REMOTE REACTION ID^E
 ;;853.57^.04^REMOTE REACTION NAME^E
 ;;