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

BIXTCH.m

Go to the documentation of this file.
  1. BIXTCH ;IHS/CMI/MWR - XCALL TO TCH FORECASTER; MAY 10, 2010
  1. ;;8.5;IMMUNIZATION;**9**;OCT 01,2014
  1. ;;* MICHAEL REMILLARD, DDS * CIMARRON MEDICAL INFORMATICS, FOR IHS *
  1. ;; XCALL TO TCH FOR FORCASTING IMMUNIZATIONS.
  1. ;; Called from ^BIPATUP.
  1. ;; PATCH 8: New routine to accommodate new TCH Forecaster RUN+0
  1. ;; PATCH 9: Add DUZ2 to retrieve IP address for call to TCH. RUN+0
  1. ;
  1. SAMPLE ;
  1. ;---> Sample Cache Device handling code to interact with TCH Java Forecaster.
  1. ;---> 6708 is the TCH Forecaster default port (can change in the OS command).
  1. O "|TCP|4":("127.0.0.1":6708::):10
  1. U "|TCP|4"
  1. W "Bonjour, Monsier le Monde",!
  1. U "|TCP|4" R X:1
  1. C "|TCP|4"
  1. U 0 W !,X
  1. Q
  1. ;
  1. ;
  1. ;********** PATCH 9, v8.5, OCT 01,2014, IHS/CMI/MWR
  1. ;---> Add DUZ2 so that BIXTCH can retrieve IP address for TCH.
  1. ;----------
  1. RUN(BIHX,BIDUZ2,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 - BIDUZ2 (req) User's DUZ(2) to indicate IP address for TCH.
  1. ; 3 - BIRPT (ret) String returning text version of forcast.
  1. ; 4 - BIDATA (ret) String returning data version of forcast.
  1. ; 5 - 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 TCH Forecaster.
  1. ;W !,"Full Input String: ",BIHX R ZZZ
  1. ;
  1. S BIERR="",BIRPT="",BIDATA=""
  1. S BIHX=BIHX_$C(10)
  1. N BIRESULT
  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^BIXTCH"
  1. ;
  1. ;---> Preserve the current Device to return to after using TCP.
  1. N BIDEVICE S BIDEVICE=$IO
  1. ;
  1. ;---> Open TCP in Streaming Mode (to accommodate greater data length.).
  1. ;
  1. ;---> Get IP address for TCH Forecaster.
  1. I '$G(BIDUZ2) S (BIRPT,BIDATA,BIERR)=$$ERROR(124) Q
  1. N BIIP S BIIP=$$IPTCH^BIUTL8(BIDUZ2)
  1. I BIIP="" S (BIRPT,BIDATA,BIERR)=$$ERROR(125) Q
  1. ;
  1. ;O "|TCP|4":("127.0.0.1":6708:"S":):3
  1. O "|TCP|4":(BIIP:6708:"S":):3
  1. ;**********
  1. ;
  1. U "|TCP|4"
  1. W BIHX,!
  1. U "|TCP|4" R BIRESULT:1
  1. C "|TCP|4"
  1. ;
  1. ;---> Return to using previous Device.
  1. U BIDEVICE
  1. ;
  1. ;---> For Testing, uncomment next line to see the raw data returned from TCH:
  1. ;W !,$L(BIRESULT) R ZZZ
  1. ;W !!!,"Result directly back from forecaster (in BIXTCH): ",!,BIRESULT,!! R ZZZ
  1. ;
  1. S BIERR=$P(BIRESULT,"&&&",1)
  1. I BIERR]"" S (BIRPT,BIDATA,BIERR)=BIERR Q
  1. ;I BIERR]"" S (BIRPT,BIDATA,BIERR)=$$ERROR^BIXTCH(BIERR) Q
  1. S BIDATA=$P(BIRESULT,"&&&",2)
  1. S BIRPT=$P(BIRESULT,"&&&",3)
  1. S:BIERR=0 BIERR=""
  1. ;
  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 "BIXTCH 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 "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(123,.BIERR)
  1. Q