Changeset 1569 for smart/trunk/p/C0STBL.m
- Timestamp:
- Oct 11, 2012, 1:42:56 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
smart/trunk/p/C0STBL.m
r1540 r1569 1 C0STBL ; GPL - Smart Container CREATE A TABLE OF NHINV VALUES;2/22/12 17:05 2 ;;1.0;VISTA SMART CONTAINER;;Sep 26, 2012;Build 2 3 ;Copyright 2012 George Lilly. Licensed under the terms of the GNU 4 ;General Public License See attached copy of the License. 5 ; 6 ;This program is free software; you can redistribute it and/or modify 7 ;it under the terms of the GNU General Public License as published by 8 ;the Free Software Foundation; either version 2 of the License, or 9 ;(at your option) any later version. 10 ; 11 ;This program is distributed in the hope that it will be useful, 12 ;but WITHOUT ANY WARRANTY; without even the implied warranty of 13 ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 ;GNU General Public License for more details. 15 ; 16 ;You should have received a copy of the GNU General Public License along 17 ;with this program; if not, write to the Free Software Foundation, Inc., 18 ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 ; 20 Q 21 EN(BEGDFN,DFNCNT,ZPART) ; START IS A DFN 22 I '$D(BEGDFN) S BDGDFN="" 23 I '$D(DFNCNT) S DFNCNT=150 24 I '$D(ZPART) S ZPART="" 25 N ZTBL S ZTBL=$NA(^TMP("C0STBL")) 26 N ZI,ZCNT,ZG 27 S ZI=BEGDFN 28 S ZCNT=0 29 F S ZI=$O(^DPT(ZI)) Q:(+ZI=0)!(ZCNT>DFNCNT) D ; 30 . S ZCNT=ZCNT+1 31 . W ZI," " 32 . K ZG 33 . D EN^C0SNHIN(.ZG,ZI,ZPART) 34 . M @ZTBL@(ZI)=ZG 35 . K G 36 . ;D EN^C0SMART(.G,ZI,"med") 37 . ;I $D(G) W !,$$output^C0XGET1("G") 38 . ;k G 39 . ;D EN^C0SMART(.G,ZI,"patient") 40 . ;I $D(G) W !,$$output^C0XGET1("G") 41 . ;K G 42 . ;D EN^C0SMART(.G,ZI,"lab") 43 . ;I $D(G) W !,$$output^C0XGET1("G") 44 . ;K G 45 . D EN^C0SMART(.G,ZI,"problem") 46 . ;I $D(G) W !,$$output^C0XGET1("G") 47 Q 48 ; 49 LOADHACK ; 50 N ZI 51 F ZI=2:1:374 D ; 52 . D IMPORT^C0XF2N("hack"_ZI_".xml","/home/vista/hack/") 53 Q 54 ; 1 C0STBL ; GPL - Smart Container CREATE A TABLE OF NHINV VALUES;2/22/12 17:05 2 ;;0.1;C0S;nopatch;noreleasedate;Build 2 3 ;Copyright 2012 George Lilly. Licensed under the terms of the GNU 4 ;General Public License See attached copy of the License. 5 ; 6 ;This program is free software; you can redistribute it and/or modify 7 ;it under the terms of the GNU General Public License as published by 8 ;the Free Software Foundation; either version 2 of the License, or 9 ;(at your option) any later version. 10 ; 11 ;This program is distributed in the hope that it will be useful, 12 ;but WITHOUT ANY WARRANTY; without even the implied warranty of 13 ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 ;GNU General Public License for more details. 15 ; 16 ;You should have received a copy of the GNU General Public License along 17 ;with this program; if not, write to the Free Software Foundation, Inc., 18 ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 ; 20 Q 21 EN(BEGDFN,DFNCNT,ZPART) ; START IS A DFN 22 I '$D(BEGDFN) S BDGDFN="" 23 I '$D(DFNCNT) S DFNCNT=150 24 I '$D(ZPART) S ZPART="" 25 N ZTBL S ZTBL=$NA(^TMP("C0STBL")) 26 N ZI,ZCNT,ZG 27 S ZI=$O(^DPT(BEGDFN),-1) 28 S ZCNT=1 29 F S ZI=$O(^DPT(ZI)) Q:((+ZI=0)!(ZCNT>DFNCNT)) D ; 30 . S ZCNT=ZCNT+1 31 . W ZI," " 32 . K ZG 33 . D EN^C0SNHIN(.ZG,ZI,ZPART) 34 . M @ZTBL@(ZI)=ZG 35 . K G 36 . N GDIR S GDIR="/home/vista/p/" 37 . D EN^C0SMART(.G,ZI,"med") 38 . I $D(G) W !,$$output^C0XGET1("G",ZI_"-med.rdf",GDIR) 39 . k G 40 . D EN^C0SMART(.G,ZI,"patient") 41 . I $D(G) W !,$$output^C0XGET1("G",ZI_"-patient.rdf",GDIR) 42 . K G 43 . D EN^C0SMART(.G,ZI,"lab") 44 . I $D(G) W !,$$output^C0XGET1("G",ZI_"-lab.rdf",GDIR) 45 . K G 46 . D EN^C0SMART(.G,ZI,"problem") 47 . I $D(G) W !,$$output^C0XGET1("G",ZI_"-problem.rdf",GDIR) 48 Q 49 ; 50 LOADHACK ; 51 N ZI 52 F ZI=2:1:374 D ; 53 . D IMPORT^C0XF2N("hack"_ZI_".xml","/home/vista/hack/") 54 Q 55 ; 56 LABCNT ; COUNT LAB TESTS AND LOINC CODES 57 K LABCNT,GLOINC,PATCNT 58 S (LABCNT,GLOINC,PATCNT)=0 59 N ZI S ZI="" 60 N GN S GN=$NA(^TMP("C0STBL")) 61 F S ZI=$O(@GN@(ZI)) Q:ZI="" D ; 62 . S PATCNT=PATCNT+1 63 . I '$D(@GN@(ZI,"lab")) Q ; 64 . N ZJ S ZJ="" 65 . F S ZJ=$O(@GN@(ZI,"lab",ZJ)) Q:ZJ="" D ; 66 . . S LABCNT=LABCNT+1 67 . . S X=$G(@GN@(ZI,"lab",ZJ,"loinc@value")) 68 . . I X'="" S GLOINC=GLOINC+1 69 W !,"Total number of patients: ",PATCNT 70 W !,"Total number of lab results: ",LABCNT 71 W !,"Total number of lab results with loinc codes: ",GLOINC 72 W !,"Percentage of lab tests with loinc codes: ",$P((GLOINC/LABCNT)*100,".")_"%" 73 Q 74 ; 75 PROBCNT ; COUNT PROBLEMS AND SNOMED CODES 76 K PROBCNT,GSNO,PATCNT 77 S (PROBCNT,GSNO,PATCNT)=0 78 N ZI S ZI="" 79 N GN S GN=$NA(^TMP("C0STBL")) 80 F S ZI=$O(@GN@(ZI)) Q:ZI="" D ; 81 . S PATCNT=PATCNT+1 82 . I '$D(@GN@(ZI,"problem")) Q ; 83 . N ZJ S ZJ="" 84 . F S ZJ=$O(@GN@(ZI,"problem",ZJ)) Q:ZJ="" D ; 85 . . S PROBCNT=PROBCNT+1 86 . . S X=$G(@GN@(ZI,"problem",ZJ,"icd@value")) 87 . . S Y=$$SNOMED^C0SPROB2(X) 88 . . I Y'="" S GSNO=GSNO+1 89 W !,"Total number of patients: ",PATCNT 90 W !,"Total number of problems: ",PROBCNT 91 W !,"Total number of problems with snomed codes: ",GSNO 92 W !,"Percentage of problems with SNOMED codes: ",$P((GSNO/PROBCNT)*100,".")_"%" 93 Q 94 ; 95 MEDCNT ; COUNT INPATIENT VS OUTPATIENT MEDICATIONS 96 K MEDCNT,OMED,PATCNT,DOSE,UNITS,FORM,SCHED,ROUTE 97 S (MEDCNT,OMED,GSNO,PATCNT)=0 98 N ZI S ZI="" 99 N GN S GN=$NA(^TMP("C0STBL")) 100 F S ZI=$O(@GN@(ZI)) Q:ZI="" D ; 101 . S PATCNT=PATCNT+1 102 . I '$D(@GN@(ZI,"med")) Q ; 103 . N ZJ S ZJ="" 104 . F S ZJ=$O(@GN@(ZI,"med",ZJ)) Q:ZJ="" D ; 105 . . S MEDCNT=MEDCNT+1 106 . . I $G(@GN@(ZI,"med",ZJ,"vaStatus@value"))="EXPIRED" D Q ; 107 . . . I $D(DEBUG) W !,"Expired Mediation, Skipping" 108 . . I $G(@GN@(ZI,"med",ZJ,"vaType@value"))="I" D Q ; 109 . . . I $D(DEBUG) W !,"Inpatient Med, skipping" 110 . . I $G(@GN@(ZI,"med",ZI,"vaType@value"))="V" D Q ; 111 . . . I $D(DEBUG) W !,"IV Inpatient Med, skipping" 112 . . S OMED=OMED+1 113 . . S X=$G(@GN@(ZI,"med",ZJ,"form@value")) 114 . . S FORM(X)=$G(FORM(X))+1 115 . . S X=$G(@GN@(ZI,"med",ZJ,"doses.dose@dose")) 116 . . I X="" S X="UNKNOWN" 117 . . S DOSE(X)=$G(DOSE(X))+1 118 . . S X=$G(@GN@(ZI,"med",ZJ,"doses.dose@units")) 119 . . I X="" S X="UNKNOWN" 120 . . S UNITS(X)=$G(UNITS(X))+1 121 . . S X=$G(@GN@(ZI,"med",ZJ,"doses.dose@schedule")) 122 . . I X="" S X="UNKNOWN" 123 . . S SCHED(X)=$G(SCHED(X))+1 124 . . S X=$G(@GN@(ZI,"med",ZJ,"doses.dosc@route")) 125 . . I X="" S X="UNKNOWN" 126 . . S ROUTE(X)=$G(ROUTE(X))+1 127 W !,"Total number of patients: ",PATCNT 128 W !,"Total number of medications: ",MEDCNT 129 W !,"Total number of outpatient medications: ",OMED 130 W !,"Percentage of outpatient medications: ",$P((OMED/MEDCNT)*100,".")_"%",! 131 ZWR FORM 132 ZWR DOSE 133 ZWR UNITS 134 ZWR SCHED 135 ZWR ROUTE 136 Q 137 ;
Note:
See TracChangeset
for help on using the changeset viewer.