source: WorldVistAEHR/trunk/r/GEN_MED_REC_VITALS-GMRV/GMRVPCE3.m@ 1578

Last change on this file since 1578 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 3.9 KB
RevLine 
[613]1GMRVPCE3 ;HIRMFO/RM,FT-V/M Data Validation for AICS ;07/26/05 8:26am
2 ;;5.0;GEN. MED. REC. - VITALS;**13**;Oct 31, 2002
3 ;
4 ; This routine uses the following IAs:
5 ; #10104 - ^XLFSTR calls (supported)
6 ;07/25/2005 BAY/KAM HD 0000000068371 changed lowest range height from 0 to 10
7 ;
8VALID(TYPE,X) ; This function returns 1 if rate (X) is valid for
9 ; measurement type (TYPE).
10 N FXN S FXN=0
11 I TYPE="VU" S TYPE="VC"
12 D @TYPE I $D(X) S FXN=1
13 Q FXN
14AG ; INPUT TRANSFORM FOR ABDOMINAL GIRTH
15 N UNIT S UNIT=$$UP^XLFSTR($P(X,+X,2,10)) I UNIT="" K X Q
16 S X=+X
17 I $E(UNIT)="C"&("CM"[UNIT) S X=$$CMTOIN(+X,0),UNIT="IN"
18 I $E(UNIT)="I"&("IN"[UNIT) K:+X'=X!(X>150)!(X<0)!(X?.E1"."1N.N) X
19 E K X
20 Q
21AUD ; INPUT TRANSFORM FOR AUDIOMETRY.
22 N I,R,L
23 K:X'?.N1"/".N1"/".N1"/".N1"/".N1"/".N1"/".N1"/".N1"/".N1"/".N1"/".N1"/".N1"/".N1"/".N1"/".N1"/".N1"/" X
24 I $D(X) F I=1:1:8 S R=$P(X,"/",I) I R]"" K:+R'=R!(R>110)!(R<0) X
25 I $D(X) F I=9:1:16 S L=$P(X,"/",I) I L]"" K:+L'=L!(L>110)!(L<0) X
26 Q
27BP ; INPUT TRANSFORM FOR BLOOD PRESSURE
28 K:X'?2.3N1"/"2.3N1"/"2.3N&(X'?2.3N1"/"2.3N) X I $D(X) K:$P(X,"/",1)>300!($P(X,"/",2)>300)!(+$P(X,"/",3)>300) X
29 I $D(X),$P(X,"/")'>$P(X,"/",$L(X,"/")) K X
30 Q
31FH ; INPUT TRANSFORM FOR FUNDAL HEIGHT
32 N UNIT S UNIT=$$UP^XLFSTR($P(X,+X,2,10)) I UNIT="" K X Q
33 S X=+X
34 I $E(UNIT)="C"&("CM"[UNIT) S X=$$CMTOIN(+X,0),UNIT="IN"
35 I $E(UNIT)="I"&("IN"[UNIT) K:+X'=X!(X>50)!(X<10)!(X?.E1"."1N.N) X
36 E K X
37 Q
38FT ; INPUT TRANSFORM FOR FETAL HEART TONES
39 K:+X'=X!(X>250)!(X<50)!(X?.E1"."1N.N) X
40 Q
41HC ; INPUT TRANSFORM FOR HEAD CIRCUMFERENCE
42 N UNIT S UNIT=$$UP^XLFSTR($P(X,+X,2,10)) I UNIT="" K X Q
43 I $E(UNIT)="C"&("CM"[UNIT) D Q
44 . K:+X>76!(+X<26)!(+X?.E1"."3N.N) X
45 . I $D(X) S X=$J(.3937*(+X),0,2)
46 . Q
47 I $E(UNIT)="I" D Q
48 . K:+X>30!(+X<10)!(+X?.E1"."4N.N) X
49 . I $D(X),+X?.E1"."1N.N D
50 . . N F S F=$P(+X,".",2)
51 . . K:"^125^25^375^5^625^75^875^"'[("^"_F_"^") X
52 . . Q
53 . I $D(X) S X=+X
54 . Q
55 K X
56 Q
57HE ; INPUT TRANSFORM FOR HEARING
58 K:"^N^A^"'[("^"_$$UP^XLFSTR(X)_"^") X
59 Q
60HT ; INPUT TRANSFORM FOR HEIGHT
61 D EN3^GMRVUT0 K:X=0!(X>100)!(X<10) X
62 Q
63PU ; INPUT TRANSFORM FOR PULSE
64 K:+X'=X!(X>300)!(X<0)!(X?.E1"."1N.N) X
65 Q
66RS ; INPUT TRANSFORM FOR RESPIRATION
67 K:+X'=X!(X>100)!(X<0)!(X?.E1"."1N.N) X
68 Q
69TON ; INPUT TRANSFORM FOR TONOMETRY
70 N R,L
71 K:X'?.N1"/"1N.N&(X'?1N.N1"/".N) X
72 I $D(X) S R=$P(X,"/") I R]"" K:R'=+R!(R>80)!(R<0) X
73 I $D(X) S L=$P(X,"/",2) I L]"" K:L'=+L!(L>80)!(L<0) X
74 Q
75TMP ; INPUT TRANSFORM FOR TEMPERATURE
76 K:+X'=X!(X>120)!(X<0)!(X?.E1"."3N.N) X I $D(X) S:X<45 X=$J(+X*(9/5)+32,0,1)
77 Q
78VC ; INPUT TRANSFORM FOR VISION CORRECTED (AND VISION UNCORRECTED)
79 N R,L
80 K:X'=+X&(X'?.N1"/"1N.N) X
81 I $D(X) S R=$P(X,"/") I R]"" K:R'=+R!(R>999)!(R<10) X
82 I $D(X) S L=$P(X,"/",2) I L]"" K:L'=+L!(L>999)!(L<10) X
83 Q
84WT ; INPUT TRANSFORM FOR WEIGHT
85 I $L(X)>10 K X Q
86 S GMR=$E($P(X,+X,2)) S X=$S(GMR="":0,"Kk"[GMR:+$J(2.2*(+X),0,2),"Ll"[GMR:+X,1:0) K:X>1500!(X=0)!(X<0) X K GMR
87 Q
88PN ; INPUT TRANSFORM FOR PAIN
89 K:"^0^1^2^3^4^5^6^7^8^9^10^99^"'[(U_X_U) X
90 Q
91UNITRATE(TYPE,RATE,UNIT) ; This function will add the unit of
92 ; measurement to the rate so the input transforms will work properly.
93 ; Input variables: TYPE = Measurement type
94 ; RATE = Actual measurement (passed in by ref.)
95 ; UNIT = Unit of measurement
96 ; Function value: Transormed rate with units on the end.
97 N FXN S FXN=RATE,UNIT=$G(UNIT)
98 I TYPE="AG"!(TYPE="FH")!(TYPE="HC")!(TYPE="HT") D
99 . I "^CM^IN^"'[("^"_UNIT_"^") S FXN=""
100 . E S FXN=RATE_$E(UNIT)
101 . Q
102 I TYPE="TMP" D
103 . I "^C^F^"'[("^"_UNIT_"^") S FXN=""
104 . I UNIT="F",RATE<45 S FXN=""
105 . I UNIT="C" S FXN=+$J(+RATE*(9/5)+32,0,1)
106 . Q
107 I TYPE="WT" D
108 . I "^LB^KG^"'[("^"_UNIT_"^") S FXN=""
109 . E S FXN=RATE_$E(UNIT)
110 . Q
111 Q FXN
112CMTOIN(X,PREC) ; Convert CM to IN, given CM value (X) this function will
113 ; return IN value. Optional input value of PREC for precision,
114 ; if not set, 2 decimals will be returned.
115 Q +$J(.3937*(+X),0,+$G(PREC,2))
Note: See TracBrowser for help on using the repository browser.