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

BIREPD2.m

Go to the documentation of this file.
  1. BIREPD2 ;IHS/CMI/MWR - REPORT, ADOLESCENT RATES; DEC 15, 2011
  1. ;;8.5;IMMUNIZATION;**5**;JUL 01,2013
  1. ;;* MICHAEL REMILLARD, DDS * CIMARRON MEDICAL INFORMATICS, FOR IHS *
  1. ;; VIEW ADOLESCENT IMMUNIZATION RATES REPORT, GATHER DATA.
  1. ; PATCH 1: Clarify Report explanation. START+121
  1. ;; PATCH 3: Include new "1-Td 1-Men 3-HPV" lines. START+69
  1. ;; PATCH 5: Return Patient Totals for queued reports. START+0
  1. ;
  1. ;
  1. ;----------
  1. ;---> Produce Header array for Adolescent Report.
  1. ;---> Parameters:
  1. ; 1 - BIQDT (req) Quarter Ending Date.
  1. ; 2 - BIDAR (req) Adolescent Report Age Range: "11-18^1" (years).
  1. ; 3 - BIAGRPS (req) String of Age Groups ("1112,1313,1317").
  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 - BIUP (req) User Population/Group (Registered, Imm, User, Active).
  1. ;
  1. ;---> Check for required Variables.
  1. Q:'$G(BIQDT)
  1. Q:'$D(BICC)
  1. Q:'$D(BIHCF)
  1. Q:'$D(BICM)
  1. Q:'$D(BIBEN)
  1. Q:'$D(BIDAR)
  1. Q:'$G(BIAGRPS)
  1. Q:'$D(BIUP)
  1. ;
  1. K VALMHDR
  1. N BILINE,X,Y S BILINE=0
  1. ;
  1. S X=""
  1. ;---> If Header array is NOT being for Listmananger include version.
  1. S:'$D(VALM("BM")) X=$$LMVER^BILOGO()
  1. ;
  1. D WH^BIW(.BILINE,X)
  1. S X=$$REPHDR^BIUTL6(DUZ(2)) D CENTERT^BIUTL5(.X)
  1. D WH^BIW(.BILINE,X)
  1. ;
  1. S X="* Adolescent Immunization Report (11-17 yrs) *" D CENTERT^BIUTL5(.X)
  1. D WH^BIW(.BILINE,X)
  1. ;
  1. S X=$$SP^BIUTL5(27)_"Report Date: "_$$SLDT1^BIUTL5(DT)
  1. D WH^BIW(.BILINE,X)
  1. ;
  1. S X=$$SP^BIUTL5(30)_"End Date: "_$$SLDT1^BIUTL5(BIQDT)
  1. D WH^BIW(.BILINE,X,1)
  1. ;
  1. S X=" "_$$BIUPTX^BIUTL6(BIUP)
  1. I BIUP="i" S X=" "_$$BIUPTX^BIUTL6(BIUP,1)_" (Active)"
  1. S X=$$PAD^BIUTL5(X,34)
  1. ;
  1. S Y="Total Patients: "_$G(BITOTPTS)_" (F:"_$G(BITOTFPT)_" M:"_$G(BITOTMPT)_")"
  1. S X=X_$J(Y,45)
  1. D WH^BIW(.BILINE,X)
  1. S X=$$SP^BIUTL5(79,"-")
  1. D WH^BIW(.BILINE,X)
  1. ;
  1. D
  1. .;---> If specific Communities were selected (not ALL), then print
  1. .;---> the Communities in a subheader at the top of the report.
  1. .D SUBH^BIOUTPT5("BICC","Community",,"^AUTTCOM(",.BILINE,.BIERR,,12)
  1. .I $G(BIERR) D ERRCD^BIUTL2(BIERR,.X) D WH^BIW(.BILINE,X) Q
  1. .;
  1. .;---> If specific Health Care Facilities, print subheader.
  1. .D SUBH^BIOUTPT5("BIHCF","Facility",,"^DIC(4,",.BILINE,.BIERR,,12)
  1. .I $G(BIERR) D ERRCD^BIUTL2(BIERR,.X) D WH^BIW(.BILINE,X) Q
  1. .;
  1. .;---> If specific Case Managers, print Case Manager subheader.
  1. .D SUBH^BIOUTPT5("BICM","Case Manager",,"^VA(200,",.BILINE,.BIERR,,12)
  1. .I $G(BIERR) D ERRCD^BIUTL2(BIERR,.X) D WH^BIW(.BILINE,X) Q
  1. .;
  1. .;---> If specific Beneficiary Types, print Beneficiary Type subheader.
  1. .D SUBH^BIOUTPT5("BIBEN","Beneficiary Type",,"^AUTTBEN(",.BILINE,.BIERR,,12)
  1. .I $G(BIERR) D ERRCD^BIUTL2(BIERR,.X) D WH^BIW(.BILINE,X) Q
  1. .;
  1. .;---> Now write Age Group Denominators subheader.
  1. .S X=" Age Group | 11-12yrs 13yrs 13-17yrs"
  1. .D WH^BIW(.BILINE,X)
  1. .S X=" Denominators | "_$J($G(BITOTPTS(1112)),7)_" "
  1. .S X=X_$J($G(BITOTPTS(1313)),7)_" "_$J($G(BITOTPTS(1317)),7)
  1. .D WH^BIW(.BILINE,X)
  1. ;
  1. ;---> If Header array is being built for Listmananger,
  1. ;---> reset display window margins for Communities, etc.
  1. D:$D(VALM("BM"))
  1. .S VALM("TM")=BILINE+3
  1. .S VALM("LINES")=VALM("BM")-VALM("TM")+1
  1. .;---> Safeguard to prevent divide/0 error.
  1. .S:VALM("LINES")<1 VALM("LINES")=1
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. START(BIQDT,BIDAR,BIAGRPS,BICC,BIHCF,BICM,BIBEN,BISITE,BIUP,BITOTPTS,BITOTFPT,BITOTMPT) ;EP
  1. ;---> Produce array for Report.
  1. ;---> Parameters:
  1. ; 1 - BIQDT (req) Quarter Ending Date.
  1. ; 2 - BIDAR (opt) Adolescent Report Age Range: "11-18^1" (years).
  1. ; 3 - BIAGRPS (req) String of Age Groups ("1112,1313,1317").
  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 - BISITE (req) Site IEN.
  1. ; 9 - BIUP (req) User Population/Group (All, Imm, User, Active).
  1. ; 10 - BITOTPTS (ret) Total Patients.
  1. ; 11 - BITOTFPT (ret) Total Female Patients.
  1. ; 12 - BITOTmPT (ret) Total Male Patients.
  1. ;
  1. K ^TMP("BIREPD1",$J)
  1. N BILINE,BITMP,X S BILINE=0
  1. ;
  1. ;---> Check for required Variables.
  1. I '$G(BIQDT) D ERRCD^BIUTL2(623,.X) D WRITE^BIREPD3(.BILINE,X) Q
  1. I '$D(BIDAR) D ERRCD^BIUTL2(613,.X) D WRITE^BIREPD3(.BILINE,X) Q
  1. I '$G(BIAGRPS) D ERRCD^BIUTL2(677,.X) D WRITE^BIREPD3(.BILINE,X) Q
  1. I '$D(BICC) D ERRCD^BIUTL2(614,.X) D WRITE^BIREPD3(.BILINE,X) Q
  1. I '$D(BIHCF) D ERRCD^BIUTL2(625,.X) D WRITE^BIREPD3(.BILINE,X) Q
  1. I '$D(BICM) D ERRCD^BIUTL2(615,.X) D WRITE^BIREPD3(.BILINE,X) Q
  1. I '$D(BIBEN) D ERRCD^BIUTL2(662,.X) D WRITE^BIREPD3(.BILINE,X) Q
  1. I '$G(BISITE) S BISITE=$G(DUZ(2))
  1. I '$G(BISITE) D ERRCD^BIUTL2(109,.X) D WRITE^BIREPD3(.BILINE,X) Q
  1. S:$G(BIUP)="" BIUP="u"
  1. ;
  1. ;---> Gather data.
  1. D GETDATA^BIREPD3(.BICC,.BIHCF,.BICM,.BIBEN,BIQDT,BIDAR,BIAGRPS,BISITE,BIUP,.BITMP,.BIERR)
  1. I $G(BIERR)]"" D WRITE^BIREPD3(.BILINE,BIERR) Q
  1. ;
  1. ;
  1. ;---> BITOTPTS variables (total patients) not newed here because they are
  1. ;---> also used in the Report Header.
  1. ;---> Total.
  1. S BITOTPTS=+$G(BITMP("STATS","TOTLPTS"))
  1. S BITOTPTS(1112)=+$G(BITMP("STATS","TOTLPTS",1112))
  1. S BITOTPTS(1313)=+$G(BITMP("STATS","TOTLPTS",1313))
  1. S BITOTPTS(1317)=+$G(BITMP("STATS","TOTLPTS",1317))
  1. ;---> Females.
  1. S BITOTFPT=+$G(BITMP("STATS","TOTLFPTS"))
  1. S BITOTFPT(1112)=+$G(BITMP("STATS","TOTLFPTS",1112))
  1. S BITOTFPT(1313)=+$G(BITMP("STATS","TOTLFPTS",1313))
  1. S BITOTFPT(1317)=+$G(BITMP("STATS","TOTLFPTS",1317))
  1. ;---> Males.
  1. S BITOTMPT=+$G(BITMP("STATS","TOTLMPTS"))
  1. S BITOTMPT(1112)=+$G(BITMP("STATS","TOTLMPTS",1112))
  1. S BITOTMPT(1313)=+$G(BITMP("STATS","TOTLMPTS",1313))
  1. S BITOTMPT(1317)=+$G(BITMP("STATS","TOTLMPTS",1317))
  1. ;
  1. ;
  1. ;---> VACCINE GROUPS
  1. ;---> Write Statistics lines for each Vaccine Group (BIVGRP).
  1. ;---> NOTE: 132 is specific for Var-Hx of Chickenpox.
  1. ;---> 221 is for the specific vaccine Tdap.
  1. F BIVGRP=4,6,7,132,221,8,9,16,10 D VGRP^BIREPD3(.BILINE,BIVGRP,BIAGRPS,.BITMP,,.BIERR)
  1. I $G(BIERR)]"" D WRITE^BIREPD3(.BILINE,BIERR) Q
  1. ;
  1. ;
  1. ;---> VACCINE COMBINATIONS
  1. ;---> Write Statistics lines for each Vaccine Combinations.
  1. ;---> NOTE: These Combo strings are also used to set BITMP("STATS"
  1. ;---> nodes beginning at +130^BIREPD4.
  1. ;
  1. D VCOMB^BIREPD3(.BILINE,"8|1^4|3^6|2^7|1",BIAGRPS,.BITMP,,.BIERR)
  1. D VCOMB^BIREPD3(.BILINE,"8|1^4|3^6|2^16|1^7|2",BIAGRPS,.BITMP,,.BIERR)
  1. D VCOMB^BIREPD3(.BILINE,"8|1^16|1",BIAGRPS,.BITMP,,.BIERR)
  1. ;
  1. ;********** PATCH 3, v8.5, SEP 10,2012, IHS/CMI/MWR
  1. ;---> Include new "1-Td 1-Men 3-HPV" line for both sexes.
  1. D VCOMB^BIREPD3(.BILINE,"8|1^16|1^17|3",BIAGRPS,.BITMP,"B",.BIERR)
  1. ;**********
  1. ;
  1. ;*******
  1. ;---> Break to write FEMALE Denominators subheader.
  1. D DENOMS(.BILINE,.BITOTFPT,1)
  1. ;
  1. ;---> Write Female Statistics lines for HPV Vaccine Group (BIVGRP=17-HPV).
  1. F BIVGRP=17 D VGRP^BIREPD3(.BILINE,BIVGRP,BIAGRPS,.BITMP,"F",.BIERR)
  1. I $G(BIERR)]"" D WRITE^BIREPD3(.BILINE,BIERR) Q
  1. ;
  1. ;---> Now write FEMALE combos.
  1. ;
  1. ;********** PATCH 3, v8.5, SEP 10,2012, IHS/CMI/MWR
  1. ;---> Add "1-Td 1-Men 3-HPV" combo line for females.
  1. D VCOMB^BIREPD3(.BILINE,"8|1^16|1^17|3",BIAGRPS,.BITMP,"F",.BIERR)
  1. ;**********
  1. ;
  1. D VCOMB^BIREPD3(.BILINE,"8|1^4|3^6|2^16|1^7|2^17|3",BIAGRPS,.BITMP,"F",.BIERR)
  1. ;*******
  1. ;
  1. ;---> Break to write MALE Denominators subheader.
  1. D DENOMS(.BILINE,.BITOTMPT,0)
  1. ;
  1. ;---> Write Male Statistics lines for HPV Vaccine Group (BIVGRP=17-HPV).
  1. F BIVGRP=17 D VGRP^BIREPD3(.BILINE,BIVGRP,BIAGRPS,.BITMP,"M",.BIERR)
  1. I $G(BIERR)]"" D WRITE^BIREPD3(.BILINE,BIERR) Q
  1. ;
  1. ;---> Now write MALE combos.
  1. ;
  1. ;********** PATCH 3, v8.5, SEP 10,2012, IHS/CMI/MWR
  1. ;---> Add "1-Td 1-Men 3-HPV" combo line for males.
  1. D VCOMB^BIREPD3(.BILINE,"8|1^16|1^17|3",BIAGRPS,.BITMP,"M",.BIERR)
  1. ;**********
  1. ;
  1. D VCOMB^BIREPD3(.BILINE,"8|1^4|3^6|2^16|1^7|2^17|3",BIAGRPS,.BITMP,"M",.BIERR)
  1. ;*******
  1. ;
  1. I $G(BIERR)]"" D WRITE^BIREPD3(.BILINE,BIERR) Q
  1. ;
  1. ;---> Finish off report with totals lines at the bottom.
  1. S X=" Total Patients reviewed: "_BITOTPTS
  1. S X=X_" Females: "_BITOTFPT_" Males: "_BITOTMPT
  1. D WRITE^BIREPD3(.BILINE,X)
  1. ;D WRITE^BIREPD3(.BILINE,$$SP^BIUTL5(79,"-"))
  1. ;
  1. ;---> Now write total patients considered who had refusals.
  1. N M,N S (M,N)=0 F S M=$O(BITMP("REFUSALS",M)) Q:'M S N=N+1
  1. S X=" Total Patients reviewed who had Refusals on record: "_N
  1. D WRITE^BIREPD3(.BILINE,X),WRITE^BIREPD3(.BILINE,$$SP^BIUTL5(79,"-"))
  1. ;
  1. D
  1. .I BIUP="r" S X="all Registered Patients who have an active health record." Q
  1. .I BIUP="i" S X="Immunization Register Patients with a status of Active." Q
  1. .I BIUP="u" S X="the User Population patients: 1 visit in the past 3 years." Q
  1. .I BIUP="a" S X="Active Clinical Users: 2 clinical visits in the past 3 years." Q
  1. ;
  1. S X=" *Denominators are "_X
  1. D WRITE^BIREPD3(.BILINE,X)
  1. ;
  1. ;********** PATCH 1, v8.5, JAN 03,2012, IHS/CMI/MWR
  1. ;---> Change text of explanation.
  1. ;S X=" *All patients (11-17yrs) with 1-Tdap_TD and 1-Mening are considered ""Current."""
  1. ;D WRITE^BIREPD3(.BILINE,X)
  1. ;S X=" *Patients 11-12yrs without 1-Tdap_TD and 1-Mening are listed as ""Not Current"""
  1. ;S X=" in order to support patient recall."
  1. ;
  1. ;********** PATCH 3, v8.5, SEP 10,2012, IHS/CMI/MWR
  1. ;---> Update "Current" explanation to include 3-HPV.
  1. ;S X=" *All patients (11-17yrs) with 1-Tdap_TD and 1-Mening are considered ""Current"";"
  1. S X=" *All patients (11-17yrs) with 1-TD_B, 1-MEN, 3-HPV are considered ""Current"";"
  1. ;**********
  1. ;
  1. D WRITE^BIREPD3(.BILINE,X)
  1. S X=" otherwise they are listed as ""Not Current"" in order to support patient recall."
  1. ;
  1. D WRITE^BIREPD3(.BILINE,X)
  1. D WRITE^BIREPD3(.BILINE,$$SP^BIUTL5(79,"-"))
  1. ;
  1. ;---> Set final VALMCNT (Listman line count).
  1. S VALMCNT=BILINE
  1. Q
  1. ;
  1. ;
  1. ;----------
  1. DENOMS(BILINE,BITOTSPT,Z) ;EP
  1. ;---> Produce Female and Male Denominators subheader.
  1. ;---> Parameters:
  1. ; 1 - BILINE (req) Line number in ^TMP Listman array.
  1. ; 2 - BITOTSPT (req) By Sex Total Patients-Age Group-Stats array.
  1. ; 3 - Z (req) If Z=1, then female; Z=0, then male.
  1. ;
  1. ;---> Break to write Female or Male Denominators subheader.
  1. S X=$S(Z:" Female",1:" Male")
  1. S X=X_" | 11-12yrs 13yrs 13-17yrs"
  1. D WRITE^BIREPD3(.BILINE,X)
  1. S X=" Denominators | "_$J($G(BITOTSPT(1112)),7)_" "
  1. S X=X_$J($G(BITOTSPT(1313)),7)_" "_$J($G(BITOTSPT(1317)),7)
  1. D WRITE^BIREPD3(.BILINE,X)
  1. D WRITE^BIREPD3(.BILINE," "_$$SP^BIUTL5(63,"-"))
  1. Q