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

AUPNPCT.m

Go to the documentation of this file.
AUPNPCT ; IHS/CMI/LAB - CALLED FROM TRIGGER ON V MEAS ;
 ;;2.0;IHS PCC SUITE;;MAY 14, 2009;Build 9
 ; FOR PERCENTILES, HT AND WT, AGE UP TO AND NOT INCLUDING AGE 18
EN ; ENTRY POINT FROM MUMPS XREF ON VALUE FIELD OF V MEASUREMENT FILE
 I '$G(AUPNPAT) S AUPNPAT=$P(^AUPNVMSR(DA,0),U,2)
 I '$G(AUPNVSIT) S AUPNVSIT=$P(^AUPNVMSR(DA,0),U,3)
 S AUPNPD1=$P(^DPT(AUPNPAT,0),U,3)
 S AUPNPD2=+^AUPNVSIT(AUPNVSIT,0)
 I ((AUPNPD2-AUPNPD1)\10000)<18
 E  K AUPNPD1,AUPNPD2 Q  ; not under age 18
 S AUPNHTWT=+^AUPNVMSR(DA,0)
 I AUPNHTWT,($D(^AUTTMSR("B","HT",AUPNHTWT))!$D(^AUTTMSR("B","WT",AUPNHTWT))) S AUPNHTWT=$S($D(^AUTTMSR("B","HT",AUPNHTWT)):"HT",1:"WT")
 E  I '$P(^AUPNVMSR(DA,0),U,5) K AUPNPD1,AUPNPD2,AUPNHTWT Q  ; not HT or WT, no previous pctile for entry (would exist if type modified to not HT or WT)
 E  D DELPCT K AUPNPD1,AUPNPD2,AUPNHTWT Q
 D AGEMO
 D GETPCT
 K AUPNHTWT
 Q
 ;
AGEMO ; Get age in months
 ;S AUPNPYR=$E(AUPNPD2,2,3)-$E(AUPNPD1,2,3),AUPNPMO=$E(AUPNPD2,4,5)-$E(AUPNPD1,4,5)
 S AUPNPYR=(AUPNPD2\10000)-(AUPNPD1\10000),AUPNPMO=$E(AUPNPD2,4,5)-$E(AUPNPD1,4,5) ;IHS/DSD/JLG 2/18/98 for Y2K compliance
 I AUPNPMO<0 S AUPNPMO=AUPNPMO+12,AUPNPYR=AUPNPYR-1
 S AUPNAGE=12*AUPNPYR+AUPNPMO
 K AUPNPMO,AUPNPYR,AUPNPD1,AUPNPD2
 Q
 ;
GETPCT ; Call to extrinsic function AUPNPC to get percentile for this ht or wt
 S AUPNSAVX=X
 S AUPNPCT=$$AUHTWT^AUPNPC(AUPNHTWT,$P(^DPT(AUPNPAT,0),U,2),AUPNAGE,$S($D(AUPNPT01):$P(^AUPNVMSR(DA,0),U,4),1:X))
 S AUPNPCT=$S(AUPNPCT[">":99.9,AUPNPCT["<":.1,1:AUPNPCT)
 S $P(^AUPNVMSR(DA,0),U,5)=$S(AUPNCIXF="S":AUPNPCT,1:"")
 D XREF
 S X=AUPNSAVX
 K AUPNAGE,AUPNPCT,AUPNSAVX
 Q
 ;
XREF ; Set "APCT" xref on .05 field, execute other xrefs
 S X=AUPNPCT
 S AUPNV=$D(^AUPNVMSR("AQ",$S(AUPNHTWT="HT":"HPC",1:"WPC")_$E("000",1,3-$L($P(X,".")))_X,DA)) S:AUPNCIXF="S" ^(DA)="" K:AUPNCIXF="K" ^(DA)
 D ^XBGXREFS(9000010.01,.05,.AUPNXREF)
 S AUPNNUM=0 F  S AUPNNUM=$O(AUPNXREF(21,AUPNNUM)) Q:'AUPNNUM  X AUPNXREF(21,AUPNNUM,AUPNCIXF)
 K AUPNNUM,AUPNXREF,AUPNV
 Q
 ;
DELPCT ; Called if type of meas. changes to not Ht or Wt and entry has pctile
 NEW X
 S X=$P(^AUPNVMSR(DA,0),U,5)
 S $P(^AUPNVMSR(DA,0),U,5)=""
 F AUPNTYP="HPC","WPC" K ^AUPNVMSR("AQ",AUPNTYP_$E("000",1,3-$L($P(X,".")))_X,DA)
 D ^XBGXREFS(9000010.01,.05,.AUPNXREF)
 S AUPNNUM=0 F  S AUPNNUM=$O(AUPNXREF(21,AUPNNUM)) Q:'AUPNNUM  X AUPNXREF(21,AUPNNUM,"K")
 K AUPNPCT,AUPNTYP
 Q
 ;