BIRPC1 ;IHS/CMI/MWR - REMOTE PROCEDURE CALLS; MAY 10, 2010
;;8.5;IMMUNIZATION;**10**;MAY 30,2015
;;* MICHAEL REMILLARD, DDS * CIMARRON MEDICAL INFORMATICS, FOR IHS *
;; RETURNS PATIENT DATA, DATA FOR AN IMMUNIZATION OR SKIN TEST VISIT.
;; PATCH 3: Add Eligibility Code to default Hx string. GET+35
;; PATCH 5: Add Admin Note to default Hx string. GET+38
;; PATCH 9: Add Date VIS Presented and Admin Date to data string. GET+40
;; PATCH 10: Add Skin Test Lot Number IEN and Text. GET+86
;
;
;----------
PDATA(BIDATA,BIDFN) ;EP
;---> Return Patient Data in 5 ^-delimited pieces:
;---> 1 - DOB in format: OCT 01,1994.
;---> 2 - Age in format: 35 Months.
;---> 3 - Text of Patient's sex.
;---> 4 - HRCN in the format XX-XX-XX.
;---> 5 - Text of ACTIVE/INACTIVE Status.
;---> Parameters:
; 1 - BIDATA (ret) String of patient data||error.
; 2 - BIDFN (req) DFN of patient.
;
;---> Delimiter to pass error with result to GUI.
N BI31,BIERR S BI31=$C(31)_$C(31)
S BIDATA="",BIERR=""
;
;---> If DFN not supplied, set Error Code and quit.
I '$G(BIDFN) D Q
.D ERRCD^BIUTL2(201,.BIERR) S BIDATA=BI31_BIERR
;
;---> DOB.
S BIDATA=$$TXDT1^BIUTL5($$DOB^BIUTL1(BIDFN))
;
;---> Age.
S BIDATA=BIDATA_U_$$AGEF^BIUTL1(BIDFN)
;
;---> Text of sex.
S BIDATA=BIDATA_U_$$SEXW^BIUTL1(BIDFN)
;
;---> HRCN, format XX-XX-XX.
S BIDATA=BIDATA_U_$$HRCN^BIUTL1(BIDFN)
;
;---> Active/Inactive Status.
S BIDATA=BIDATA_U_$$ACTIVE^BIUTL1(BIDFN)
;
S BIDATA=BIDATA_BI31
;
Q
;
;
;----------
GET(BIDATA,BIDA,BIVTYPE,BIDE) ;PEP - Return data for one Immunization or Skin Test.
;---> Return data for one Immunization or Skin Test.
;---> Called by RPC: BI VISIT GET.
;---> Parameters:
; 1 - BIDATA (ret) Visit Data or Text of Error Code if any.
; 2 - BIDA (req) IEN of V IMM or V SKIN entry for data retrieval.
; 3 - BIVTYPE (req) "I"=Immunization Visit, "S"=Skin Text Visit.
; 4 - BIDE (opt) Local array for Data Elements to be returned.
;
;---> Delimiter to pass error with result to GUI.
N BI31,BIERR S BI31=$C(31)_$C(31)
S BIDATA="",BIERR=""
;
;---> If BIVTYPE does not="I" (Immunization Visit) and it does
;---> not="S" (Skin Test Visit), then set Error Code and quit.
I ($G(BIVTYPE)'="I")&($G(BIVTYPE)'="S") D Q
.D ERRCD^BIUTL2(410,.BIERR) S BIDATA=BI31_BIERR
;
;---> If BIDA not supplied, set Error Code and quit.
I '$G(BIDA) D Q
.D ERRCD^BIUTL2(409,.BIERR) S BIDATA=BI31_BIERR
;
;---> Set required variables, kill ^BITMP($J).
D SETVARS^BIUTL5 K ^BITMP($J)
;
;---> Set BIDE local array for Data Elements to be returned.
;---> IENs are in ^BIEXPDD(, the BI TABLE DATA ELEMENT File.
;---> The Pieces (PC) indicate position in the returned data string,
;---> BIDATA, below.
;---> Branching logic for Immunization versus Skin Test Visits.
;
;---> IMMUNIZATION:
;---> If this is an Immunization Visit, collect these Data Elements.
N I
;---> Next line: 6 (Dose#) defunct, but serves as a place holder. v8.0
;
;********** PATCH 3, v8.5, SEP 10,2012, IHS/CMI/MWR
;---> Add Eligibility Code Text and NDC Code Text to default Hx string.
;********** PATCH 5, v8.5, JUL 01,2013, IHS/CMI/MWR
;---> Add Admin Note to default Hx string.
;********** PATCH 9, v8.5, OCT 01,2014, IHS/CMI/MWR
;---> Add Date VIS Presented to Patient (YYYYMMDD) and Date of Event ONLY.
;I '$D(BIDE),BIVTYPE="I" F I=4,6,24,27,29:1:37,43,49,51,61,65,67,68,76,77,78,80,82,84,87 S BIDE(I)=""
I '$D(BIDE),BIVTYPE="I" D
.F I=4,6,24,27,29:1:37,43,49,51,61,65,67,68,76,77,78,80,82,84,85,87,90,91 S BIDE(I)=""
;**********
;
;---> IEN PC DATA
;---> --- -- ----
;---> 1 = Visit Type: "I"=Immunization, "S"=Skin Test.
;---> 4 2 = Vaccine Name, Short.
;---> 6 3 = Dose#. v8.0 No longer used.
;---> 24 4 = V IMMUNIZATION IEN.
;---> 27 5 = Vaccine Group ("Series Type").
;---> 29 6 = Date of Immunization (DD-Mmm-YYYY @HH:MM).
;---> 30 7 = Vaccine Name, IEN.
;---> 31 8 = Vaccine maximum Dose#.
;---> 32 9 = Vaccine Lot Number, IEN.
;---> 33 10 = Vaccine Lot Number.
;---> 34 11 = Location IEN.
;---> 35 12 = Category of Visit (A,E, or I)
;---> 36 13 = Location Other (text).
;---> 37 14 = Location IHS (text).
;---> 43 15 = Vaccine Reaction.
;---> 49 16 = VIS Statement Info (Yes/No).
;---> 51 17 = Release/Revision Date of VIS (DD-Mmm-YYYY).
;---> 61 18 = Immunization Provider IEN.
;---> 65 19 = Dose Override.
;---> 67 20 = Injection Site.
;---> 68 21 = Volume.
;---> 76 22 = Visit IEN.
;---> 77 23 = Eligibility Code IEN.
;---> 78 24 - Imported from Outside Registry (1=imported, 2=imported & edited).
;---> 80 25 = NDC Code pointer IEN.
;---> 82 26 = Eligibility Code Text.
;---> 84 27 = NDC Code Text.
;---> 85 28 = Date of Event OR Visit; Admin Shot Date (1201 of V File) in MM/DD/YY
;---> If 1201 is not populated, this element returns the Visit Date!
;---> 87 29 = Administrative Note.
;---> 90 30 = Date VIS Presented to Patient.
;---> 91 31 = Date of Event (1201) ONLY; if 1201 is null, return null.
;
;
;---> SKIN TEST:
;---> If this is a Skin Test Visit, collect these Data Elements.
;
;********** PATCH 10, v8.5, MAY 30,2015, IHS/CMI/MWR
;---> Add Skin Test Lot Number IEN and Text.
;I '$D(BIDE),BIVTYPE="S" F I=24,26,29,34:1:42,61,67,68,70,76 S BIDE(I)=""
I '$D(BIDE),BIVTYPE="S" F I=24,26,29,34:1:42,61,67,68,70,76,92,93 S BIDE(I)=""
;
;---> IEN PC DATA
;---> --- -- ----
;---> 1 = Visit Type: "I"=Immunization, "S"=Skin Test.
;---> 24 2 = V File IEN.
;---> 26 3 = Location (or Outside Location) of Visit.
;---> 29 4 = Date of Skin Test (DD-Mmm-YYYY @HH:MM).
;---> 34 5 = Location IEN.
;---> 35 6 = Category of Visit (A,E, or I)
;---> 36 7 = Location Other (text).
;---> 37 8 = Location IHS (text).
;---> 38 9 = Skin Test Result.
;---> 39 10 = Skin Test Reading.
;---> 40 11 = Skin Test Date Read.
;---> 41 12 = Skin Test Name.
;---> 42 13 = Skin Test Name IEN.
;---> 61 14 = Immunization Provider IEN.
;---> 67 15 = Injection Site.
;---> 68 16 = Volume.
;---> 70 17 = Skin Test Reader (Provider) IEN.
;---> 76 18 = Visit IEN.
;---> 92 19 = Skin Test Lot Number IEN.
;---> 93 20 = Skin Test Lot Number Text.
;**********
;
;
;---> Now, gather data from one V File Visit.
; 1 - BIDA (req) IEN of V File Visit.
; 2 - BIDE (req) Data Elements array (null if HL7)
; 3 - BIFMT (req) Format: 0=ASCII Split, 1=ASCII, 2=HL7, 3=IMM/SERVE
; 4 - BIVTYPE (req) Visit Type: "I"=Immunization, "S"=Skin Test.
; 5 - BIDATA (opt) Data returned in this param if desired.
;
D HISTORY1^BIEXPRT3(BIDA,.BIDE,1,BIVTYPE,,.BIERR)
I BIERR]"" S BIDATA=BI31_BIERR Q
;
;
;---> Set parameters for writing data as a string in BIDATA.
;---> Parameters:
; 1 - BIEXP (req) Export: 0=screen, 1=host file, 2=string
; 2 - BIFMT (req) Format: 1=ASCII, 2=HL7, 3=IMM/SERVE
; 3 - BIFLNM (opt) File name
; 4 - BIPATH (opt) BI Path name for host files
; 5 - BIDATA (ret) Immunization History in "|"-delimited string
; NOTE: Since this is necessarily only one
; record, strip "^"-delimiter at end.
;
D WRITE^BIEXPRT4(2,1,,,.BIDATA)
;
;---> Returned data string, with error delimiter concatenated.
S BIDATA=$P(BIDATA,U)_BI31
Q
BIRPC1 ;IHS/CMI/MWR - REMOTE PROCEDURE CALLS; MAY 10, 2010
+1 ;;8.5;IMMUNIZATION;**10**;MAY 30,2015
+2 ;;* MICHAEL REMILLARD, DDS * CIMARRON MEDICAL INFORMATICS, FOR IHS *
+3 ;; RETURNS PATIENT DATA, DATA FOR AN IMMUNIZATION OR SKIN TEST VISIT.
+4 ;; PATCH 3: Add Eligibility Code to default Hx string. GET+35
+5 ;; PATCH 5: Add Admin Note to default Hx string. GET+38
+6 ;; PATCH 9: Add Date VIS Presented and Admin Date to data string. GET+40
+7 ;; PATCH 10: Add Skin Test Lot Number IEN and Text. GET+86
+8 ;
+9 ;
+10 ;----------
PDATA(BIDATA,BIDFN) ;EP
+1 ;---> Return Patient Data in 5 ^-delimited pieces:
+2 ;---> 1 - DOB in format: OCT 01,1994.
+3 ;---> 2 - Age in format: 35 Months.
+4 ;---> 3 - Text of Patient's sex.
+5 ;---> 4 - HRCN in the format XX-XX-XX.
+6 ;---> 5 - Text of ACTIVE/INACTIVE Status.
+7 ;---> Parameters:
+8 ; 1 - BIDATA (ret) String of patient data||error.
+9 ; 2 - BIDFN (req) DFN of patient.
+10 ;
+11 ;---> Delimiter to pass error with result to GUI.
+12 NEW BI31,BIERR
SET BI31=$CHAR(31)_$CHAR(31)
+13 SET BIDATA=""
SET BIERR=""
+14 ;
+15 ;---> If DFN not supplied, set Error Code and quit.
+16 IF '$GET(BIDFN)
Begin DoDot:1
+17 DO ERRCD^BIUTL2(201,.BIERR)
SET BIDATA=BI31_BIERR
End DoDot:1
QUIT
+18 ;
+19 ;---> DOB.
+20 SET BIDATA=$$TXDT1^BIUTL5($$DOB^BIUTL1(BIDFN))
+21 ;
+22 ;---> Age.
+23 SET BIDATA=BIDATA_U_$$AGEF^BIUTL1(BIDFN)
+24 ;
+25 ;---> Text of sex.
+26 SET BIDATA=BIDATA_U_$$SEXW^BIUTL1(BIDFN)
+27 ;
+28 ;---> HRCN, format XX-XX-XX.
+29 SET BIDATA=BIDATA_U_$$HRCN^BIUTL1(BIDFN)
+30 ;
+31 ;---> Active/Inactive Status.
+32 SET BIDATA=BIDATA_U_$$ACTIVE^BIUTL1(BIDFN)
+33 ;
+34 SET BIDATA=BIDATA_BI31
+35 ;
+36 QUIT
+37 ;
+38 ;
+39 ;----------
GET(BIDATA,BIDA,BIVTYPE,BIDE) ;PEP - Return data for one Immunization or Skin Test.
+1 ;---> Return data for one Immunization or Skin Test.
+2 ;---> Called by RPC: BI VISIT GET.
+3 ;---> Parameters:
+4 ; 1 - BIDATA (ret) Visit Data or Text of Error Code if any.
+5 ; 2 - BIDA (req) IEN of V IMM or V SKIN entry for data retrieval.
+6 ; 3 - BIVTYPE (req) "I"=Immunization Visit, "S"=Skin Text Visit.
+7 ; 4 - BIDE (opt) Local array for Data Elements to be returned.
+8 ;
+9 ;---> Delimiter to pass error with result to GUI.
+10 NEW BI31,BIERR
SET BI31=$CHAR(31)_$CHAR(31)
+11 SET BIDATA=""
SET BIERR=""
+12 ;
+13 ;---> If BIVTYPE does not="I" (Immunization Visit) and it does
+14 ;---> not="S" (Skin Test Visit), then set Error Code and quit.
+15 IF ($GET(BIVTYPE)'="I")&($GET(BIVTYPE)'="S")
Begin DoDot:1
+16 DO ERRCD^BIUTL2(410,.BIERR)
SET BIDATA=BI31_BIERR
End DoDot:1
QUIT
+17 ;
+18 ;---> If BIDA not supplied, set Error Code and quit.
+19 IF '$GET(BIDA)
Begin DoDot:1
+20 DO ERRCD^BIUTL2(409,.BIERR)
SET BIDATA=BI31_BIERR
End DoDot:1
QUIT
+21 ;
+22 ;---> Set required variables, kill ^BITMP($J).
+23 DO SETVARS^BIUTL5
KILL ^BITMP($JOB)
+24 ;
+25 ;---> Set BIDE local array for Data Elements to be returned.
+26 ;---> IENs are in ^BIEXPDD(, the BI TABLE DATA ELEMENT File.
+27 ;---> The Pieces (PC) indicate position in the returned data string,
+28 ;---> BIDATA, below.
+29 ;---> Branching logic for Immunization versus Skin Test Visits.
+30 ;
+31 ;---> IMMUNIZATION:
+32 ;---> If this is an Immunization Visit, collect these Data Elements.
+33 NEW I
+34 ;---> Next line: 6 (Dose#) defunct, but serves as a place holder. v8.0
+35 ;
+36 ;********** PATCH 3, v8.5, SEP 10,2012, IHS/CMI/MWR
+37 ;---> Add Eligibility Code Text and NDC Code Text to default Hx string.
+38 ;********** PATCH 5, v8.5, JUL 01,2013, IHS/CMI/MWR
+39 ;---> Add Admin Note to default Hx string.
+40 ;********** PATCH 9, v8.5, OCT 01,2014, IHS/CMI/MWR
+41 ;---> Add Date VIS Presented to Patient (YYYYMMDD) and Date of Event ONLY.
+42 ;I '$D(BIDE),BIVTYPE="I" F I=4,6,24,27,29:1:37,43,49,51,61,65,67,68,76,77,78,80,82,84,87 S BIDE(I)=""
+43 IF '$DATA(BIDE)
IF BIVTYPE="I"
Begin DoDot:1
+44 FOR I=4,6,24,27,29:1:37,43,49,51,61,65,67,68,76,77,78,80,82,84,85,87,90,91
SET BIDE(I)=""
End DoDot:1
+45 ;**********
+46 ;
+47 ;---> IEN PC DATA
+48 ;---> --- -- ----
+49 ;---> 1 = Visit Type: "I"=Immunization, "S"=Skin Test.
+50 ;---> 4 2 = Vaccine Name, Short.
+51 ;---> 6 3 = Dose#. v8.0 No longer used.
+52 ;---> 24 4 = V IMMUNIZATION IEN.
+53 ;---> 27 5 = Vaccine Group ("Series Type").
+54 ;---> 29 6 = Date of Immunization (DD-Mmm-YYYY @HH:MM).
+55 ;---> 30 7 = Vaccine Name, IEN.
+56 ;---> 31 8 = Vaccine maximum Dose#.
+57 ;---> 32 9 = Vaccine Lot Number, IEN.
+58 ;---> 33 10 = Vaccine Lot Number.
+59 ;---> 34 11 = Location IEN.
+60 ;---> 35 12 = Category of Visit (A,E, or I)
+61 ;---> 36 13 = Location Other (text).
+62 ;---> 37 14 = Location IHS (text).
+63 ;---> 43 15 = Vaccine Reaction.
+64 ;---> 49 16 = VIS Statement Info (Yes/No).
+65 ;---> 51 17 = Release/Revision Date of VIS (DD-Mmm-YYYY).
+66 ;---> 61 18 = Immunization Provider IEN.
+67 ;---> 65 19 = Dose Override.
+68 ;---> 67 20 = Injection Site.
+69 ;---> 68 21 = Volume.
+70 ;---> 76 22 = Visit IEN.
+71 ;---> 77 23 = Eligibility Code IEN.
+72 ;---> 78 24 - Imported from Outside Registry (1=imported, 2=imported & edited).
+73 ;---> 80 25 = NDC Code pointer IEN.
+74 ;---> 82 26 = Eligibility Code Text.
+75 ;---> 84 27 = NDC Code Text.
+76 ;---> 85 28 = Date of Event OR Visit; Admin Shot Date (1201 of V File) in MM/DD/YY
+77 ;---> If 1201 is not populated, this element returns the Visit Date!
+78 ;---> 87 29 = Administrative Note.
+79 ;---> 90 30 = Date VIS Presented to Patient.
+80 ;---> 91 31 = Date of Event (1201) ONLY; if 1201 is null, return null.
+81 ;
+82 ;
+83 ;---> SKIN TEST:
+84 ;---> If this is a Skin Test Visit, collect these Data Elements.
+85 ;
+86 ;********** PATCH 10, v8.5, MAY 30,2015, IHS/CMI/MWR
+87 ;---> Add Skin Test Lot Number IEN and Text.
+88 ;I '$D(BIDE),BIVTYPE="S" F I=24,26,29,34:1:42,61,67,68,70,76 S BIDE(I)=""
+89 IF '$DATA(BIDE)
IF BIVTYPE="S"
FOR I=24,26,29,34:1:42,61,67,68,70,76,92,93
SET BIDE(I)=""
+90 ;
+91 ;---> IEN PC DATA
+92 ;---> --- -- ----
+93 ;---> 1 = Visit Type: "I"=Immunization, "S"=Skin Test.
+94 ;---> 24 2 = V File IEN.
+95 ;---> 26 3 = Location (or Outside Location) of Visit.
+96 ;---> 29 4 = Date of Skin Test (DD-Mmm-YYYY @HH:MM).
+97 ;---> 34 5 = Location IEN.
+98 ;---> 35 6 = Category of Visit (A,E, or I)
+99 ;---> 36 7 = Location Other (text).
+100 ;---> 37 8 = Location IHS (text).
+101 ;---> 38 9 = Skin Test Result.
+102 ;---> 39 10 = Skin Test Reading.
+103 ;---> 40 11 = Skin Test Date Read.
+104 ;---> 41 12 = Skin Test Name.
+105 ;---> 42 13 = Skin Test Name IEN.
+106 ;---> 61 14 = Immunization Provider IEN.
+107 ;---> 67 15 = Injection Site.
+108 ;---> 68 16 = Volume.
+109 ;---> 70 17 = Skin Test Reader (Provider) IEN.
+110 ;---> 76 18 = Visit IEN.
+111 ;---> 92 19 = Skin Test Lot Number IEN.
+112 ;---> 93 20 = Skin Test Lot Number Text.
+113 ;**********
+114 ;
+115 ;
+116 ;---> Now, gather data from one V File Visit.
+117 ; 1 - BIDA (req) IEN of V File Visit.
+118 ; 2 - BIDE (req) Data Elements array (null if HL7)
+119 ; 3 - BIFMT (req) Format: 0=ASCII Split, 1=ASCII, 2=HL7, 3=IMM/SERVE
+120 ; 4 - BIVTYPE (req) Visit Type: "I"=Immunization, "S"=Skin Test.
+121 ; 5 - BIDATA (opt) Data returned in this param if desired.
+122 ;
+123 DO HISTORY1^BIEXPRT3(BIDA,.BIDE,1,BIVTYPE,,.BIERR)
+124 IF BIERR]""
SET BIDATA=BI31_BIERR
QUIT
+125 ;
+126 ;
+127 ;---> Set parameters for writing data as a string in BIDATA.
+128 ;---> Parameters:
+129 ; 1 - BIEXP (req) Export: 0=screen, 1=host file, 2=string
+130 ; 2 - BIFMT (req) Format: 1=ASCII, 2=HL7, 3=IMM/SERVE
+131 ; 3 - BIFLNM (opt) File name
+132 ; 4 - BIPATH (opt) BI Path name for host files
+133 ; 5 - BIDATA (ret) Immunization History in "|"-delimited string
+134 ; NOTE: Since this is necessarily only one
+135 ; record, strip "^"-delimiter at end.
+136 ;
+137 DO WRITE^BIEXPRT4(2,1,,,.BIDATA)
+138 ;
+139 ;---> Returned data string, with error delimiter concatenated.
+140 SET BIDATA=$PIECE(BIDATA,U)_BI31
+141 QUIT