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

BIREPH3.m

Go to the documentation of this file.
  1. BIREPH3 ;IHS/CMI/MWR - REPORT, H1N1 ACCOUNTABILITY; AUG 10,2010
  1. ;;8.5;IMMUNIZATION;;SEP 01,2011
  1. ;;* MICHAEL REMILLARD, DDS * CIMARRON MEDICAL INFORMATICS, FOR IHS *
  1. ;; VIEW OR PRINT H1N1 ACCOUNTABILITY REPORT.
  1. ;; v8.3 PATCH 3: BIREPH* routines are completely new for H1N1 Report.
  1. ;; v8.3 PATCH 4: Modify H1N1 Report to count 2nd doses regardless of Date Range.
  1. ;; v8.4 PATCH 1: Extend time frame of report: 8/1/09 to 8/31/10. GETIMMS+32
  1. ;
  1. ;
  1. ;----------
  1. GETIMMS(BIBEGDT,BIENDDT,BICC,BIHCF,BICM,BIBEN,BIHIST,BIVT) ;EP
  1. ;---> Get Immunizations from V Files.
  1. ;---> Parameters:
  1. ; 1 - BIBEGDT (req) Begin Visit Date.
  1. ; 2 - BIENDDT (req) End Visit Date.
  1. ; 3 - BICC (req) Current Community array.
  1. ; 4 - BIHCF (req) Health Care Facility array.
  1. ; 5 - BICM (req) Case Manager array.
  1. ; 6 - BIBEN (req) Beneficiary Type array.
  1. ; 7 - BIHIST (req) Include Historical (1=yes,0=no).
  1. ; 8 - BIVT (req) Visit Type array.
  1. ;
  1. ;---> Set begin and end dates for search through V Immunization File.
  1. ;
  1. ;***********************************************************
  1. ;********** PATCH 4, v8.3, DEC 30,2009, IHS/CMI/MWR
  1. ;---> PATCH: Modify H1N1 Report to count 2nd doses regardless of Date Range.
  1. ;
  1. ;Q:'$G(BIBEGDT) Q:'$G(BIENDDT)
  1. ;N N S N=BIBEGDT-.9999
  1. ;F S N=$O(^AUPNVIMM("ADT",N)) Q:(N>(BIENDDT+.9999)!('N)) D
  1. ;.N M S M=0
  1. ;.F S M=$O(^AUPNVIMM("ADT",N,M)) Q:'M D
  1. ;..N P S P=0
  1. ;..F S P=$O(^AUPNVIMM("ADT",N,M,P)) Q:'P D
  1. ;...D CHKSET(N,M,P,.BICC,.BIHCF,.BICM,.BIBEN,BIHIST,.BIVT)
  1. ;
  1. ;---> Hard code for 2009-2010 Season.
  1. ;
  1. Q:'$G(BIBEGDT) Q:'$G(BIENDDT)
  1. ;
  1. ;********** PATCH 1, v8.4, AUG 01,2010, IHS/CMI/MWR
  1. ;---> Extend time frame of report from Aug 1, 2009 until Aug 30, 2010.
  1. ;N N S N=3090901-.9999
  1. ;F S N=$O(^AUPNVIMM("ADT",N)) Q:(N>(3100430+.9999)!('N)) D
  1. N N S N=3090801-.9999
  1. F S N=$O(^AUPNVIMM("ADT",N)) Q:(N>(3100830+.9999)!('N)) D
  1. .;**********
  1. .;
  1. .N M S M=0
  1. .F S M=$O(^AUPNVIMM("ADT",N,M)) Q:'M D
  1. ..N P S P=0
  1. ..F S P=$O(^AUPNVIMM("ADT",N,M,P)) Q:'P D
  1. ...D CHKSET(N,M,P,.BICC,.BIHCF,.BICM,.BIBEN,BIHIST,.BIVT,BIBEGDT,BIENDDT)
  1. ;
  1. ;************************************************************
  1. ;
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. ;************************************************************
  1. ;********** PATCH 4, v8.3, DEC 30,2009, IHS/CMI/MWR
  1. ;---> PATCH: Pass Date Range Parameters to limit report display.
  1. CHKSET(BIDATE,BIVIEN,BIIIEN,BICC,BIHCF,BICM,BIBEN,BIHIST,BIVT,BIBEGDT,BIENDDT) ;EP
  1. ;************************************************************
  1. ;(BIDATE,BIVIEN,BIIIEN,BICC,BIHCF,BICM,BIBEN,BIHIST,BIVT)
  1. ;---> Check if this visit fits criteria; if so, set it
  1. ;---> in ^TMP("BIREPH1".
  1. ;---> Parameters:
  1. ; 1 - BIDATE (req) Date of Visit.
  1. ; 2 - BIVIEN (req) VISIT IEN.
  1. ; 3 - BIIIEN (req) V IMMUNIZAITON IEN.
  1. ; 4 - BICC (req) Current Community array.
  1. ; 5 - BIHCF (req) Health Care Facility array.
  1. ; 6 - BICM (req) Case Manager array.
  1. ; 7 - BIBEN (req) Beneficiary Type array.
  1. ; 8 - BIHIST (req) Include Historical (1=yes,0=no).
  1. ; 9 - BIVT (req) Visit Type array.
  1. ;
  1. ;************************************************************
  1. ; 10 - BIBEGDT (req) Begin Visit Date.
  1. ; 11 - BIENDDT (req) End Visit Date.
  1. ;************************************************************
  1. ;
  1. Q:'$G(BIDATE)
  1. Q:'$G(BIVIEN)
  1. Q:'$G(BIIIEN)
  1. Q:'$D(^AUPNVSIT(BIVIEN,0))
  1. Q:'$D(^AUPNVIMM(BIIIEN,0))
  1. Q:'$D(BICC)
  1. Q:'$D(BIHCF)
  1. Q:'$D(BICM)
  1. Q:'$D(BIBEN)
  1. Q:'$D(BIVT)
  1. ;
  1. N BIAGRP,BIDFN,BIIMM,BIVGRP,BIVNAM,BIDOSE,Y
  1. S Y=^AUPNVIMM(BIIIEN,0)
  1. S BIDFN=$P(Y,U,2),BIIMM=$P(Y,U) ;,BIDOSE=$P(Y,U,4)
  1. ;
  1. ;---> Quit if this Vaccine should not be included in this report.
  1. ;---> As of v8.4, include all vaccines given during the selected time.
  1. ;Q:'$P($G(^AUTTIMM(BIIMM,0)),U,17) ;vvv8.4
  1. ;
  1. ;---> Quit if Current Community doesn't match.
  1. Q:$$CURCOM^BIEXPRT2(BIDFN,.BICC)
  1. ;
  1. ;---> Quit if Health Care Facility doesn't match.
  1. N BIVDATA S BIVDATA=^AUPNVSIT(BIVIEN,0)
  1. Q:$$HCF(BIVDATA,.BIHCF)
  1. ;---> Quit if Visit Type doesn't match.
  1. Q:$$VT(BIVDATA,.BIVT)
  1. ;
  1. ;---> Quit if not including Historical Visits and this Visit has
  1. ;---> a Category of "Historical".
  1. I '$G(BIHIST) Q:$$HIST(BIVDATA)
  1. ;
  1. ;---> Quit if Case Manager doesn't match.
  1. Q:$$CMGR^BIDUR(BIDFN,.BICM)
  1. ;
  1. ;---> Quit if Beneficiary Type doesn't match.
  1. Q:$$BENT^BIDUR1(BIDFN,.BIBEN)
  1. ;
  1. ;---> Quit if this is not H1N1.
  1. Q:($$IMMVG^BIUTL2(BIIMM,2)'=18)
  1. ;
  1. S BIVNAM=$$VNAME^BIUTL2(BIIMM)
  1. S BIAGRP=$$AGEGRP(BIDFN,BIDATE)
  1. ;S BIVGRP=$$IMMVG^BIUTL2(BIIMM,4)
  1. ;---> Check if this is Dose #1 or #2.
  1. D
  1. .I '$D(^TMP("BIDFN",$J,BIDFN)) S BIDOSE=1,^TMP("BIDFN",$J,BIDFN)="" Q
  1. .S BIDOSE=2
  1. ;
  1. ;************************************************************
  1. ;********** PATCH 4, v8.3, DEC 30,2009, IHS/CMI/MWR
  1. ;---> PATCH: Do not store this result if it is not in the REQUESTED Date Range.
  1. ;
  1. Q:(BIDATE<BIBEGDT)
  1. Q:(BIDATE>(BIENDDT+.9999))
  1. ;
  1. ;************************************************************
  1. ;
  1. N Z
  1. ;---> Add for this Vaccine, Dose, Age.
  1. ;S Z=$G(BITMP("STATS",BIVGRP,BIVNAM,BIDOSE,BIAGRP))
  1. ;S BITMP("STATS",BIVGRP,BIVNAM,BIDOSE,BIAGRP)=Z+1
  1. ;
  1. ;---> Add for this Vaccine, Dose, Total.
  1. ;S Z=$G(BITMP("STATS",BIVGRP,BIVNAM,BIDOSE,"TOTAL"))
  1. ;S BITMP("STATS",BIVGRP,BIVNAM,BIDOSE,"TOTAL")=Z+1
  1. ;
  1. ;---> Add for this Date, Dose, Age, Total.
  1. S Z=$G(BITMP("STATS",BIDATE,BIDOSE,"AGE",BIAGRP))
  1. S BITMP("STATS",BIDATE,BIDOSE,"AGE",BIAGRP)=Z+1
  1. ;
  1. ;---> Add for this Date, Dose, Total.
  1. S Z=$G(BITMP("STATS",BIDATE,BIDOSE,"TOTAL"))
  1. S BITMP("STATS",BIDATE,BIDOSE,"TOTAL")=Z+1
  1. ;
  1. ;---> Add for this Dose, Total.
  1. S Z=$G(BITMP("STATS","DOSES",BIDOSE,"TOTAL"))
  1. S BITMP("STATS","DOSES",BIDOSE,"TOTAL")=Z+1
  1. ;
  1. ;---> Add for ALL Doses, Total.
  1. S Z=$G(BITMP("STATS","ALL","TOTAL"))
  1. S BITMP("STATS","ALL","TOTAL")=Z+1 K Z
  1. ;
  1. ;---> Add refusals, if any.
  1. ;---> Not desired on this report, per Ros 10-12-05
  1. ;D CONTRA^BIUTL11(BIDFN,.Z,1) I $O(Z(0)) S BITMP("REFUSALS",BIDFN)=""
  1. ;
  1. Q
  1. ;
  1. ;
  1. ;
  1. ;----------
  1. AGEGRP(BIDFN,BIDATE) ;EP
  1. ;---> Return Patient's Age Group.
  1. ;---> Parameters:
  1. ; 1 - BIDFN (req) IEN in PATIENT File.
  1. ; 2 - BIDATE (req) Date of Visit.
  1. ;
  1. N X S X=$$AGE^BIUTL1(BIDFN,1,BIDATE)
  1. Q:X<2 1
  1. Q:X<5 2
  1. Q:X<19 3
  1. Q:X<25 4
  1. Q:X<50 5
  1. Q:X<65 6
  1. Q 7
  1. ;
  1. ;
  1. ;----------
  1. HCF(BIVDATA,BIHCF) ;EP
  1. ;---> Return Health Care Facility indicator.
  1. ;---> Return 1 if not selecting all Health Care Facilities (Locations)
  1. ;---> and if the Health Care Facility of this visit is not one of the
  1. ;---> ones selected.
  1. ;---> Parameters:
  1. ; 1 - BIVDATA (req) Data in ^AUPNVSIT(BIVIEN,0).
  1. ; 2 - BIHCF (req) Health Care Facility array.
  1. ;
  1. Q:$D(BIHCF("ALL")) 0
  1. Q:'$G(BIVDATA) 1
  1. N BILOC S BILOC=$P(BIVDATA,U,6)
  1. Q:'BILOC 1
  1. Q:'$D(BIHCF(BILOC)) 1
  1. Q 0
  1. ;
  1. ;
  1. ;----------
  1. VT(BIVDATA,BIVT) ;EP
  1. ;---> Return Visit Type indicator.
  1. ;---> Return 1 if not selecting all Visit Types and if this Visit Type
  1. ;---> is not one of the ones selected.
  1. ;---> Parameters:
  1. ; 1 - BIVDATA (req) Data in ^AUPNVSIT(BIVIEN,0).
  1. ; 2 - BIVT (req) Health Care Facility array.
  1. ;
  1. Q:$D(BIVT("ALL")) 0
  1. Q:'$G(BIVDATA) 1
  1. N BIVTYPE S BIVTYPE=$P(BIVDATA,U,3)
  1. Q:BIVTYPE="" 1
  1. Q:'$D(BIVT(BIVTYPE)) 1
  1. Q 0
  1. ;
  1. ;
  1. ;----------
  1. HIST(BIVDATA) ;EP
  1. ;---> Return Historical Visit indicator.
  1. ;---> Return 1 if this Visit has a Category of "Historical".
  1. ;---> Parameters:
  1. ; 1 - BIVDATA (req) Data in ^AUPNVSIT(BIVIEN,0).
  1. ;
  1. Q:'$G(BIVDATA) 1
  1. Q:$P(BIVDATA,U,7)="E" 1
  1. Q 0