source: FOIAVistA/trunk/r/SPINAL_CORD_DYSFUNCTION-SPN/SPNLCNV0.m@ 1452

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

initial load of FOIAVistA 6/30/08 version

File size: 4.7 KB
Line 
1SPNLCNV0 ;HISC/DAD-CONVERSION ;11/7/95 12:35
2 ;;2.0;Spinal Cord Dysfunction;;01/02/1997
3 ;
4 I $O(^SPNL(154,0))'>0 Q
5 W !!,"This routine will convert the following fields in the SCD (SPINAL CORD)"
6 W !,"REGISTRY file (#154):",!
7 W !?3,"Old Fields (V1.0) New Fields (V1.5)"
8 W !?3,"================= ================="
9 W !?3,"REGISTRATION STATUS (154,.03) REGISTRATION STATUS (154,.03)"
10 W !?3,"COMPLETENESS OF NLOI (154,2.2) COMPLETE / INCOMPLETE (154,6.09)"
11 W !?3,"SOURCE OF NLOI (154,2.3) INFORMATION SOURCE FOR SCD (154,2.3)"
12 W !?3,"DATE OF ONSET (154,3.2) DATE OF ONSET (154.004,.01)"
13 W !?3,"ETIOLOGY (154,3.3) ETIOLOGY (154.004,.02)",!
14 W !,"The DATE OF ONSET and ETIOLOGY fields will be converted to a multiple. The"
15 W !,"codes for REGISTRATION STATUS and SOURCE OF NLOI have been changed, the old"
16 W !,"values will be converted. The COMPLETENESS OF NLOI data will be moved to its"
17 W !,"new location. This conversion may be run multiple times without adversely"
18 W !,"affecting the database. When the conversion finishes you will receive a"
19 W !,"MailMan message listing any problems found during the conversion process."
20 ;
21 K DIR S DIR(0)="SOM^R:Run now;Q:Queue later;"
22 S DIR("A")="When do you want to do the conversion"
23 S DIR("?",1)=" Enter 'R' to run the conversion now"
24 S DIR("?",2)=" Enter 'Q' to queue the conversion"
25 S DIR("?")="Choose 'R' or 'Q'"
26 D ^DIR W ! S SPN=Y I $D(DIRUT) G EXIT
27 I SPN="Q" D G EXIT
28 . S ZTRTN="TASK^SPNLCNV0",ZTDESC="SCD Registry conversion",ZTIO=""
29 . D ^%ZTLOAD
30 . I $G(ZTSK) W !,"Task queued, task number: ",ZTSK
31 . E W !,"Task NOT queued"
32 . Q
33TASK ;
34 I '$D(ZTQUEUED) W !,"Working..."
35 D EXIT S SPNERR=0
36 D ^SPNLCNV1
37 ;
38 S SPND0=0
39 F S SPND0=$O(^SPNL(154,SPND0)) Q:SPND0'>0 D
40 . I '$D(ZTQUEUED) W "."
41 . F SPN=0:1:3 S SPNDATA(SPN)=$G(^SPNL(154,SPND0,SPN))
42 . S SPNDFN=+$P(SPNDATA(0),U),SPNDFN(0)=$P($G(^DPT(SPNDFN,0)),U)
43 . I SPNDFN(0)="" Q
44 . S SPNLCOMP=$P(SPNDATA(2),U,2)
45 . S SPNREGST("OLD")=$P(SPNDATA(0),U,3),SPNNLOI("OLD")=$P(SPNDATA(2),U,3)
46 . S SPNDATE=$P(SPNDATA(3),U,2),SPNETIOL("OLD")=+$P(SPNDATA(3),U,3)
47 . S (SPNREGST("NEW"),SPNNLOI("NEW"))=""
48 . I SPNREGST("OLD")]"" S SPNREGST("NEW")=$G(^TMP($J,"SPN REGSTAT",SPNREGST("OLD")))
49 . I SPNNLOI("OLD")]"" S SPNNLOI("NEW")=$G(^TMP($J,"SPN NLOI",SPNNLOI("OLD")))
50 . I SPNREGST("OLD")]"",SPNREGST("NEW")="" D
51 .. S X="Cannot convert REGISTRATION STATUS '"_SPNREGST("OLD")
52 .. S X=X_"' for "_SPNDFN(0)_", SCD Registry record #"_SPND0
53 .. D ERR(X)
54 .. Q
55 . I SPNNLOI("OLD")]"",SPNNLOI("NEW")="" D
56 .. S X="Cannot convert SOURCE OF NLOI '"_SPNNLOI("OLD")
57 .. S X=X_"' for "_SPNDFN(0)_", SCD Registry record #"_SPND0
58 .. D ERR(X)
59 .. Q
60 . I SPNDATE'?7N D Q ; *** Bad date of onset
61 .. I SPNREGST("OLD")?1N Q
62 .. I SPNDATE="" S SPNDATE="<NULL>"
63 .. S X="Cannot convert DATE OF ONSET '"_SPNDATE
64 .. S X=X_"' for "_SPNDFN(0)_", SCD Registry record #"_SPND0
65 .. D ERR(X)
66 .. Q
67 . D CONV1
68 . I $O(^TMP($J,"SPN ETIOLOGY",""))="" Q ; *** No etiology conv table
69 . S SPNETIOL("NEW")=+$G(^TMP($J,"SPN ETIOLOGY",SPNETIOL("OLD")))
70 . I SPNETIOL("OLD")>0,SPNETIOL("NEW")'>0 D Q ; *** Bad etiology
71 .. S SPNETIOL=$P($G(^SPNL(154.02,SPNETIOL("OLD"),0)),U)
72 .. I SPNETIOL="" S SPNETIOL=SPNETIOL("OLD")
73 .. S X="Cannot convert ETIOLOGY '"_SPNETIOL
74 .. S X=X_"' for "_SPNDFN(0)_", SCD Registry record #"_SPND0
75 .. D ERR(X)
76 .. Q
77 . D CONV2
78 . Q
79MAIL ;
80 N DIFROM D KILL^XM
81 I SPNERR=0 D
82 . S ^TMP($J,"SPN ERROR",1)="Conversion finished, no problems found"
83 . Q
84 S XMY(DUZ)="",(XMDUN,XMDUZ)="<Spinal Cord Dysfunction Package>"
85 S XMTEXT="^TMP($J,""SPN ERROR"","
86 S XMSUB="SCD Registry Conversion"
87 D ^XMD
88EXIT ;
89 D KILL^XM
90 F SPN="ERROR","ETIOLOGY","NLOI","REGSTAT" K ^TMP($J,"SPN "_SPN)
91 K DA,DD,DIC,DIE,DINUM,DIR,DIRUT,DLAYGO,DO,DR,DTOUT,DUOUT,OFFSET,SPN
92 K SPND0,SPNDATA,SPNDATE,SPNDFN,SPNERR,SPNETIOL,SPNEXIT,SPNLCOMP
93 K SPNLINE,SPNNEW,SPNNEWD0,SPNNLOI,SPNOLD,SPNREGST,SPNTYPE,X,Y
94 K ZTDESC,ZTIO,ZTRTN,ZTSK
95 I $D(ZTQUEUED) S ZTREQ="@"
96 Q
97 ;
98CONV1 ; *** Registration Status and Source of NLOI
99 K DA,DIE,DR
100 I (SPNREGST("NEW")]"")&(SPNREGST("NEW")'=SPNREGST("OLD")) D
101 . S DR=".03///^S X="_SPNREGST("NEW")
102 . Q
103 I (SPNNLOI("NEW")]"")&(SPNNLOI("NEW")'=SPNNLOI("OLD")) D
104 . S DR=$S($G(DR)]"":DR_";",1:"")_"2.3///^S X="_SPNNLOI("NEW")
105 . Q
106 I SPNLCOMP]"" D
107 . S DR=$S($G(DR)]"":DR_";",1:"")_"6.09///^S X="""_SPNLCOMP_""""
108 . Q
109 I $G(DR)]"" S DIE="^SPNL(154,",DA=SPND0 D ^DIE
110 Q
111 ;
112CONV2 ; *** Etiology
113 I $O(^SPNL(154,SPND0,"E","B",SPNDATE,0))'>0 D
114 . K DA,DD,DIC,DINUM,DO
115 . S DIC="^SPNL(154,"_SPND0_",""E"",",DIC(0)="L"
116 . S DIC("P")=$P(^DD(154,4,0),U,2),DLAYGO=+DIC("P")
117 . S (D0,DA(1))=SPND0,X=SPNDATE
118 . I SPNETIOL("NEW") S DIC("DR")=".02///`"_SPNETIOL("NEW")
119 . D FILE^DICN
120 . Q
121 Q
122ERR(X) ;
123 S SPNERR=SPNERR+1
124 S ^TMP($J,"SPN ERROR",SPNERR)=X
125 Q
Note: See TracBrowser for help on using the repository browser.