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

WVRPSNP.m

Go to the documentation of this file.
  1. WVRPSNP ;HCIOFO/FT,JR - REPORT: SNAPSHOT OF PROGRAM;05/24/2017 14:32
  1. ;;1.0;WOMEN'S HEALTH;**7,8,24**;Sep 30, 1998;Build 582
  1. ;; Original routine created by IHS/ANMC/MWR
  1. ;;* MICHAEL REMILLARD, DDS * ALASKA NATIVE MEDICAL CENTER *
  1. ;; CALLED BY OPTION: "WV PRINT SNAPSHOT" TO DISPLAY FROM 1/1 CURRENT
  1. ;; YEAR TO PRESENT #PATIENTS, #PAPS, #MAMS, #DELINQUENT NEEDS, ETC.
  1. ;
  1. D SETVARS^WVUTL5 S WVFAC=DUZ(2) K ^TMP("WVF",$J)
  1. N A,B,C,D,E,F,G,H,I,J,K,L,M,N,P,Q,R,S,X,Y,WA,WB,WC,WE,WF,WG,WH,WX,N0
  1. N WVBRTXND,WVCXTXND
  1. D TITLE^WVUTL5("PROGRAM SNAPSHOT")
  1. D ASKTOY G:WVPOP EXIT
  1. D ASKSAVE G:WVPOP EXIT
  1. D DEVICE G:WVPOP EXIT
  1. D GATHER
  1. D:WVA STORE
  1. K WVDTIEN
  1. D ^WVRPSNP1
  1. ;
  1. EXIT ;EP
  1. D KILLALL^WVUTL8
  1. K ^TMP("WVF",$J)
  1. Q
  1. ;
  1. ASKTOY ;
  1. S WVTOY="" S DIR("A")=" Report by (C)alendar or (F)iscal year? "
  1. S DIR(0)="SAO^C:Calendar Year;F:Fiscal Year",DIR("B")="Fiscal"
  1. D ^DIR
  1. I "FC"'[Y S WVPOP=1 Q
  1. S WVTOY=Y
  1. S WVJDT=$E(DT,1,3)_"0000"
  1. I WVTOY="C" Q
  1. I $E(DT,4,5)<10 S WVJDT=$E(DT-10000,1,3)_"1000" Q
  1. S WVJDT=$E(DT,1,3)_"1000"
  1. Q
  1. DEVICE ;EP
  1. ;---> GET DEVICE AND POSSIBLY QUEUE TO TASKMAN.
  1. S ZTRTN="DEQUEUE^WVRPSNP"
  1. F WVSV="A","FAC","TOY","JDT" D
  1. .I $D(@("WV"_WVSV)) S ZTSAVE("WV"_WVSV)=""
  1. D ZIS^WVUTL2(.WVPOP,1,"HOME")
  1. Q
  1. ;
  1. ASKSAVE ;EP
  1. ;---> ASK IF THIS REPORT SHOULD BE SAVED FOR LATER RETRIEVAL.
  1. N DIR,DIRUT,Y
  1. W !!?3,"Should today's Snapshot be stored for later retrieval and"
  1. W " comparisons?"
  1. S DIR(0)="Y",DIR("A")=" Enter Yes or No",DIR("B")="NO"
  1. S WVA=0 D HELP1
  1. D ^DIR K DIR W !
  1. S:$D(DIRUT) WVPOP=1
  1. S:Y WVA=1
  1. Q
  1. ;
  1. DEQUEUE ;EP
  1. ;---> QUEUED REPORT
  1. N A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S,X,Y
  1. D SETVARS^WVUTL5,GATHER,STORE,^WVRPSNP1,EXIT
  1. Q
  1. ;
  1. STORE ;EP
  1. ;---> STORE REPORT DATA IN FILE #790.71.
  1. Q:'WVA
  1. N WVDR,DA,DIC,DIE,X,Y
  1. S WVDR=".02////"_WVFAC,Y=.02
  1. F WVI=A,B,C,D,E,F,G,H,S,J,K,L,P,Q,R D
  1. .S Y=Y+.01,WVDR=WVDR_";"_Y_"////"_WVI
  1. S Y=.5,WVJDR=".5////"_WVI(1)
  1. F WVJ=2:1:30 S Y=Y+.01 S WVJDR=WVJDR_";"_Y_"////"_WVI(WVJ)
  1. S WVDR=WVDR_";.18////"_WVTOY
  1. N A,B,C,D,E,F,G,H,S,J,K,L,P,Q,R D
  1. .S A=0,WVJNDA="" F S A=$O(^WV(790.71,"B",DT,A)) Q:A'>0 D Q:WVJNDA>0
  1. ..S:$D(^WV(790.71,"T",WVTOY,A)) WVJNDA=A
  1. .I WVJNDA'>0 D
  1. ..K DD,DO S DIC="^WV(790.71,",DIC(0)="ML",X=DT
  1. ..D FILE^DICN Q:Y<0 S WVJNDA=+Y
  1. .S Y=$G(WVJNDA) Q:Y'>0
  1. .D DIE^WVFMAN(790.71,WVDR,WVJNDA)
  1. .D DIE^WVFMAN(790.71,WVJDR,WVJNDA)
  1. Q
  1. ;
  1. ;
  1. GATHER ;EP
  1. ;---> GATHER DATA
  1. S (A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S)=0
  1. ;---> USE WVDT SO THAT THE DATE WON'T CHANGE IF RUN SPANS MIDNIGHT.
  1. D SETVARS^WVUTL5 S WVDT=DT
  1. S WVBRTXND=$$IEN^WVUTL9(790.51,"Not Indicated")
  1. S WVCXTXND=$$IEN^WVUTL9(790.5,"Not Indicated")
  1. ;
  1. ;---> PATIENT DATA
  1. F S N=$O(^WV(790,N)) Q:'N S Y=^WV(790,N,0) D
  1. .;---> QUIT IF PATIENT IS NOT ACTIVE.
  1. .Q:$P(Y,U,24)
  1. .;---> QUIT IF PATIENT IS DECEASED.
  1. .Q:$$DECEASED^WVUTL1($P(Y,U))
  1. .;---> TOTAL ACTIVE WOMEN IN REGISTER.
  1. .S A=A+1
  1. .;---> WOMEN PREGNANT.
  1. .I $$ISPREG^WVUTL11(N) S B=B+1
  1. .;---> DES DAUGHTERS.
  1. .S:$P(Y,U,15) C=C+1
  1. .;---> WOMEN WITH CERVICAL TX NEEDS NOT SPECIFIED OR NOT DATED.
  1. .; Don't count if need is "Not Indicated"
  1. .I ($P(Y,U,11)'=WVCXTXND) I 5[$P(Y,U,11)!('$P(Y,U,12)) S D=D+1
  1. .;---> IF DATE DUE=NULL IT WAS COUNTED LINE ABOVE, SO DON'T COUNT
  1. .;---> IT IN THE LINE BELOW: +$P(Y,U,19).
  1. .;---> WOMEN WITH CERVICAL TX NEEDS SPECIFIED AND PAST DUE.
  1. .I ($P(Y,U,11)'=WVCXTXND) I 5'[$P(Y,U,11)&($P(Y,U,12)<WVDT)&(+$P(Y,U,12)) S E=E+1
  1. .;---> WOMEN WITH BREAST TX NEEDS NOT SPECIFIED OR NOT DATED.
  1. .; Don't count if need is "Not Indicated"
  1. .I ($P(Y,U,18)'=WVBRTXND) I 8[$P(Y,U,18)!('$P(Y,U,19)) S F=F+1
  1. .;---> WOMEN WITH BREAST TX NEEDS SPECIFIED AND PAST DUE.
  1. .I ($P(Y,U,18)'=WVBRTXND) I 8'[$P(Y,U,18)&($P(Y,U,19)<WVDT)&(+$P(Y,U,19)) S G=G+1
  1. ;
  1. ;---> PROCEDURE DATA
  1. S N=0
  1. F S N=$O(^WV(790.1,"S","o",N)) Q:'N S Y=^WV(790.1,N,0) D
  1. .Q:"o"'[$P(Y,U,14)
  1. .Q:$P(Y,U,5)=8
  1. .S H=H+1 S:$P(Y,U,13)<WVDT S=S+1
  1. ;
  1. ;---> TOTAL PAPS, CBES, AND MAMS FOR THIS YEAR (SINCE JAN 1, OR FISCAL).
  1. S N=WVJDT,WVENDDT1=WVDT+.9999
  1. F S N=$O(^WV(790.1,"D",N)) Q:'N!(N>WVENDDT1) D
  1. .S M=0
  1. .F S M=$O(^WV(790.1,"D",N,M)) Q:'M S Y=^WV(790.1,M,0) D
  1. ..;---> BELOW IS HARD CODED FOR IENS IN ^WV(790.2, (PAP, CBE, OR MAM) AND
  1. ..;---> ^WV(790.31, (ERROR/DISREGARD). COULD BE MORE ROBUST BY LOOKING
  1. ..;---> AT #.10 FIELD OF ^WV(790.2 AND #.23 FIELD OF ^WV(790.31,.
  1. ..Q:$P(Y,U,5)=8
  1. ..I $P(Y,U,4)=1 S P=P+1 Q ;---> PAP
  1. ..I $P(Y,U,4)=25!($P(Y,U,4)=26)!($P(Y,U,4)=28) S Q=Q+1 Q ;---> MAM
  1. ..I $P(Y,U,4)=27 S R=R+1 ;---> CBE
  1. ;
  1. ;---> NOTIFICATION DATA
  1. S N=0
  1. F S N=$O(^WV(790.4,"AOPEN",N)) Q:'N D
  1. .S M=0
  1. .F S M=$O(^WV(790.4,"AOPEN",N,M)) Q:'M D
  1. ..I '$D(^WV(790.4,M,0)) K ^WV(790.4,"AOPEN",N,M) Q
  1. ..S Y=^WV(790.4,M,0)
  1. ..S:$P(Y,U,14)="o" J=J+1
  1. ..S:$P(Y,U,14)="o"&($P(Y,U,13)<WVDT) K=K+1
  1. ;---> LETTERS QUEUED
  1. S N=0 F S N=$O(^WV(790.4,"APRT",N)) Q:'N D
  1. .S M=0 F S M=$O(^WV(790.4,"APRT",N,M)) Q:'M S L=L+1
  1. R ;---> TREATMENT REFUSALS
  1. N WVREFPCE
  1. ;piece # and its value form a link for refusal counts
  1. ; (e.g., piece 1 has a value of 24). Entry #1 in File 790.2 is Pap Smear
  1. ; and the # of refused Pap Smears is stored in piece 24 (of node 2)
  1. ; in File 790.71.
  1. S WVREFPCE="24^4^13^6^^^7^9^^^^^^^^^16^8^5^25^26^14^15^12^18^19^2^20^11^22^23^17^21^10^27^^3^1^28^29^30"
  1. F WA=1:1:41 D
  1. .S WB=$P(WVREFPCE,U,WA)
  1. .Q:'WB
  1. .S WVI(WB)=0
  1. S WA=WVJDT F S WA=$O(^WV(790.3,"B",WA)) Q:WA'>0 D
  1. .S WB=0 F S WB=$O(^WV(790.3,"B",WA,WB)) Q:WB'>0 D
  1. ..S N0=$G(^WV(790.3,WB,0))
  1. ..N P1 F P1=1,2,3,4 S P1(P1)=$P(N0,U,P1) S:P1(P1)="" P1(P1)="NOT ENTERED"
  1. ..Q:'P1(3)
  1. ..S WVCN=+$P(WVREFPCE,U,+P1(3)) Q:'WVCN
  1. ..S WVI(WVCN)=WVI(WVCN)+1
  1. Q
  1. ;
  1. ;
  1. HELP1 ;EP
  1. ;;Answer "YES" to store the results of today's snapshot after they
  1. ;;have been printed out. These results can then be retrieved in the
  1. ;;future (by calling up today's date) and compared to other Snapshots
  1. ;;in order to look at the trends and progress of your program over
  1. ;;time. (Note: If a previous snapshot for today has been run, it will
  1. ;;be overwritten by this or any later run today.)
  1. ;;
  1. ;;Answer "NO" to simply print today's Snapshot without storing it.
  1. S WVTAB=5,WVLINL="HELP1" D HELPTX
  1. Q
  1. ;
  1. HELPTX ;EP
  1. N I,T,X S T=$$REPEAT^XLFSTR(" ",WVTAB)
  1. F I=1:1 S X=$T(@WVLINL+I) Q:X'[";;" S DIR("?",I)=T_$P(X,";;",2)
  1. S DIR("?")=DIR("?",I-1) K DIR("?",I-1)
  1. Q