source: FOIAVistA/trunk/r/CLINICAL_CASE_REGISTRIES-ROR/RORRP026.m@ 1384

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

initial load of FOIAVistA 6/30/08 version

File size: 8.8 KB
Line 
1RORRP026 ;HCIOFO/SG - RPC: CDC UTILITIES ; 5/19/06 2:52pm
2 ;;1.5;CLINICAL CASE REGISTRIES;**1**;Feb 17, 2006;Build 24
3 ;
4 ;--------------------------------------------------------------------
5 ; Registry: [VA HIV]
6 ;--------------------------------------------------------------------
7 Q
8 ;
9 ;***** POPULATES THE FDA WITH THE CDC DATA
10 ;
11 ; IENS IENS of the record in the ROR HIV STUDY file
12 ;
13 ; TBLREF Reference to a field table in the source code
14 ;
15 ; SRCBUF Source data segment
16 ;
17 ; .FDA Reference to a local variable where the FDA
18 ; nodes are created
19 ;
20 ; [.CACHE] Reference to a local variable where the field
21 ; lists are cached.
22 ;
23 ; Return Values:
24 ; <0 Error code
25 ; 0 Ok
26 ;
27CDCFDA(IENS,TBLREF,SRCBUF,RORFDA,CACHE) ;
28 N BUF,FLD,I,POS,RC,RESULT,RORMSG,TGET,TMP,VAL
29 S RC=0
30 ;--- Prepare the fields (if they are not in the cache already)
31 I $D(CACHE("CDCFLDS",TBLREF))<10 D Q:RC<0 RC
32 . S TGET="S BUF=$T("_$P(TBLREF,"^")_"+I^"_$P(TBLREF,"^",2)_")"
33 . F I=1:1 X TGET S BUF=$P(BUF,";;",2,999) Q:BUF="" D
34 . . S FLD=$TR($P(BUF,U,2)," ") Q:FLD'>0
35 . . S TMP=+$TR($P(BUF,U)," ")
36 . . I TMP'>0 S CACHE("CDCFLDS",TBLREF,+FLD)="" Q
37 . . S:FLD["D" TMP=TMP_"D" ; MM/YY field
38 . . S:FLD["R" TMP=TMP_"R" ; Read-only field
39 . . S CACHE("CDCFLDS",TBLREF,+FLD,$S(FLD["E":"E",1:"I"))=TMP
40 ;--- Store the data into the FDA
41 S FLD="",RC=0
42 F S FLD=$O(CACHE("CDCFLDS",TBLREF,FLD)) Q:FLD="" D Q:RC
43 . S POS=$G(CACHE("CDCFLDS",TBLREF,FLD,"I"))
44 . I POS'>0 S POS=$G(CACHE("CDCFLDS",TBLREF,FLD,"E")) Q:POS'>0
45 . Q:POS["R" ; Skip read-only fields
46 . S VAL=$P(SRCBUF,U,+POS)
47 . I VAL="" S RORFDA(799.4,IENS,FLD)="" Q
48 . ;--- Process the 'YY/MM' date field
49 . I POS["D" D Q
50 . . S TMP=$$DATE1(VAL)
51 . . I TMP<0 S RC=(+POS)_U_$P(SRCBUF,U) Q
52 . . S RORFDA(799.4,IENS,FLD)=TMP
53 . ;--- Precede the internal pointer value with the "`"
54 . I +VAL=VAL S:$$GET1^DID(799.4,FLD,,"TYPE")="POINTER" VAL="`"_VAL
55 . ;--- Validate the value and store it into the FDA
56 . D VAL^DIE(799.4,IENS,FLD,"FU",VAL,.RESULT,"RORFDA","RORMSG")
57 . S:RESULT="^" RC=(+POS)_U_$P(SRCBUF,U)
58 Q RC
59 ;
60 ;***** FORMATS THE FILEMAN DATE AS 'MM/YY' OR 'YYYY'
61DATE(DATE) ;
62 Q:DATE'>0 ""
63 N MMYY,MONTH
64 S MMYY=$TR($$FMTE^XLFDT(DATE,"6DF")," ","0")
65 S MONTH=$P(MMYY,"/",2)
66 Q $S(MONTH'="00":MONTH_"/"_$E($P(MMYY,"/",3),3,4),1:$P(MMYY,"/",3))
67 ;
68 ;***** CONVERTS THE 'MM/YY' OR 'YYYY' INTO THE FILEMAN DATE
69DATE1(MMYY) ;
70 Q:$G(MMYY)="" ""
71 N DATE
72 ;--- Just a year (YY or YYYY)
73 I MMYY?.1(2N)2N D Q $G(DATE,-1)
74 . D DT^DILF("EP",MMYY,.DATE)
75 ;--- Month and year
76 D DT^DILF("EP",$P(MMYY,"/",2),.DATE)
77 I $G(DATE)>0 D D DT^DILF("P",MMYY,.DATE)
78 . S $P(MMYY,"/",2)=$G(DATE(0))
79 Q $G(DATE,-1)
80 ;
81 ;***** LOADS THE DATA FROM THE 'ROR HIV STUDY' FILE
82 ;
83 ; IENS IENS of the record in the ROR HIV STUDY file
84 ;
85 ; TBLREF Reference to a field table in the source code
86 ;
87 ; DSTBUF Reference to a local variable where the data
88 ; is returned to
89 ;
90 ; [.RORBUF] Reference to a local variable where the source
91 ; field values are returned to (by GETS^DIQ)
92 ;
93 ; [.CACHE] Reference to a local variable where the field
94 ; lists are cached.
95 ;
96 ; Return Values:
97 ; <0 Error code
98 ; 0 Ok
99 ;
100LOAD(IENS,TBLREF,DSTBUF,RORBUF,CACHE) ;
101 N BUF,FLD,I,RC,RORMSG,TGET,TMP
102 S RC=0
103 ;--- Prepare the fields (if they are not in the cache already)
104 I $D(CACHE("CDCFLDS",TBLREF))<10 D Q:RC<0 RC
105 . S TGET="S BUF=$T("_$P(TBLREF,"^")_"+I^"_$P(TBLREF,"^",2)_")"
106 . F I=1:1 X TGET S BUF=$P(BUF,";;",2,999) Q:BUF="" D
107 . . S FLD=$TR($P(BUF,U,2)," ") Q:FLD'>0
108 . . S TMP=+$TR($P(BUF,U)," ")
109 . . I TMP'>0 S CACHE("CDCFLDS",TBLREF,+FLD)="" Q
110 . . S:FLD["D" TMP=TMP_"D"
111 . . S CACHE("CDCFLDS",TBLREF,+FLD,$S(FLD["E":"E",1:"I"))=TMP
112 . ;--- Create the list of fields for the GETS^DIQ
113 . S (CACHE("CDCFLDS",TBLREF),FLD)=""
114 . F S FLD=$O(CACHE("CDCFLDS",TBLREF,FLD)) Q:FLD="" D
115 . . S CACHE("CDCFLDS",TBLREF)=CACHE("CDCFLDS",TBLREF)_FLD_";"
116 ;--- Load the data from the file
117 D GETS^DIQ(799.4,IENS,CACHE("CDCFLDS",TBLREF),"EI","RORBUF","RORMSG")
118 I $G(DIERR) D Q RC
119 . S RC=$$DBS^RORERR("RORMSG",-9,,,799.4,IENS)
120 ;--- Store the data into the output buffer
121 S FLD=""
122 F S FLD=$O(CACHE("CDCFLDS",TBLREF,FLD)) Q:FLD="" D
123 . S I=""
124 . F S I=$O(CACHE("CDCFLDS",TBLREF,FLD,I)) Q:I="" D
125 . . S TMP=CACHE("CDCFLDS",TBLREF,FLD,I)
126 . . I '(TMP["D") S $P(DSTBUF,U,+TMP)=$G(RORBUF(799.4,IENS,FLD,I)) Q
127 . . S $P(DSTBUF,U,+TMP)=$$DATE($G(RORBUF(799.4,IENS,FLD,"I")))
128 Q $S(RC<0:RC,1:0)
129 ;
130 ;***** RETURNS DATE FIELD NUMBER FOR THE POSITIVE HIV DETECTION TEST
131PHIVFLD(TYPE) ;
132 Q $S(TYPE=1:18.01,TYPE=2:18.02,TYPE=3:18.03,1:0)
133 Q
134 ;
135CDCFLDS ;***** CDC FIELD TABLE
136HDR ;
137 ;; 3 ^ 9.01I ^ DATE CDC FORM COMPLETED
138 ;; 4 ^ ^ CDC FORM COMPLETED BY (DUZ)
139 ;; 5 ^ ^ CDC FORM COMPLETED BY (Name)
140 ;; 6 ^ ^ Phone number of the person completed the form
141CDM ;
142 ;; 3 ^ 9.02I ^ STATUS AT REPORT
143 ;; ^ 9.03I ^ AGE AT HIV DIAGNOSIS
144 ;; ^ 9.04I ^ AGE AT AIDS DIAGNOSIS
145 ;; 5 ^ 9.9ER ^ PATIENT STATUS
146 ;; 6 ^ 9.06I ^ STATE/TERRITORY OF DEATH
147 ;; 7 ^ 9.07I ^ COUNTRY OF BIRTH
148 ;; ^ 9.08I ^ DEPENDENCY OR POSSESSION NAME
149 ;; ^ 9.09I ^ OTHER COUNTRY DESCRIPTION
150 ;; 9 ^ 9.1I ^ ONSET OF ILLNESS/AIDS- CITY
151 ;; 10 ^ 9.11I ^ ONSET OF ILLNESS/AIDS- COUNTY
152 ;; 11 ^ 9.12I ^ ONSET OF ILLNESS/AIDS- STATE (IEN)
153 ;; 12 ^ 9.12E ^ ONSET OF ILLNESS/AIDS- STATE (Name)
154 ;; 13 ^ 9.13I ^ ONSET OF ILLNESS/AIDS- COUNTRY
155 ;; 14 ^ 9.14I ^ ONSET OF ILLNESS/AIDS- ZIP
156FD ;
157 ;; 3 ^ 12.01I ^ AIDS DX - HOSPITAL
158 ;; 4 ^ 12.02I ^ AIDS DX - CITY
159 ;; 5 ^ 12.03I ^ AIDS DX - STATE (IEN)
160 ;; 6 ^ 12.03E ^ AIDS DX - STATE (Name)
161 ;; 7 ^ 12.04I ^ AIDS DX - COUNTRY
162 ;; 8 ^ 12.05I ^ AIDS DX - FACILITY SETTING
163 ;; 9 ^ 12.06I ^ AIDS DX - FACILITY TYPE
164 ;; 10 ^ 12.07I ^ AIDS DX - OTHER FACILITY TYPE
165 ;
166PH ;
167 ;; 3 ^ 14.01I ^ SEX RELATIONS W/MALE PARTNER
168 ;; 4 ^ 14.02I ^ SEX RELATIONS W/FEMALE PARTNER
169 ;; 5 ^ 14.03I ^ IV DRUGS AFTER 77 AND PRE HIV
170 ;; 6 ^ 14.04I ^ REC'D CLOTTING FACTORS
171 ;; 7 ^ 14.05I ^ TYPE OF HEMOPHILIA
172 ;; 8 ^ 14.06I ^ OTHER HEMOPHILIA DESCRIPTION
173 ;; 9 ^ 14.07I ^ SR WITH IV DRUG USER
174 ;; 10 ^ 14.08I ^ SR WITH BISEXUAL MAN
175 ;; 11 ^ 14.09I ^ SR W HEMOPHILIA/COAG DISORDER
176 ;; 12 ^ 14.1I ^ SR W TRANS RECIPIENT WITH AIDS
177 ;; 13 ^ 14.11I ^ TRANSPLANT RECIP-DOCUMNTD HIV
178 ;; 14 ^ 14.12I ^ SR W AIDS/HIV INFECTION
179 ;; 15 ^ 14.13I ^ TRANS AFTER 77 AND BEFORE HIV
180 ;; 16 ^ 14.14ID ^ DATE OF FIRST TRANSFUSION
181 ;; 17 ^ 14.15ID ^ DATE OF LAST TRANSFUSION
182 ;; 18 ^ 14.16I ^ TRANSPLANT OR ARTIF INSEMIN
183 ;; 19 ^ 14.17I ^ WORK IN HEALTH CARE OR LAB
184 ;; 20 ^ 14.18I ^ OCCUPATION
185LD1 ;
186 ;; 3 ^ 16.01I ^ HIV-1 EIA
187 ;; 4 ^ 16.02ID ^ HIV-1 EIA DATE
188 ;; 5 ^ 16.03I ^ HIV-1/HIV-2 EIA
189 ;; 6 ^ 16.04ID ^ HIV-1/HIV-2 EIA DATE
190 ;; 7 ^ 16.05I ^ HIV-1 WESTERN BLOT/IFA
191 ;; 8 ^ 16.06ID ^ HIV-1 WESTERN BLOT/IFA DATE
192 ;; 9 ^ 16.07I ^ OTHER HIV ANTIBODY TEST
193 ;; 10 ^ 16.08ID ^ OTHER HIV ANTIBODY TEST DATE
194 ;; 11 ^ 16.09I ^ OTHER HIV ANTIBODY TEST DESC
195 ;; 12 ^ 18.13I ^ POSITIVE HIV DETECTION TEST
196 ;; ^ 18.01I ^ HIV CULTURE DETECTION TEST
197 ;; ^ 18.02I ^ HIV ANTIGEN DETECTION TEST
198 ;; ^ 18.03I ^ HIV PCR, DNA, OR RNA PROBE
199 ;; 14 ^ 18.04I ^ TYPE OF OTHER POSITIVE TEST
200 ;; 15 ^ 18.05ID ^ DATE OTHER POS DETECTION TEST
201 ;; 16 ^ 18.1I ^ DETECTABLE VIRAL LOAD TEST
202 ;; 17 ^ 18.11I ^ DETECTABLE VIRAL LOAD RESULT
203 ;; 18 ^ 18.12ID ^ DETECTABLE VIRAL LOAD DATE
204LD2 ;
205 ;; 3 ^ 18.07I ^ TYPE FOR LAST NEG TEST
206 ;; 4 ^ 18.06ID ^ LAST DOCUMNTD NEG HIV TEST
207 ;; 5 ^ 18.08I ^ PHYS DOCUMNTD DIAGNOSIS?
208 ;; 6 ^ 18.09ID ^ DATE PHYS DOCUMNTD DIAG
209 ;; 7 ^ 20.01I ^ CD4+ COUNT FOR CDC
210 ;; 8 ^ 20.02ID ^ CD4+ COUNT FOR CDC DATE
211 ;; 9 ^ 20.03I ^ CD4+ PERCENT FOR CDC
212 ;; 10 ^ 20.04ID ^ CD4+ PERCENT FOR CDC DATE
213 ;; 11 ^ 20.05I ^ CD4 COUNT FIRST <200
214 ;; 12 ^ 20.06ID ^ CD4 COUNT FIRST <200 DATE
215 ;; 13 ^ 20.07I ^ CD4 PERCENT FIRST <14%
216 ;; 14 ^ 20.08ID ^ CD4 PERCENT FIRST <14% DATE
217CS ;
218 ;; 3 ^ 11.01I ^ RECORD REVIEWED
219 ;; 4 ^ 11.02ID ^ DATE ASYMPTOMATIC
220 ;; 5 ^ 11.03ID ^ DATE SYMPTOMATIC
221 ;; 6 ^ 11.05I ^ RVCT CASE NO.
222 ;; 7 ^ 11.04I ^ IMMUNODEF THAT DISQUALIFIES
223TS1 ;
224 ;; 3 ^ 22.01I ^ PATIENT BEEN INFORMED OF HIV
225 ;; 4 ^ 22.02I ^ PARTNERS NOTIFIED BY
226 ;; 5 ^ 22.03I ^ HIV RELATED MED SERVICES
227 ;; 6 ^ 22.09I ^ SUBSTANCE ABUSE TREATMENT
228 ;; 7 ^ 22.04I ^ RCVD ANTI-RETROVIRAL THERAPY
229 ;; 8 ^ 22.05I ^ RECEIVED PCP PROPHYLAXIS
230 ;; 9 ^ 22.06I ^ ENROLLED AT CLINCAL TRIAL
231 ;; 10 ^ 22.07I ^ ENROLLED AT CLINIC
232 ;; 11 ^ 22.08I ^ PRIMARY REIMBURSER FOR MED RX
233TS2 ;
234 ;; 3 ^ 23.01I ^ GYNECOLOGY OR OBSTETRIC CARE
235 ;; 4 ^ 23.02I ^ CURRENTLY PREGNANT
236 ;; 5 ^ 23.03I ^ DELIVERED LIVE BORN INFANT
237 ;; 6 ^ 23.04I ^ CHILD'S DATE OF BIRTH
238 ;; 7 ^ 23.05I ^ CHILD'S HOSPITAL OF BIRTH
239 ;; 8 ^ 23.06I ^ CHILD'S HOSPITAL - CITY
240 ;; 9 ^ 23.07I ^ CHILD'S HOSPITAL - STATE
Note: See TracBrowser for help on using the repository browser.