diff --git a/p/C0SDEM.m b/p/C0SDEM.m index 3c2a14a..64384c1 100644 --- a/p/C0SDEM.m +++ b/p/C0SDEM.m @@ -1,21 +1,19 @@ -C0SDEM ; GPL - Smart Demographics Processing ;2/22/12 17:05 - ;;1.0;VISTA SMART CONTAINER;;Sep 26, 2012;Build 4 - ;Copyright 2012 George Lilly. Licensed under the terms of the GNU - ;General Public License See attached copy of the License. +C0SDEM ; GPL - Smart Demographics Processing ; 10/30/12 10:59am + ;;1.0;VISTA SMART CONTAINER;;Sep 26, 2012;Build 5 + ;Copyright 2012 George Lilly. ; - ;This program is free software; you can redistribute it and/or modify - ;it under the terms of the GNU General Public License as published by - ;the Free Software Foundation; either version 2 of the License, or - ;(at your option) any later version. + ; This program is free software: you can redistribute it and/or modify + ; it under the terms of the GNU Affero General Public License as + ; published by the Free Software Foundation, either version 3 of the + ; License, or (at your option) any later version. ; - ;This program is distributed in the hope that it will be useful, - ;but WITHOUT ANY WARRANTY; without even the implied warranty of - ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ;GNU General Public License for more details. + ; This program is distributed in the hope that it will be useful, + ; but WITHOUT ANY WARRANTY; without even the implied warranty of + ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ; GNU Affero General Public License for more details. ; - ;You should have received a copy of the GNU General Public License along - ;with this program; if not, write to the Free Software Foundation, Inc., - ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + ; You should have received a copy of the GNU Affero General Public License + ; along with this program. If not, see . ; Q ; diff --git a/p/C0SDOM.m b/p/C0SDOM.m index d2d3817..bf58c32 100644 --- a/p/C0SDOM.m +++ b/p/C0SDOM.m @@ -1,22 +1,19 @@ C0SDOM ; GPL - Smart Container - DOM PROCESSING ROUTINES ;6/6/11 17:05 - ;;1.0;VISTA SMART CONTAINER;;Sep 26, 2012;Build 4 - ;Copyright 2011,2012 George Lilly. Licensed under the terms of the GNU - ;General Public License See attached copy of the License. + ;;1.0;VISTA SMART CONTAINER;;Sep 26, 2012;Build 5 + ;Copyright 2011,2012 George Lilly. ; - ;This program is free software; you can redistribute it and/or modify - ;it under the terms of the GNU General Public License as published by - ;the Free Software Foundation; either version 2 of the License, or - ;(at your option) any later version. + ; This program is free software: you can redistribute it and/or modify + ; it under the terms of the GNU Affero General Public License as + ; published by the Free Software Foundation, either version 3 of the + ; License, or (at your option) any later version. ; - - ;This program is distributed in the hope that it will be useful, - ;but WITHOUT ANY WARRANTY; without even the implied warranty of - ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ;GNU General Public License for more details. + ; This program is distributed in the hope that it will be useful, + ; but WITHOUT ANY WARRANTY; without even the implied warranty of + ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ; GNU Affero General Public License for more details. ; - ;You should have received a copy of the GNU General Public License along - ;with this program; if not, write to the Free Software Foundation, Inc., - ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + ; You should have received a copy of the GNU Affero General Public License + ; along with this program. If not, see . ; Q ; diff --git a/p/C0SLAB.m b/p/C0SLAB.m index edb76ad..a33c517 100644 --- a/p/C0SLAB.m +++ b/p/C0SLAB.m @@ -1,21 +1,19 @@ C0SLAB ; GPL - Smart Lab Processing ;4/15/12 17:05 - ;;1.0;VISTA SMART CONTAINER;;Sep 26, 2012;Build 4 - ;Copyright 2012 George Lilly. Licensed under the terms of the GNU - ;General Public License See attached copy of the License. + ;;1.0;VISTA SMART CONTAINER;;Sep 26, 2012;Build 5 + ;Copyright 2012 George Lilly. ; - ;This program is free software; you can redistribute it and/or modify - ;it under the terms of the GNU General Public License as published by - ;the Free Software Foundation; either version 2 of the License, or - ;(at your option) any later version. + ; This program is free software: you can redistribute it and/or modify + ; it under the terms of the GNU Affero General Public License as + ; published by the Free Software Foundation, either version 3 of the + ; License, or (at your option) any later version. ; - ;This program is distributed in the hope that it will be useful, - ;but WITHOUT ANY WARRANTY; without even the implied warranty of - ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ;GNU General Public License for more details. + ; This program is distributed in the hope that it will be useful, + ; but WITHOUT ANY WARRANTY; without even the implied warranty of + ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ; GNU Affero General Public License for more details. ; - ;You should have received a copy of the GNU General Public License along - ;with this program; if not, write to the Free Software Foundation, Inc., - ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + ; You should have received a copy of the GNU Affero General Public License + ; along with this program. If not, see . ; Q ; diff --git a/p/C0SMART.m b/p/C0SMART.m index badbc87..a275783 100644 --- a/p/C0SMART.m +++ b/p/C0SMART.m @@ -1,21 +1,19 @@ C0SMART ; GPL - Smart Container Entry Points;2/22/12 17:05 - ;;1.0;VISTA SMART CONTAINER;;Sep 26, 2012;Build 4 - ;Copyright 2012 George Lilly. Licensed under the terms of the GNU - ;General Public License See attached copy of the License. + ;;1.0;VISTA SMART CONTAINER;;Sep 26, 2012;Build 5 + ;Copyright 2012 George Lilly. ; - ;This program is free software; you can redistribute it and/or modify - ;it under the terms of the GNU General Public License as published by - ;the Free Software Foundation; either version 2 of the License, or - ;(at your option) any later version. + ; This program is free software: you can redistribute it and/or modify + ; it under the terms of the GNU Affero General Public License as + ; published by the Free Software Foundation, either version 3 of the + ; License, or (at your option) any later version. ; - ;This program is distributed in the hope that it will be useful, - ;but WITHOUT ANY WARRANTY; without even the implied warranty of - ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ;GNU General Public License for more details. + ; This program is distributed in the hope that it will be useful, + ; but WITHOUT ANY WARRANTY; without even the implied warranty of + ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ; GNU Affero General Public License for more details. ; - ;You should have received a copy of the GNU General Public License along - ;with this program; if not, write to the Free Software Foundation, Inc., - ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + ; You should have received a copy of the GNU Affero General Public License + ; along with this program. If not, see . ; Q EN(ZRTN,ZPATID,ZTYP,ZFORM,DEBUG) ; return a Smart RDF file section ZTYP diff --git a/p/C0SMED.m b/p/C0SMED.m index 7c20734..872782f 100644 --- a/p/C0SMED.m +++ b/p/C0SMED.m @@ -1,21 +1,19 @@ C0SMED ; GPL - Smart Meds Processing ;2/22/12 17:05 - ;;1.0;VISTA SMART CONTAINER;;Sep 26, 2012;Build 4 - ;Copyright 2012 George Lilly. Licensed under the terms of the GNU - ;General Public License See attached copy of the License. + ;;1.0;VISTA SMART CONTAINER;;Sep 26, 2012;Build 5 + ;Copyright 2012 George Lilly. ; - ;This program is free software; you can redistribute it and/or modify - ;it under the terms of the GNU General Public License as published by - ;the Free Software Foundation; either version 2 of the License, or - ;(at your option) any later version. + ; This program is free software: you can redistribute it and/or modify + ; it under the terms of the GNU Affero General Public License as + ; published by the Free Software Foundation, either version 3 of the + ; License, or (at your option) any later version. ; - ;This program is distributed in the hope that it will be useful, - ;but WITHOUT ANY WARRANTY; without even the implied warranty of - ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ;GNU General Public License for more details. + ; This program is distributed in the hope that it will be useful, + ; but WITHOUT ANY WARRANTY; without even the implied warranty of + ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ; GNU Affero General Public License for more details. ; - ;You should have received a copy of the GNU General Public License along - ;with this program; if not, write to the Free Software Foundation, Inc., - ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + ; You should have received a copy of the GNU Affero General Public License + ; along with this program. If not, see . ; Q ; diff --git a/p/C0SMXMLB.m b/p/C0SMXMLB.m index bd89ff6..87ebfec 100644 --- a/p/C0SMXMLB.m +++ b/p/C0SMXMLB.m @@ -1,5 +1,6 @@ MXMLBLD ;;ISF/RWF - Tool to build XML ;07/09/09 16:55 - Smart Container Ver. - ;;1.0;VISTA SMART CONTAINER;;Sep 26, 2012;Build 4 + ;;1.0;VISTA SMART CONTAINER;;Sep 26, 2012;Build 5 + ; Public Domain QUIT ; ;DOC - The top level tag diff --git a/p/C0SNHIN.m b/p/C0SNHIN.m index 181f20c..e561144 100644 --- a/p/C0SNHIN.m +++ b/p/C0SNHIN.m @@ -1,21 +1,19 @@ C0SNHIN ; GPL - Smart Container - OUTPUT OF NHINV ROUTINES;6/3/11 17:05 - ;;1.0;VISTA SMART CONTAINER;;Sep 26, 2012;Build 4 - ;Copyright 2011-2012 George Lilly. Licensed under the terms of the GNU - ;General Public License See attached copy of the License. + ;;1.0;VISTA SMART CONTAINER;;Sep 26, 2012;Build 5 + ;Copyright 2011-2012 George Lilly. ; - ;This program is free software; you can redistribute it and/or modify - ;it under the terms of the GNU General Public License as published by - ;the Free Software Foundation; either version 2 of the License, or - ;(at your option) any later version. + ; This program is free software: you can redistribute it and/or modify + ; it under the terms of the GNU Affero General Public License as + ; published by the Free Software Foundation, either version 3 of the + ; License, or (at your option) any later version. ; - ;This program is distributed in the hope that it will be useful, - ;but WITHOUT ANY WARRANTY; without even the implied warranty of - ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ;GNU General Public License for more details. + ; This program is distributed in the hope that it will be useful, + ; but WITHOUT ANY WARRANTY; without even the implied warranty of + ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ; GNU Affero General Public License for more details. ; - ;You should have received a copy of the GNU General Public License along - ;with this program; if not, write to the Free Software Foundation, Inc., - ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + ; You should have received a copy of the GNU Affero General Public License + ; along with this program. If not, see . ; Q EN(ZRTN,ZDFN,ZPART,KEEP) ; GENERATE AN NHIN ARRAY FOR A PATIENT diff --git a/p/C0SNHINV.m b/p/C0SNHINV.m index dbce043..1c8e61b 100644 --- a/p/C0SNHINV.m +++ b/p/C0SNHINV.m @@ -1,5 +1,5 @@ C0SNHINV ;SLC/MKB - Serve VistA data as XML via RPC - Smart Container Version - ;;1.0;VISTA SMART CONTAINER;;Sep 26, 2012;Build 4 + ;;1.0;VISTA SMART CONTAINER;;Sep 26, 2012;Build 5 ; ; External References DBIA# ; ------------------- ----- diff --git a/p/C0SPROB.m b/p/C0SPROB.m index ad09e50..9b624a6 100644 --- a/p/C0SPROB.m +++ b/p/C0SPROB.m @@ -1,21 +1,19 @@ C0SPROB ; GPL - Smart Problem Processing ;5/01/12 17:05 - ;;1.0;VISTA SMART CONTAINER;;Sep 26, 2012;Build 4 - ;Copyright 2012 George Lilly. Licensed under the terms of the GNU - ;General Public License See attached copy of the License. + ;;1.0;VISTA SMART CONTAINER;;Sep 26, 2012;Build 5 + ;Copyright 2012 George Lilly. ; - ;This program is free software; you can redistribute it and/or modify - ;it under the terms of the GNU General Public License as published by - ;the Free Software Foundation; either version 2 of the License, or - ;(at your option) any later version. + ; This program is free software: you can redistribute it and/or modify + ; it under the terms of the GNU Affero General Public License as + ; published by the Free Software Foundation, either version 3 of the + ; License, or (at your option) any later version. ; - ;This program is distributed in the hope that it will be useful, - ;but WITHOUT ANY WARRANTY; without even the implied warranty of - ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ;GNU General Public License for more details. + ; This program is distributed in the hope that it will be useful, + ; but WITHOUT ANY WARRANTY; without even the implied warranty of + ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ; GNU Affero General Public License for more details. ; - ;You should have received a copy of the GNU General Public License along - ;with this program; if not, write to the Free Software Foundation, Inc., - ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + ; You should have received a copy of the GNU Affero General Public License + ; along with this program. If not, see . ; Q ; diff --git a/p/C0SPROB2.m b/p/C0SPROB2.m index f0ac3ab..9c10ed1 100644 --- a/p/C0SPROB2.m +++ b/p/C0SPROB2.m @@ -1,21 +1,19 @@ C0SPROB ; GPL - Smart Problem Processing ;5/01/12 17:05 - ;;1.0;VISTA SMART CONTAINER;;Sep 26, 2012;Build 4 - ;Copyright 2012 George Lilly. Licensed under the terms of the GNU - ;General Public License See attached copy of the License. + ;;1.0;VISTA SMART CONTAINER;;Sep 26, 2012;Build 5 + ;Copyright 2012 George Lilly. ; - ;This program is free software; you can redistribute it and/or modify - ;it under the terms of the GNU General Public License as published by - ;the Free Software Foundation; either version 2 of the License, or - ;(at your option) any later version. + ; This program is free software: you can redistribute it and/or modify + ; it under the terms of the GNU Affero General Public License as + ; published by the Free Software Foundation, either version 3 of the + ; License, or (at your option) any later version. ; - ;This program is distributed in the hope that it will be useful, - ;but WITHOUT ANY WARRANTY; without even the implied warranty of - ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ;GNU General Public License for more details. + ; This program is distributed in the hope that it will be useful, + ; but WITHOUT ANY WARRANTY; without even the implied warranty of + ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ; GNU Affero General Public License for more details. ; - ;You should have received a copy of the GNU General Public License along - ;with this program; if not, write to the Free Software Foundation, Inc., - ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + ; You should have received a copy of the GNU Affero General Public License + ; along with this program. If not, see . ; Q ; diff --git a/p/C0STBL.m b/p/C0STBL.m index 8b2d56d..f3f5045 100644 --- a/p/C0STBL.m +++ b/p/C0STBL.m @@ -1,137 +1,135 @@ C0STBL ; GPL - Smart Container CREATE A TABLE OF NHINV VALUES;2/22/12 17:05 - ;;1.0;VISTA SMART CONTAINER;;Sep 26, 2012;Build 4 - ;Copyright 2012 George Lilly. Licensed under the terms of the GNU - ;General Public License See attached copy of the License. - ; - ;This program is free software; you can redistribute it and/or modify - ;it under the terms of the GNU General Public License as published by - ;the Free Software Foundation; either version 2 of the License, or - ;(at your option) any later version. - ; - ;This program is distributed in the hope that it will be useful, - ;but WITHOUT ANY WARRANTY; without even the implied warranty of - ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ;GNU General Public License for more details. - ; - ;You should have received a copy of the GNU General Public License along - ;with this program; if not, write to the Free Software Foundation, Inc., - ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - ; - Q -EN(BEGDFN,DFNCNT,ZPART) ; START IS A DFN - I '$D(BEGDFN) S BDGDFN="" - I '$D(DFNCNT) S DFNCNT=150 - I '$D(ZPART) S ZPART="" - N ZTBL S ZTBL=$NA(^TMP("C0STBL")) - N ZI,ZCNT,ZG - S ZI=$O(^DPT(BEGDFN),-1) - S ZCNT=1 - F S ZI=$O(^DPT(ZI)) Q:((+ZI=0)!(ZCNT>DFNCNT)) D ; - . S ZCNT=ZCNT+1 - . W ZI," " - . K ZG - . D EN^C0SNHIN(.ZG,ZI,ZPART) - . M @ZTBL@(ZI)=ZG - . K G - . N GDIR S GDIR="/home/vista/p/" - . D EN^C0SMART(.G,ZI,"med") - . I $D(G) W !,$$output^C0XGET1("G",ZI_"-med.rdf",GDIR) - . k G - . D EN^C0SMART(.G,ZI,"patient") - . I $D(G) W !,$$output^C0XGET1("G",ZI_"-patient.rdf",GDIR) - . K G - . D EN^C0SMART(.G,ZI,"lab") - . I $D(G) W !,$$output^C0XGET1("G",ZI_"-lab.rdf",GDIR) - . K G - . D EN^C0SMART(.G,ZI,"problem") - . I $D(G) W !,$$output^C0XGET1("G",ZI_"-problem.rdf",GDIR) - Q - ; -LOADHACK ; - N ZI - F ZI=2:1:374 D ; - . D IMPORT^C0XF2N("hack"_ZI_".xml","/home/vista/hack/") - Q - ; -LABCNT ; COUNT LAB TESTS AND LOINC CODES - K LABCNT,GLOINC,PATCNT - S (LABCNT,GLOINC,PATCNT)=0 - N ZI S ZI="" - N GN S GN=$NA(^TMP("C0STBL")) - F S ZI=$O(@GN@(ZI)) Q:ZI="" D ; - . S PATCNT=PATCNT+1 - . I '$D(@GN@(ZI,"lab")) Q ; - . N ZJ S ZJ="" - . F S ZJ=$O(@GN@(ZI,"lab",ZJ)) Q:ZJ="" D ; - . . S LABCNT=LABCNT+1 - . . S X=$G(@GN@(ZI,"lab",ZJ,"loinc@value")) - . . I X'="" S GLOINC=GLOINC+1 - W !,"Total number of patients: ",PATCNT - W !,"Total number of lab results: ",LABCNT - W !,"Total number of lab results with loinc codes: ",GLOINC - W !,"Percentage of lab tests with loinc codes: ",$P((GLOINC/LABCNT)*100,".")_"%" - Q - ; -PROBCNT ; COUNT PROBLEMS AND SNOMED CODES - K PROBCNT,GSNO,PATCNT - S (PROBCNT,GSNO,PATCNT)=0 - N ZI S ZI="" - N GN S GN=$NA(^TMP("C0STBL")) - F S ZI=$O(@GN@(ZI)) Q:ZI="" D ; - . S PATCNT=PATCNT+1 - . I '$D(@GN@(ZI,"problem")) Q ; - . N ZJ S ZJ="" - . F S ZJ=$O(@GN@(ZI,"problem",ZJ)) Q:ZJ="" D ; - . . S PROBCNT=PROBCNT+1 - . . S X=$G(@GN@(ZI,"problem",ZJ,"icd@value")) - . . S Y=$$SNOMED^C0SPROB2(X) - . . I Y'="" S GSNO=GSNO+1 - W !,"Total number of patients: ",PATCNT - W !,"Total number of problems: ",PROBCNT - W !,"Total number of problems with snomed codes: ",GSNO - W !,"Percentage of problems with SNOMED codes: ",$P((GSNO/PROBCNT)*100,".")_"%" - Q - ; -MEDCNT ; COUNT INPATIENT VS OUTPATIENT MEDICATIONS - K MEDCNT,OMED,PATCNT,DOSE,UNITS,FORM,SCHED,ROUTE - S (MEDCNT,OMED,GSNO,PATCNT)=0 - N ZI S ZI="" - N GN S GN=$NA(^TMP("C0STBL")) - F S ZI=$O(@GN@(ZI)) Q:ZI="" D ; - . S PATCNT=PATCNT+1 - . I '$D(@GN@(ZI,"med")) Q ; - . N ZJ S ZJ="" - . F S ZJ=$O(@GN@(ZI,"med",ZJ)) Q:ZJ="" D ; - . . S MEDCNT=MEDCNT+1 - . . I $G(@GN@(ZI,"med",ZJ,"vaStatus@value"))="EXPIRED" D Q ; - . . . I $D(DEBUG) W !,"Expired Mediation, Skipping" - . . I $G(@GN@(ZI,"med",ZJ,"vaType@value"))="I" D Q ; - . . . I $D(DEBUG) W !,"Inpatient Med, skipping" - . . I $G(@GN@(ZI,"med",ZI,"vaType@value"))="V" D Q ; - . . . I $D(DEBUG) W !,"IV Inpatient Med, skipping" - . . S OMED=OMED+1 - . . S X=$G(@GN@(ZI,"med",ZJ,"form@value")) - . . S FORM(X)=$G(FORM(X))+1 - . . S X=$G(@GN@(ZI,"med",ZJ,"doses.dose@dose")) - . . I X="" S X="UNKNOWN" - . . S DOSE(X)=$G(DOSE(X))+1 - . . S X=$G(@GN@(ZI,"med",ZJ,"doses.dose@units")) - . . I X="" S X="UNKNOWN" - . . S UNITS(X)=$G(UNITS(X))+1 - . . S X=$G(@GN@(ZI,"med",ZJ,"doses.dose@schedule")) - . . I X="" S X="UNKNOWN" - . . S SCHED(X)=$G(SCHED(X))+1 - . . S X=$G(@GN@(ZI,"med",ZJ,"doses.dosc@route")) - . . I X="" S X="UNKNOWN" - . . S ROUTE(X)=$G(ROUTE(X))+1 - W !,"Total number of patients: ",PATCNT - W !,"Total number of medications: ",MEDCNT - W !,"Total number of outpatient medications: ",OMED - W !,"Percentage of outpatient medications: ",$P((OMED/MEDCNT)*100,".")_"%",! - ZWR FORM - ZWR DOSE - ZWR UNITS - ZWR SCHED - ZWR ROUTE - Q - ; + ;;1.0;VISTA SMART CONTAINER;;Sep 26, 2012;Build 5 + ;Copyright 2012 George Lilly. + ; + ; This program is free software: you can redistribute it and/or modify + ; it under the terms of the GNU Affero General Public License as + ; published by the Free Software Foundation, either version 3 of the + ; License, or (at your option) any later version. + ; + ; This program is distributed in the hope that it will be useful, + ; but WITHOUT ANY WARRANTY; without even the implied warranty of + ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ; GNU Affero General Public License for more details. + ; + ; You should have received a copy of the GNU Affero General Public License + ; along with this program. If not, see . + ; + Q +EN(BEGDFN,DFNCNT,ZPART) ; START IS A DFN + I '$D(BEGDFN) S BDGDFN="" + I '$D(DFNCNT) S DFNCNT=150 + I '$D(ZPART) S ZPART="" + N ZTBL S ZTBL=$NA(^TMP("C0STBL")) + N ZI,ZCNT,ZG + S ZI=$O(^DPT(BEGDFN),-1) + S ZCNT=1 + F S ZI=$O(^DPT(ZI)) Q:((+ZI=0)!(ZCNT>DFNCNT)) D ; + . S ZCNT=ZCNT+1 + . W ZI," " + . K ZG + . D EN^C0SNHIN(.ZG,ZI,ZPART) + . M @ZTBL@(ZI)=ZG + . K G + . N GDIR S GDIR="/home/vista/p/" + . D EN^C0SMART(.G,ZI,"med") + . I $D(G) W !,$$output^C0XGET1("G",ZI_"-med.rdf",GDIR) + . k G + . D EN^C0SMART(.G,ZI,"patient") + . I $D(G) W !,$$output^C0XGET1("G",ZI_"-patient.rdf",GDIR) + . K G + . D EN^C0SMART(.G,ZI,"lab") + . I $D(G) W !,$$output^C0XGET1("G",ZI_"-lab.rdf",GDIR) + . K G + . D EN^C0SMART(.G,ZI,"problem") + . I $D(G) W !,$$output^C0XGET1("G",ZI_"-problem.rdf",GDIR) + Q + ; +LOADHACK ; + N ZI + F ZI=2:1:374 D ; + . D IMPORT^C0XF2N("hack"_ZI_".xml","/home/vista/hack/") + Q + ; +LABCNT ; COUNT LAB TESTS AND LOINC CODES + K LABCNT,GLOINC,PATCNT + S (LABCNT,GLOINC,PATCNT)=0 + N ZI S ZI="" + N GN S GN=$NA(^TMP("C0STBL")) + F S ZI=$O(@GN@(ZI)) Q:ZI="" D ; + . S PATCNT=PATCNT+1 + . I '$D(@GN@(ZI,"lab")) Q ; + . N ZJ S ZJ="" + . F S ZJ=$O(@GN@(ZI,"lab",ZJ)) Q:ZJ="" D ; + . . S LABCNT=LABCNT+1 + . . S X=$G(@GN@(ZI,"lab",ZJ,"loinc@value")) + . . I X'="" S GLOINC=GLOINC+1 + W !,"Total number of patients: ",PATCNT + W !,"Total number of lab results: ",LABCNT + W !,"Total number of lab results with loinc codes: ",GLOINC + W !,"Percentage of lab tests with loinc codes: ",$P((GLOINC/LABCNT)*100,".")_"%" + Q + ; +PROBCNT ; COUNT PROBLEMS AND SNOMED CODES + K PROBCNT,GSNO,PATCNT + S (PROBCNT,GSNO,PATCNT)=0 + N ZI S ZI="" + N GN S GN=$NA(^TMP("C0STBL")) + F S ZI=$O(@GN@(ZI)) Q:ZI="" D ; + . S PATCNT=PATCNT+1 + . I '$D(@GN@(ZI,"problem")) Q ; + . N ZJ S ZJ="" + . F S ZJ=$O(@GN@(ZI,"problem",ZJ)) Q:ZJ="" D ; + . . S PROBCNT=PROBCNT+1 + . . S X=$G(@GN@(ZI,"problem",ZJ,"icd@value")) + . . S Y=$$SNOMED^C0SPROB2(X) + . . I Y'="" S GSNO=GSNO+1 + W !,"Total number of patients: ",PATCNT + W !,"Total number of problems: ",PROBCNT + W !,"Total number of problems with snomed codes: ",GSNO + W !,"Percentage of problems with SNOMED codes: ",$P((GSNO/PROBCNT)*100,".")_"%" + Q + ; +MEDCNT ; COUNT INPATIENT VS OUTPATIENT MEDICATIONS + K MEDCNT,OMED,PATCNT,DOSE,UNITS,FORM,SCHED,ROUTE + S (MEDCNT,OMED,GSNO,PATCNT)=0 + N ZI S ZI="" + N GN S GN=$NA(^TMP("C0STBL")) + F S ZI=$O(@GN@(ZI)) Q:ZI="" D ; + . S PATCNT=PATCNT+1 + . I '$D(@GN@(ZI,"med")) Q ; + . N ZJ S ZJ="" + . F S ZJ=$O(@GN@(ZI,"med",ZJ)) Q:ZJ="" D ; + . . S MEDCNT=MEDCNT+1 + . . I $G(@GN@(ZI,"med",ZJ,"vaStatus@value"))="EXPIRED" D Q ; + . . . I $D(DEBUG) W !,"Expired Mediation, Skipping" + . . I $G(@GN@(ZI,"med",ZJ,"vaType@value"))="I" D Q ; + . . . I $D(DEBUG) W !,"Inpatient Med, skipping" + . . I $G(@GN@(ZI,"med",ZI,"vaType@value"))="V" D Q ; + . . . I $D(DEBUG) W !,"IV Inpatient Med, skipping" + . . S OMED=OMED+1 + . . S X=$G(@GN@(ZI,"med",ZJ,"form@value")) + . . S FORM(X)=$G(FORM(X))+1 + . . S X=$G(@GN@(ZI,"med",ZJ,"doses.dose@dose")) + . . I X="" S X="UNKNOWN" + . . S DOSE(X)=$G(DOSE(X))+1 + . . S X=$G(@GN@(ZI,"med",ZJ,"doses.dose@units")) + . . I X="" S X="UNKNOWN" + . . S UNITS(X)=$G(UNITS(X))+1 + . . S X=$G(@GN@(ZI,"med",ZJ,"doses.dose@schedule")) + . . I X="" S X="UNKNOWN" + . . S SCHED(X)=$G(SCHED(X))+1 + . . S X=$G(@GN@(ZI,"med",ZJ,"doses.dosc@route")) + . . I X="" S X="UNKNOWN" + . . S ROUTE(X)=$G(ROUTE(X))+1 + W !,"Total number of patients: ",PATCNT + W !,"Total number of medications: ",MEDCNT + W !,"Total number of outpatient medications: ",OMED + W !,"Percentage of outpatient medications: ",$P((OMED/MEDCNT)*100,".")_"%",! + ZWR FORM + ZWR DOSE + ZWR UNITS + ZWR SCHED + ZWR ROUTE + Q + ; diff --git a/p/C0SUTIL.m b/p/C0SUTIL.m index 2dfc41b..4d0b0b8 100644 --- a/p/C0SUTIL.m +++ b/p/C0SUTIL.m @@ -1,21 +1,19 @@ C0SUTIL ; GPL - Smart Processing Utilities ;2/22/12 17:05 - ;;1.0;VISTA SMART CONTAINER;;Sep 26, 2012;Build 4 - ;Copyright 2012 George Lilly. Licensed under the terms of the GNU - ;General Public License See attached copy of the License. + ;;1.0;VISTA SMART CONTAINER;;Sep 26, 2012;Build 5 + ;Copyright 2012 George Lilly. ; - ;This program is free software; you can redistribute it and/or modify - ;it under the terms of the GNU General Public License as published by - ;the Free Software Foundation; either version 2 of the License, or - ;(at your option) any later version. + ; This program is free software: you can redistribute it and/or modify + ; it under the terms of the GNU Affero General Public License as + ; published by the Free Software Foundation, either version 3 of the + ; License, or (at your option) any later version. ; - ;This program is distributed in the hope that it will be useful, - ;but WITHOUT ANY WARRANTY; without even the implied warranty of - ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ;GNU General Public License for more details. + ; This program is distributed in the hope that it will be useful, + ; but WITHOUT ANY WARRANTY; without even the implied warranty of + ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ; GNU Affero General Public License for more details. ; - ;You should have received a copy of the GNU General Public License along - ;with this program; if not, write to the Free Software Foundation, Inc., - ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + ; You should have received a copy of the GNU Affero General Public License + ; along with this program. If not, see . ; Q ; diff --git a/p/C0SXPATH.m b/p/C0SXPATH.m index f866dd2..c011bfc 100644 --- a/p/C0SXPATH.m +++ b/p/C0SXPATH.m @@ -1,21 +1,19 @@ C0SXPATH ; CCDCCR/GPL - XPATH XML manipulation utilities; 6/1/08 ; 9/26/12 10:45am - ;;1.0;VISTA SMART CONTAINER;;Sep 26, 2012;Build 4 - ;Copyright 2008-2012 George Lilly. Licensed under the terms of the GNU - ;General Public License See attached copy of the License. + ;;1.0;VISTA SMART CONTAINER;;Sep 26, 2012;Build 5 + ;Copyright 2008-2012 George Lilly. ; - ;This program is free software; you can redistribute it and/or modify - ;it under the terms of the GNU General Public License as published by - ;the Free Software Foundation; either version 2 of the License, or - ;(at your option) any later version. + ; This program is free software: you can redistribute it and/or modify + ; it under the terms of the GNU Affero General Public License as + ; published by the Free Software Foundation, either version 3 of the + ; License, or (at your option) any later version. ; - ;This program is distributed in the hope that it will be useful, - ;but WITHOUT ANY WARRANTY; without even the implied warranty of - ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ;GNU General Public License for more details. + ; This program is distributed in the hope that it will be useful, + ; but WITHOUT ANY WARRANTY; without even the implied warranty of + ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ; GNU Affero General Public License for more details. ; - ;You should have received a copy of the GNU General Public License along - ;with this program; if not, write to the Free Software Foundation, Inc., - ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + ; You should have received a copy of the GNU Affero General Public License + ; along with this program. If not, see . ; W "This is an XML XPATH utility library",! W !