source: FOIAVistA/trunk/r/SPINAL_CORD_DYSFUNCTION-SPN/SPNPM2.m@ 1582

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

initial load of FOIAVistA 6/30/08 version

File size: 5.9 KB
Line 
1SPNPM2 ;SD/AB-PROGRAM MEASURE #2 ;5/26/98
2 ;;2.0;Spinal Cord Dysfunction;**6**;01/02/1997
3MAIN ;-- This program will 1st collect all SCD-R Pts into the ^TMP($J,"SPNPM2","ALL_SCD") global then it will collect into 4 seperate ^TMP($J,"SPNPM2") as follows:
4 ;-- TOT_ADM = All SCD-R Pts /w FY 97 admissions
5 ;-- TOT_DIS = All SCD-R Pts /w FY 97 disharges
6 ;-- TOT_ONSET = All SCD-R Pts /w Date of Onset between 4/1/96 and 9/30/97
7 ;-- TOT_ICD = All SCD-R Pts /w any SCI ICD-9 codes in any PTF record
8 ;-- TOT_PTF = All SCD-R Pts /w PTF records meeting PM #2 Denominator criteria
9 ;-- This program also calls ^SPNPM2B which calls ^SPNPMDX which collects all SCI ICD9 codes into the ^TMP($J,"SPNPMDX","SPNICD",ICD_IEN) global
10 ;
11 ;-- SPN Variable Array List:
12 ;-- ADM_DT = admission date
13 ;-- BEG_DT = beginning date (for loop)
14 ;-- BEG_DT1 = variable/changing beginning date
15 ;-- DC_DT = discharge date
16 ;-- DFN = DFN
17 ;-- END# = ending number (ICD9)
18 ;-- END_DT = ending date (for loop)
19 ;-- E_NODE = "E" node of file 154 global
20 ;-- FIM_DT = FIM date
21 ;-- FIM_IEN = FIM IEN (in file 154.1)
22 ;-- FY = fiscal year
23 ;-- I = FOR loop variable
24 ;-- ICDPT = pointer from PTF file to ICD9 Dx file
25 ;-- ICD_FLG = ICD9 flag (set to 1 if SCI Dx found)
26 ;-- ICD_IEN = IEN in ICD9 Dx file (#80)
27 ;-- ONSET_DT = beginning SCD onset date (for loop)
28 ;-- ONS_DT = actual SCD onset date found from file 154 record
29 ;-- ONS_FLG = SCD onset date flag (set to 1 if date is between 4/1/96 and 9/30/97)
30 ;-- PIECE = piece in 70 node of PTF file global (ICD9 pointer)
31 ;-- PTF_ADMDT = PTF record admission date
32 ;-- PTF_DCDT = PTF record discharge date
33 ;-- PTF_FLG = PTF flag (set to 1 if PTF record is correct type, is transmitted, has at least one SCI ICD9 code, and admission date on or after Onset Date)
34 ;-- PTF_IEN = IEN in PTF file
35 ;-- ST# = starting number for ICD9 code FOR loop
36 ;-- TOT_ADM = total # SCD Pts with FY admissions
37 ;-- TOT_CNT = total count (used to count total of all SCD Pts)
38 ;-- TOT_DENOM1 = denominator total based on FY admissions
39 ;-- TOT_DENOM2 = denominator total based on discharges
40 ;-- TOT_DIS = total # of SCD-R Pts /w FY discharges
41 ;-- TOT_FIM = total # of FIMS found (1-2)
42 ;-- TOT_ICD = total # of SCD-R Pts /w any SCI ICD9 codes in any PTF record
43 ;-- TOT_NUM = Numerator total for PM #2
44 ;-- TOT_ONSET = total # of SCD-R Pts /w SCD Onset Date between 4/1/96 and 9/30/97
45 ;-- TOT_PTF = Denominator total for PM #2
46 ;-- TOT_SCORE = FIM total score (from file 154.1)
47 ;
48 K:$D(^TMP($J)) ^($J)
49 ;-- Get previous FY information, BEG_DT and END_DT
50 D GETYR
51 D GETALL
52 D GETADM
53 D GETDIS
54 D GETONS
55 ;-- Get PTF and ICD info
56 D ^SPNPM2B
57 ;-- Now get Denominator totals
58 D ^SPNPM2D
59 ;-- Get Numerator
60 D ^SPNPM2N
61 ;-- Print Results
62 D ^SPNPM2C
63EXIT K SPN
64 K:$D(^TMP($J)) ^($J)
65 Q
66GETYR ;-- Get FY for previous FY, and set Ending Date (END_DT) to FM FY_0930
67 I +$E($G(DT),4,7)<931 S SPN("FY")=$E($G(DT),1,3)-1
68 E S SPN("FY")=$E($G(DT),1,3)
69 S SPN("END_DT")=+SPN("FY")_"0930"
70 S SPN("BEG_DT")=+(SPN("FY")-1)_"1001"
71 S SPN("ONSET_DT")=+(SPN("FY")-1)_"0401"
72 Q
73GETALL ;-- Get all SCD-R patients and store into ^TMP($J,"SPNPM2","ALL_SCD",DFN) global
74 S SPN("DFN")=0
75 F S SPN("DFN")=$O(^SPNL(154,SPN("DFN"))) Q:'+SPN("DFN") D
76 .;-- Quit if no Zero Node
77 .Q:'$D(^SPNL(154,SPN("DFN"),0))
78 .;-- Set ^TMP($J,"SPNPM2","ALL_SCD",DFN)
79 .S ^TMP($J,"SPNPM2","ALL_SCD",SPN("DFN"))=""
80 .Q
81 Q
82GETADM ;-- Get all SCD pts who have had admissions in FY 97
83 ;-- Loop thru date range (BEG_DT thru END_DT) in Pt Movement file (^DGPM)
84 ;-- Store into ^TMP($J,"SPNPM2","TOT_ADM",DFN) global
85 ;-- Initialize DFN variable
86 S SPN("DFN")=0,SPN("END_DT")=SPN("END_DT")+.999
87 F S SPN("DFN")=$O(^DGPM("APTT1",SPN("DFN"))) Q:'+SPN("DFN") D
88 .S SPN("BEG_DT1")=SPN("BEG_DT")-.001
89 .F S SPN("BEG_DT1")=$O(^DGPM("APTT1",SPN("DFN"),SPN("BEG_DT1"))) Q:'+SPN("BEG_DT1")!(SPN("BEG_DT1")>SPN("END_DT")) D
90 ..;-- Get PTF pointer# from PM_IEN
91 ..;S SPN("PM_IEN")=$O(^DGPM("APTT1",SPN("DFN"),SPN("BEG_DT1"),0))
92 ..;S SPN("PTF_IEN")=$P($G(^DGPM(SPN("PM_IEN"),0)),U,16)
93 ..;-- Check to see if Pt in SCD-R, if so then set ^TMP($J,"SPNPM2","TOT_ADM",DFN) global
94 ..I +$D(^SPNL(154,SPN("DFN"),0)) S ^TMP($J,"SPNPM2","TOT_ADM",SPN("DFN"))=""
95 ..Q
96 .Q
97 Q
98GETDIS ;-- Get all SCD pts who have had discharges in FY 97
99 ;-- Loop thru date range (BEG_DT thru END_DT) in Pt Movement file (^DGPM)
100 ;-- Store into ^TMP($J,"SPNPM2","TOT_DIS",DFN) global
101 ;-- Initialize DFN variable
102 S SPN("DFN")=0
103 F S SPN("DFN")=$O(^DGPM("APTT3",SPN("DFN"))) Q:'+SPN("DFN") D
104 .S SPN("BEG_DT1")=SPN("BEG_DT")-.001
105 .F S SPN("BEG_DT1")=$O(^DGPM("APTT3",SPN("DFN"),SPN("BEG_DT1"))) Q:'+SPN("BEG_DT1")!(SPN("BEG_DT1")>SPN("END_DT")) D
106 ..;-- Get PTF pointer# from PM_IEN
107 ..;S SPN("PM_IEN")=$O(^DGPM("APTT3",SPN("DFN"),SPN("BEG_DT1"),0))
108 ..;S SPN("PTF_IEN")=$P($G(^DGPM(SPN("PM_IEN"),0)),U,16)
109 ..;-- Check to see if Pt in SCD-R, if so then set ^TMP($J,"SPNPM2","TOT_DIS",DFN) global
110 ..I +$D(^SPNL(154,SPN("DFN"),0)) S ^TMP($J,"SPNPM2","TOT_DIS",SPN("DFN"))=""
111 ..Q
112 .Q
113 Q
114GETONS ;-- Get all SCD pts who have an ETIOLOGY /w a DATE OF ONSET between 4/1/96 and 9/30/97
115 ;-- Store into ^TMP($J,"SPNPM2","TOT_ONSET",DFN) global
116 ;-- Quit if '$D(^TMP($J,"SPNPM2","ALL_SCD"))
117 Q:'$D(^TMP($J,"SPNPM2","ALL_SCD"))
118 ;-- Inititalze SPN("DFN")
119 S SPN("DFN")=0
120 F S SPN("DFN")=$O(^TMP($J,"SPNPM2","ALL_SCD",SPN("DFN"))) Q:'+SPN("DFN") D
121 .;-- Initialize Onset flag (ONS_FLG) - this flag=1 if DATE OF ONSET is between 4/1/96 and 9/30/97
122 .S SPN("ONS_FLG")=0
123 .I +$D(^SPNL(154,SPN("DFN"),"E",0)) D
124 ..S SPN("E_NODE")=0
125 ..F S SPN("E_NODE")=$O(^SPNL(154,SPN("DFN"),"E",SPN("E_NODE"))) Q:'+SPN("E_NODE")!(SPN("ONS_FLG")=1) D
126 ...S SPN("ONS_DT")=$P($G(^SPNL(154,SPN("DFN"),"E",SPN("E_NODE"),0)),U,2)
127 ...;-- If ONS_DT>0 and then ONST_DT is between 4/1/96 and 9/30/97, then set ONS_FLG and store into ^TMP($J,"SPNPM2","TOT_ONSET",DFN)
128 ...I SPN("ONS_DT")>0,SPN("ONS_DT")>2960331&(SPN("ONS_DT")<2971001) S ^TMP($J,"SPNPM2","TOT_ONSET",SPN("DFN"))=SPN("ONS_DT") S SPN("ONS_FLG")=1
129 ...Q
130 ..Q
131 .Q
132 Q
Note: See TracBrowser for help on using the repository browser.