source: FOIAVistA/tag/r/ADVERSE_REACTION_TRACKING-GMRA-GMA/GMRADPT.m@ 636

Last change on this file since 636 was 628, checked in by George Lilly, 14 years ago

initial load of FOIAVistA 6/30/08 version

File size: 5.3 KB
Line 
1GMRADPT ;HIRMFO/RM,WAA-UTILITY TO GATHER PATIENT DATA ;1/15/98 13:47
2 ;;4.0;Adverse Reaction Tracking;**2,10**;Mar 29, 1996
3EN1 ; ENTRY TO GATHER PATIENT A/AR DATA
4 ;INPUT VARIABLES:
5 ;
6 ; DFN Pointer to Patient file.
7 ; GMRA (OPTIONAL) A^B^C DEFAULT="0^0^111"
8 ; where A = 0 return all reactions (allergic/non-allergic).
9 ; 1 return allergies only.
10 ; 2 return non-allergies only.
11 ; B = 0 return all data (verified or non-verified).
12 ; 1 return only verified data.
13 ; 2 return only non-verified data.
14 ; C = X_Y_Z
15 ; where X, Y, and Z are either 0 or 1. 1 would mean to
16 ; return an Adverse Reaction of that particular type,
17 ; and zero means do not return an Adverse Reaction of
18 ; that type.
19 ; X is for TYPE=OTHER
20 ; Y is for TYPE=FOOD
21 ; Z is for TYPE=DRUG.
22 ; E.g., 001 (return drug only), 111 (returns all types),
23 ; and 010 (returns food only).
24 ;OUTPUT VARIABLES:
25 ; GMRAL = 1 if patient has Adverse Reaction
26 ; 0 if patient has no known Adverse Reaction
27 ; null if patient has not been asked about Adverse Reaction
28 ; GMRAL(PTR TO 120.8) = A^B^C^D^E^F^G^H^I
29 ; where A = Pointer to Patient file.
30 ; B = Free text of causative agent.
31 ; *C = Type of reaction, where D is drug, F is food, and O is
32 ; other.
33 ; D = 1 if Adverse Reaction has been verified
34 ; 0 if Adverse Reaction has not been verified
35 ; E = 0 if this is an allergic reaction
36 ; 1 if this is not an allergic reaction
37 ; **F = the mechanism of reaction in the format:
38 ; External format;Internal format
39 ; (ALLERGY;0, PHARMACOLOGIC;2, UNKNOWN;U).
40 ; G = Type of reaction.
41 ; where D = drug
42 ; DF = drug/food
43 ; DFO = drug/food/other
44 ; DO = drug/other
45 ; F = food
46 ; FO = food/other
47 ; O = other
48 ; H = the mechanism of reaction in the format:
49 ; External format;Internal format
50 ; (ALLERGY;A, PHARMACOLOGIC;P, UNKNOWN;U)
51 ; I = IEN and Global root of reactant (stored in piece B above)
52 ; set equal to the GMR ALLERGY field (#1) of the PATIENT
53 ; ALLERGY file (#120.8)
54 ; GMRAL(PTR TO 120.8,"S",COUNT) = S
55 ; where COUNT = number 1 to number of signs/symptoms for this
56 ; reaction.
57 ; S = a sign/symptom for this reaction in the format:
58 ; External format;Internal format
59 ;
60 ;* NOTE: This piece will no longer be supported after 9/1/97,
61 ; Please use piece G.
62 ;** NOTE: This piece will no longer be supported after 9/1/97,
63 ; Please use piece H.
64 ;
65 N GMRAOTH
66 Q:'$D(DFN) S:'$D(GMRA)#2 GMRA="0^0^111" K GMRAL
67DPT ;
68 ;Read NKA Node in file 120.86
69 S GMRAL=$P($G(^GMR(120.86,DFN,0)),U,2)
70 ;Do not set GMRAL array if patient is unassessed or NKA.
71 I GMRAL=0 Q ;PATIENT HAS NO KNOWN ALLERGIES
72 F GMRAREC=0:0 S GMRAREC=$O(^GMR(120.8,"B",DFN,GMRAREC)) Q:GMRAREC'>0 S GMRANODE=$S($D(^GMR(120.8,GMRAREC,0)):^(0),1:"") D:GMRANODE SETAL
73 I GMRAL=1,+$O(GMRAL(0))'>0 S GMRAL=0 ;if flag is set to 1 (reactions exist), then make certain the reactions are passed in the GMRAL array
74 K GMRA,GMRANODE,GMRAOSOF,GMRAREC,GMRATCNT
75 Q
76SETAL ;
77 N %,GMRAI,GMRASIGN
78 ;Q:'$P(GMRANODE,"^",12)&'$D(GMRAOSOF) ;IF NOT SIGNED OFF MARK IT
79 Q:+$G(^GMR(120.8,GMRAREC,"ER"))&'$D(GMRAERR) ;IF ENTERED IN ERROR QUIT
80 I GMRAL'=1 S GMRAL=1 ; PATIENT HAS ALLERGIES
81 S GMRAI=0 ; BEGIN CHECK FOR ADR/ALL CRITERIA
82 I '$P(GMRA,"^") S GMRAI=1
83 E I $P(GMRA,"^")=1 S:$F("AU",$P(GMRANODE,"^",14))>1 GMRAI=1
84 E S:$F("P",$P(GMRANODE,"^",14))>1 GMRAI=1
85 Q:'GMRAI ; QUIT IF ADR/ALL CRITERIA NOT MET
86 Q:2-$P(GMRA,"^",2)=(1-$P(GMRANODE,"^",16)) ;QUIT IF VER/NON VER CRITERIA NOT MET
87 S GMRAI=0 ; BEGIN CHECK FOR ALLERGY TYPE CRITERIA
88 F %=1:1:3 I $E($P(GMRA,"^",3),%),$P(GMRANODE,"^",20)[$E("OFD",%) S GMRAI=1 Q
89 Q:'GMRAI ; QUIT IF ALLERGY TYPE CRITERIA NOT MET
90 D PASS(GMRAREC,.GMRAL)
91 Q
92PASS(GMRAREC,GMRAL) ; Data filer
93 ; This subroutine will store all the patient date for a reaction is an
94 ; array.
95 ; Input:
96 ; GMRAREC = The IEN for the entry in 120.8
97 ;Output:
98 ; GMRAL(GMRAREC) the array entry for the record
99 ;
100 N GMRANODE
101 S GMRANODE=$G(^GMR(120.8,GMRAREC,0)) Q:GMRANODE=""
102 S %=$P(GMRANODE,"^",14)
103 S GMRAL(GMRAREC)=$P(GMRANODE,"^",1,2)_"^"_$E($P(GMRANODE,"^",20))_"^"_+$P(GMRANODE,"^",16)_"^"_$S(%="A"!(%="U"):0,1:1)
104 S GMRAL(GMRAREC)=GMRAL(GMRAREC)_"^"_$S(%="A":"ALLERGY;0",%="P":"PHARMACOLOGIC;2",%="U":"UNKNOWN;U",1:"")_"^"_$P(GMRANODE,"^",20)_"^"_$S(%="A":"ALLERGY;A",%="P":"PHARMACOLOGIC;P",%="U":"UNKNOWN;U",1:"")
105 S GMRAL(GMRAREC)=GMRAL(GMRAREC)_"^"_$P(GMRANODE,"^",3)
106 Q:'$O(^GMR(120.8,GMRAREC,10,0)) ;QUIT IF NO SIGNS/SYMPTOMS
107 S:'$D(GMRAOTH) GMRAOTH=$O(^GMRD(120.83,"B","OTHER REACTION",0))
108 S GMRAX=0,GMRAY=1 F S GMRAX=$O(^GMR(120.8,GMRAREC,10,GMRAX)) Q:GMRAX<1 D I GMRAZ'="" S GMRAL(GMRAREC,"S",GMRAY)=GMRAZ(1),GMRAY=GMRAY+1
109 .S GMRAZ=$G(^GMR(120.8,GMRAREC,10,GMRAX,0))
110 .S GMRAZ(1)=$S(+GMRAZ'=GMRAOTH:$P($G(^GMRD(120.83,+GMRAZ,0)),U)_";"_+GMRAZ,1:$P(GMRAZ,U,2)_";"_+GMRAZ)
111 .Q
112 K GMRAX,GMRAY,GMRAZ
113 Q
Note: See TracBrowser for help on using the repository browser.