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

BIXCALL.m

Go to the documentation of this file.
  1. BIXCALL ;IHS/CMI/MWR - XCALL TO IMMSERVE LIBRARY; MAY 10, 2010
  1. ;;8.5;IMMUNIZATION;**2**;MAY 15,2012
  1. ;;* MICHAEL REMILLARD, DDS * CIMARRON MEDICAL INFORMATICS, FOR IHS *
  1. ;; XCALL TO IMMSERVE LIBRARY FOR FORCASTING IMMUNIZATIONS.
  1. ;; Called from ^BIPATUP.
  1. ;; PATCH 1: Change Immserve host file names to "06". RUN+46
  1. ;
  1. ;
  1. ;----------
  1. RUN(BIHX,BIRPT,BIDATA,BIERR) ;EP
  1. ;---> Entry point for XCALL to Immserve Forecast Library.
  1. ;---> Patient's Immunization History is supplied; ImmServe Forecast
  1. ;---> is returned as text profile (BIRPT) and as data string (BIDATA).
  1. ;---> Parameters:
  1. ; 1 - BIHX (req) String containing Patient's Immunization History.
  1. ; 2 - BIRPT (ret) String returning text version of forcast.
  1. ; 3 - BIDATA (ret) String returning data version of forcast.
  1. ; 4 - BIERR (ret) String returning text of error code.
  1. ;
  1. ;---> Quit if Patient IMM Hx not provided.
  1. I $G(BIHX)="" S (BIRPT,BIDATA,BIERR)=$$ERROR(999) Q
  1. ;
  1. ;---> Uncomment to see Patient History sent to ImmServe.
  1. ;W !,"BIHX: ",BIHX R ZZZ
  1. ;
  1. S BIERR="",BIRPT="",BIDATA=""
  1. S BIHX=BIHX_$C(10)
  1. ;
  1. ;---> BIDLLPROG is special variable--stored locally, not passed--for speed.
  1. I $G(BIDLLPROG)="" D
  1. .S:'$D(BISITE) BISITE=+$G(DUZ(2))
  1. .N BIDLLPATH
  1. .S BIDLLPATH=$$IMMSVDIR^BIUTL8(BISITE)
  1. .I $G(BIDLLPATH)="" S BIERR=119 Q
  1. .;
  1. .;---> SAC Exemption from 2.2.3.3.2
  1. .;---> Purpose: Cache proprietary call to check/set Immserve directory.
  1. .;---> SAC Exemption Memo dated Feb 2004.
  1. .S $ZT="ERRTRAP^BIXCALL"
  1. .I $ZU(168,BIDLLPATH)
  1. .I $G(BIERR)]"" Q
  1. .;
  1. .;---> Set ImmServe Program call.
  1. .;W !!,"BUILDING CALL" R ZZZ ;Uncomment for testing.
  1. .;
  1. .;---> Patch to flag whether system is 32-bit or 64-bit.
  1. .D
  1. ..N Y,BIT S Y=$$VERSION^%ZOSV(1)
  1. ..;
  1. ..;---> SAC Exemption from 2.2.6.2.3
  1. ..;---> This command from Intersystems is necessary to determine whether
  1. ..;---> the operating system is 32-bit or 64-bit. (Request made to VA
  1. ..;---> for future %ZOSV call.) Returns 4 for 32-bit and 8 for 64-bit.
  1. ..S BIT=$ZU(40,0,4)
  1. ..;
  1. ..;********** VERSION 8.4, v8.4, APR 15,2010, IHS/CMI/MWR
  1. ..;---> Change to "02" for new Immserve, e.g., biwin3202 instead of biwin3201.
  1. ..;---> Change to "04" for new Immserve, e.g., biwin3204 instead of biwin3202.
  1. ..;********** VERSION 8.5, JUL 01,2011, IHS/CMI/MWR
  1. ..;---> Change to "05" for new Immserve, e.g., biwin3205 instead of biwin3204.
  1. ..;********** VERSION 8.52, MAY 15,2012, IHS/CMI/MWR
  1. ..;---> Change to "06" for new Immserve, e.g., biwin3206 instead of biwin3205.
  1. ..;
  1. ..I ((Y["Windows")&(BIT=8)) S BIDLLPROG="biwin6406.dll" Q
  1. ..I Y["Windows" S BIDLLPROG="biwin3206.dll" Q
  1. ..I ((Y["Linux")&(BIT=8)) S BIDLLPROG="bilin6406.so" Q
  1. ..I Y["Linux" S BIDLLPROG="bilin3206.so" Q
  1. ..I ((Y["Solaris")&(BIT=8)) S BIDLLPROG="bisol6406.so" Q
  1. ..I ((Y["UNIX")&(BIT=8)) S BIDLLPROG="biaix6406.so" Q
  1. ..I Y["UNIX" S BIDLLPROG="biaix3206.so" Q
  1. ..;---> NEXT LINE: Good for calling a new version conditional upon Immserve path.
  1. ..;I ((Y["UNIX")&(BIT=8)) S BIDLLPROG="biaix6403.so" S:BIDLLPATH["84a" BIDLLPROG="biaix6404.so" Q
  1. ..;**********
  1. ..;
  1. ..I $G(BIDLLPROG)="" S BIERR=120 Q
  1. .;---> Now prepend the path.
  1. .S BIDLLPROG=BIDLLPATH_BIDLLPROG
  1. I $G(BIERR)]"" Q
  1. ;
  1. ;---> SAC Exemption from 2.2.3.3.2
  1. ;---> Purpose: To trap error during Cache proprietary call to Immserve library.
  1. ;---> SAC Exemption Memo dated Feb 2004.
  1. S $ZT="ERRTRAP1^BIXCALL"
  1. ;
  1. ;---> Load the DLL if it is not already in the partition.
  1. I '$G(BIDLLID)!('$G(BIDLLRUN)) D LOAD(BIDLLPROG,.BIDLLID,.BIDLLRUN,.BIERR)
  1. I BIERR S (BIRPT,BIDATA,BIERR)=$$ERROR^BIXCALL(BIERR) Q
  1. ;
  1. S BIHX=BIHX_$C(10)
  1. ;
  1. ;---> SAC Exemption from 2.2.6.2.3
  1. ;---> Purpose: Cache proprietary call to Immserve commercial forecasting
  1. ;---> software. This applies to all $ZF calls in this routine.
  1. ;---> SAC Exemption Memo dated Feb 2004.
  1. ;---> Dimitri Fane's ZF call to Fred Sayward's library.
  1. S BIRESULT=$ZF(-5,BIDLLID,BIDLLRUN,"",BIHX,"",8192,"",8192)
  1. ;
  1. ;---> For Testing, uncomment next line to see the raw data returned
  1. ;---> from ImmServe:
  1. ;W !!!,BIRESULT R ZZZ
  1. ;
  1. S BIERR=$P(BIRESULT,"&&&,",1)
  1. I BIERR S (BIRPT,BIDATA,BIERR)=$$ERROR^BIXCALL(BIERR) Q
  1. S BIDATA=$P(BIRESULT,"&&&,",2)
  1. S BIRPT=$P(BIRESULT,"&&&,",3)
  1. S:BIERR=0 BIERR=""
  1. ;
  1. ;N X,Y
  1. ;S X=$P(BIDATA,"Female"),Y=$P(BIDATA,"Female",2)
  1. ;S BIDATA=X_"Female^"_Y
  1. ;
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. LOAD(BIDLLPROG,BIDLLID,BIDLLRUN,BIERR) ;EP
  1. ;W !,"LOADING..." R ZZZ ;Uncomment for testing.
  1. ;---> Cache Load and initialize Immserve Forecast Library.
  1. ;---> This load may be run repeatedly in the same partition, however
  1. ;---> for the sake of performance it should only be called the
  1. ;---> first time. Test for BIDLLID and BIDLLRUN determines whether
  1. ;---> this gets called or not.
  1. ;---> Parameters:
  1. ; 1 - BIDLLPROG (req) Path and name of ImmServe Program call.
  1. ; 2 - BIDLLID (ret) Index number to the DLL.
  1. ; 3 - BIDLLRUN (ret) Index number to the RUN function of the DLL.
  1. ; 4 - BIERR (ret) Error code if DLL not loaded successfully.
  1. ;
  1. ;---> $ZF(-4,1,path) loads a DLL and returns the index number to the DLL.
  1. S BIDLLID=$ZF(-4,1,BIDLLPROG)
  1. I '$G(BIDLLID) S BIERR=997 Q
  1. ;
  1. ;---> $ZF(-4,3,BIDLLID,function) returns the index number of the function
  1. ;---> in the DLL described by BIDLLID.
  1. ;---> Next line: IMM_IHS (load and run in one call) not used.
  1. ;S BIDLLRUN=$ZF(-4,3,BIDLLID,"IMM_ASCII")
  1. N BILOAD
  1. S BILOAD=$ZF(-4,3,BIDLLID,"IMM_ASCII_LOAD")
  1. S BIDLLRUN=$ZF(-4,3,BIDLLID,"IMM_ASCII_RUN")
  1. I '$G(BIDLLRUN) S BIERR=996 Q
  1. S BIERR=$P($ZF(-5,BIDLLID,BILOAD,""),"&&&")
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. ERROR(BIERRNUM) ;EP
  1. ;---> Return text of error, based on number passed.
  1. ;---> Parameters:
  1. ; 1 - BIERRNUM (req) Numeric value of error.
  1. ;
  1. Q "BICALL Error: "_$$ERRMSG(BIERRNUM)
  1. ;
  1. ;
  1. ;----------
  1. ERRMSG(X) ;EP
  1. ;---> Error messages.
  1. Q:X=1 "1;Some cases could not be processed."
  1. Q:X=-1 "-1;Cannot find, open, load the Versions/Variants file."
  1. Q:X=-2 "-2;Cannot find, open, load Imm/Def table file."
  1. Q:X=-3 "-3;Cannot find, open, load Screening table file."
  1. Q:X=-4 "-4;Cannot find, open, load Live Vaccine Table file."
  1. Q:X=-5 "-5;Cannot find, open, load Facts defining constants file."
  1. Q:X=-6 "-6;Cannot find, open, load VFC eligibility file."
  1. Q:X=-7 "-7;Cannot find, open, load Knowledge Base file."
  1. Q:X=-8 "-8;Cannot initialize time tables."
  1. Q:X=-9 "-9;Cannot initialize timeline."
  1. Q:X=-10 "-10;Input carot string is empty."
  1. Q:X=-11 "-11;Input case not terminated with new line."
  1. Q:X=-12 "-12;Cannot convert a carot notation input case."
  1. Q:X=-13 "-13;Cannot initialize global data structures."
  1. Q:X=-14 "-14;Internal report writer buffer overflow."
  1. Q:X=-15 "-15;Internal report writer fatal error."
  1. Q:X=-16 "-16;Interface report buffer overflow."
  1. Q:X=-17 "-17;Cannot convert to carot notation output."
  1. Q:X=-18 "-18;Interface output buffer overflow."
  1. Q:X=-19 "-19;Fatal runtime error."
  1. Q:X=-99 "-99;Immserve not loaded into memory. D LOAD^BIXCALL."
  1. Q:X=100 "100;Report Buffer must be at least 80."
  1. Q:X=200 "200;Data Buffer must be at least 80."
  1. Q:X=101 "101;Report buffer too small for report."
  1. Q:X=201 "201;Data buffer too small for data."
  1. Q:X=996 "996;Failure to obtain Immserve DLL RUN number."
  1. Q:X=997 "997;Failure to obtain Immserve DLL ID number."
  1. Q:X=998 "998;Immserve path not provided."
  1. Q:X=999 "999;Patient Immunization History data not provided."
  1. Q:X=9999 "9999;XCALL Failure (Immserve file not loaded)."
  1. Q "99999;Unknown error"
  1. ;
  1. ;
  1. ;----------
  1. ERRTRAP ;EP
  1. ;---> Error trap for Invalid ImmServe Path.
  1. ;---> Attempt to open Host File Server.
  1. ;---> SAC Exemption from 2.4.3.1, 2.4.9.1, 2.4.11.1.
  1. ;---> Purpose: to address HFS for forecasting without changing
  1. ;---> the current display/print Device and its IO characteristics.
  1. ;---> SAC Exemption Memo dated 1 Nov 99.
  1. ;
  1. D ERRCD^BIUTL2(118,.BIERR)
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. ERRTRAP1 ;EP
  1. ;---> Error trap for Invalid ImmServe library call.
  1. D ERRCD^BIUTL2(122,.BIERR)
  1. Q