Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: LEXXGI3

LEXXGI3.m

Go to the documentation of this file.
LEXXGI3 ;ISL/KER - Global Import (Load Data in ^LEXM) ;05/23/2017
 ;;2.0;LEXICON UTILITY;**59,80,103**;Sep 23, 1996;Build 2
 ;              
 ; Global Variables
 ;    ^LEXM(              N/A
 ;               
 ; External References
 ;    $$S^%ZTLOAD         ICR  10063
 ;    ^DIM                ICR  10016
 ;    $$ROOT^ICDEX        ICR   5747
 ;    $$DT^XLFDT          ICR  10103
 ;    $$FMTE^XLFDT        ICR  10103
 ;               
 ; Local Variables NEWed or KILLed Elsewhere
 ;               
 ;    LEXFL        Array of Files
 ;    LEXOK        LEXM exist
 ;    LEXSCHG      Changes
 ;    ZTQUEUED     Queued Task
 ;    ZTSK         Task Number
 ; 
FILES ;   Load Data for all files
 Q:'$L($G(LEXB))  N LEXHDR,LEXBLD,LEXDAT,LEXFI,LEXFIC,LEXHDRS,LEXLOG,LEXINS,LEXTOTI,LEXTOTN,LEXPER,LEXPRE
 S (LEXFI,LEXFIC,LEXHDR,LEXTOTI,LEXTOTN,LEXPER,LEXPRE)=0,LEXBLD=LEXB
 S LEXDAT=$P($G(^LEXM(0,"VRRVDT")),"^",1),LEXINS=1
 S:+LEXDAT'>0 LEXDAT=$$DT^XLFDT I LEXOK D
 . N LEXCRE,LEXL1 S LEXL1="" S LEXCRE=$G(^LEXM(0,"CREATED")) S LEXCRE=$S(+LEXCRE>0:($$MIX^LEXXGI2($$FMTE^XLFDT(LEXCRE))),1:"")
 . S:$L($P(LEXCRE,"@",2)) LEXCRE=$P(LEXCRE,"@",1)_" at "_$P(LEXCRE,"@",2) S LEXL1=" Updating files "
 . S:$L($G(LEXCRE))&($L($G(LEXL1))) LEXL1=$G(LEXL1)_"using export global created "_$G(LEXCRE)
 . D PB^LEXXGI2(LEXL1)
 S LEXFI=0 F  S LEXFI=$O(^LEXM(LEXFI)) Q:+LEXFI=0  S LEXTOTN=+($G(LEXTOTN))+($O(^LEXM(LEXFI," "),-1))
 S LEXFI=0 F  S LEXFI=$O(^LEXM(LEXFI)) Q:+LEXFI=0  D FILE
 Q
FILE ;     Load Data for one file
 N LEXCF,LEXCHG,LEXCHGS,LEXCNT,LEXFIL,LEXI,LEXID,LEXIEN,LEXL,LEXLC
 N LEXMUMPS,LEXNM,LEXRT,LEXS,LEXTOT,LEXTXT,LEXIGL,LEXIGI,LEXIGF,LEXIGT
 N LEXIGD,LEXIGO,LEXBEG,LEXEND,LEXELP,LEXFB
 S LEXFB=$G(^LEXM(+LEXFI,0,"BUILD")),LEXIGO=0,LEXBEG=$$HACK^LEXXGI2
 S (LEXCNT,LEXLC,LEXI)=0,LEXL=68,LEXFIC=LEXFIC+1 I LEXOK D
 . N LEXB,LEXFID,LEXNM,LEXVR,LEXRV,LEXDT,LEXL1,LEXL2 S (LEXL1,LEXL2)="",LEXFID=$P(LEXFI,".",1)
 . Q:+LEXFID'>0  Q:$D(LEXHDRS(+LEXFID))  S LEXHDRS(LEXFID)="" S:+LEXFI=81!(+LEXFI=81.3) LEXHDRS(81)="",LEXHDRS(81.3)=""
 . S:LEXFID=80 LEXNM="ICD-9-CM" S:LEXFID=81 LEXNM="CPT-4/HCPCS" S:LEXFID=757 LEXNM="Lexicon" S LEXB=$G(^LEXM(LEXFI,0,"BUILD"))
 . S LEXVR=$G(^LEXM(LEXFI,0,"VR")),LEXRV=$G(^LEXM(LEXFI,0,"VRRV")),LEXDT=$$MIX^LEXXGI2($$FMTE^XLFDT($P(LEXRV,"^",2))),LEXRV=$P(LEXRV,"^",1)
 . S LEXL1="Updating "_LEXNM S:$L(LEXB) LEXL1=LEXL1_" with patch/build "_LEXB S:$L(LEXVR) LEXL2=" To version "_LEXVR
 . S:$L(LEXVR)&($L(LEXRV)) LEXL2=LEXL2_" revision "_LEXRV S:$L(LEXVR)&($L(LEXRV))&($L(LEXDT)) LEXL2=LEXL2_" dated "_LEXDT
 . S:$L(LEXL1) LEXL1=" "_LEXL1 S:$L(LEXL2) LEXL2=" "_LEXL2 D BL^LEXXGI2 D:$L(LEXL1) TL^LEXXGI2(LEXL1) D:$L(LEXL2) TL^LEXXGI2(LEXL2),BL^LEXXGI2
 S LEXTOT=+($G(^LEXM(LEXFI,0))) G:LEXTOT=0 FILEQ
 S LEXNM=$G(^LEXM(LEXFI,0,"NM"))
 I $L(LEXNM),$$UP^LEXXGI2(LEXNM)'["FILE" S LEXNM=LEXNM_" FILE"
 S:$L(LEXNM) LEXNM=$$MIX^LEXXGI2(LEXNM) S LEXCHG=$G(^LEXM(LEXFI,0))
 S LEXTXT="   "_LEXNM,LEXTXT=LEXTXT_$J("",(40-$L(LEXTXT)))_LEXFI
 D:LEXFIC=1 PB^LEXXGI2(LEXTXT) D:LEXFIC'=1 TL^LEXXGI2(LEXTXT)
 S LEXS=+(LEXTOT\LEXL) S:LEXS=0 LEXS=1 W:+($O(^LEXM(LEXFI,0)))>0 !,"   "
 D UPCHG^LEXXGI2 F  S LEXI=$O(^LEXM(LEXFI,LEXI)) Q:+LEXI=0  D
 . S LEXCNT=LEXCNT+1,LEXMUMPS=$G(^LEXM(LEXFI,LEXI))
 . I LEXCNT'<LEXS S LEXLC=LEXLC+1 W:LEXLC'>LEXL "." S LEXCNT=0
 . S LEXRT=$P(LEXMUMPS,"^",2),LEXFIL=""
 . S:LEXMUMPS["^LEX("!(LEXMUMPS["^LEXT(")!(LEXMUMPS["^LEXC(") LEXFIL=+($P(LEXRT,"(",2)),LEXFL(+($P(LEXRT,"(",2)))=""
 . S:LEXMUMPS[$$ROOT^ICDEX(80) LEXFIL=80,LEXFL(80)=""
 . S:LEXMUMPS[$$ROOT^ICDEX(80.1) LEXFIL=80.1,LEXFL(80.1)=""
 . S:LEXMUMPS["^ICPT(" LEXFIL=81,LEXFL(81)=""
 . S:LEXMUMPS["^DIC(81.3" LEXFIL=81.3,LEXFL(81.3)=""
 . S:LEXMUMPS["^DIC(81.2" LEXFIL=81.2,LEXFL(81.2)=""
 . S:+LEXFIL>0 LEXSCHG(+LEXFIL,0)=""
 . I $L(LEXMUMPS) D
 . . X LEXMUMPS S LEXIGO=1
 . . S LEXTOTI=+($G(LEXTOTI))+1 I +($G(LEXTOTN))>0,+($G(LEXTOTI))>0,$D(ZTQUEUED),+($G(ZTSK))>0 D
 . . . N LEXT,LEXTSK S (LEXT,LEXPER)=(+($G(LEXTOTI))/+($G(LEXTOTN)))*100 Q:+LEXPER-(+($G(LEXPRE)))'>2  S LEXPRE=+($G(LEXPER))
 . . . S LEXPER=$J(LEXPER,6,2) I +LEXT>0 S LEXPER=LEXPER_"% complete" S LEXTSK=$$S^%ZTLOAD(LEXPER)
 I +($G(LEXIGO))>0 D
 . S LEXEND=$$HACK^LEXXGI2 S LEXELP=$$ELAP^LEXXGI2(LEXBEG,LEXEND) S:LEXELP="" LEXELP="00:00:00"
FILEQ ;     Load Data for one file - QUIT
 Q
UTOT ; CSV Totals
 N Y,ZTRTN,ZTDESC,ZTIO,ZTDTH,ZTSAVE,ZTQUEUED,ZTREQ S ZTRTN="UTOTS^LEXXGI3"
 S ZTDESC="Update HIPAA CSV Totals in file 757.03" S:$D(LEXALL) ZTSAVE("LEXALL")=""
 S ZTIO="",ZTDTH=$H D ^%ZTLOAD,HOME^%ZIS K LEXALL
 Q
UTOTS ; CSV Totals
 N LEXA,LEXB,LEXD,LEXE,LEXH,LEXI,LEXS,LEXT,LEXTD,LEXFD
 S (LEXI,LEXT,LEXA)=0 F  S LEXI=$O(@("^ICD9("_LEXI_")")) Q:+LEXI'>0!(LEXI>499999)  D
 . N LEXE,LEXH,LEXS S LEXT=LEXT+1
 . S LEXE=$O(@("^ICD9("_+LEXI_",66,""B"","" "")"),-1) Q:LEXE'?7N
 . S LEXH=$O(@("^ICD9("_+LEXI_",66,""B"","_+LEXE_","" "")"),-1) Q:LEXH'?1N.N
 . S LEXS=+($P($G(@("^ICD9("_+LEXI_",66,"_+LEXH_",0)")),"^",2)) S:+LEXS>0 LEXA=LEXA+1
 S:LEXT>0 $P(^LEX(757.03,1,0),"^",6)=+LEXT S $P(^LEX(757.03,1,0),"^",5)=+LEXA
 S (LEXI,LEXT,LEXA)=0 F  S LEXI=$O(@("^ICD0("_LEXI_")")) Q:+LEXI'>0!(LEXI>499999)  D
 . N LEXE,LEXH,LEXS S LEXT=LEXT+1
 . S LEXE=$O(@("^ICD0("_+LEXI_",66,""B"","" "")"),-1) Q:LEXE'?7N
 . S LEXH=$O(@("^ICD0("_+LEXI_",66,""B"","_+LEXE_","" "")"),-1) Q:LEXH'?1N.N
 . S LEXS=+($P($G(@("^ICD0("_+LEXI_",66,"_+LEXH_",0)")),"^",2)) S:+LEXS>0 LEXA=LEXA+1
 S:LEXT>0 $P(^LEX(757.03,2,0),"^",6)=+LEXT S $P(^LEX(757.03,2,0),"^",5)=+LEXA
 S LEXI=499999,(LEXA,LEXT)=0 F  S LEXI=$O(@("^ICD9("_LEXI_")")) Q:+LEXI'>0  D
 . N LEXE,LEXH,LEXS S LEXT=LEXT+1
 . S LEXE=$O(@("^ICD9("_+LEXI_",66,""B"","" "")"),-1) Q:LEXE'?7N
 . S LEXH=$O(@("^ICD9("_+LEXI_",66,""B"","_+LEXE_","" "")"),-1) Q:LEXH'?1N.N
 . S LEXS=+($P($G(@("^ICD9("_+LEXI_",66,"_+LEXH_",0)")),"^",2)) S:+LEXS>0 LEXA=LEXA+1
 S:LEXT>0 $P(^LEX(757.03,30,0),"^",6)=+LEXT S $P(^LEX(757.03,30,0),"^",5)=+LEXA
 S LEXI=499999,(LEXA,LEXT)=0 F  S LEXI=$O(@("^ICD0("_LEXI_")")) Q:+LEXI'>0  D
 . N LEXE,LEXH,LEXS S LEXT=LEXT+1
 . S LEXE=$O(@("^ICD0("_+LEXI_",66,""B"","" "")"),-1) Q:LEXE'?7N
 . S LEXH=$O(@("^ICD0("_+LEXI_",66,""B"","_+LEXE_","" "")"),-1) Q:LEXH'?1N.N
 . S LEXS=+($P($G(@("^ICD0("_+LEXI_",66,"_+LEXH_",0)")),"^",2)) S:+LEXS>0 LEXA=LEXA+1
 S:LEXT>0 $P(^LEX(757.03,31,0),"^",6)=+LEXT S $P(^LEX(757.03,31,0),"^",5)=+LEXA
 S (LEXI,LEXT,LEXH,LEXA,LEXB)=0 F  S LEXI=$O(@("^ICPT("_LEXI_")")) Q:+LEXI'>0  D
 . N LEXD,LEXS,LEXE,LEXJ S LEXD=$P($G(^ICPT(+LEXI,0)),"^",6) S:LEXD="C" LEXT=LEXT+1 S:LEXD="H" LEXH=LEXH+1
 . S LEXE=$O(^ICPT(+LEXI,60,"B"," "),-1) Q:LEXE'?7N
 . S LEXJ=$O(^ICPT(+LEXI,60,"B",+LEXE," "),-1) Q:LEXJ'?1N.N
 . S LEXS=$P($G(^ICPT(+LEXI,60,+LEXJ,0)),"^",2)
 . S:LEXS>0&(LEXD="C") LEXA=LEXA+1 S:LEXS>0&(LEXD="H") LEXB=LEXB+1
 S:LEXT>0 $P(^LEX(757.03,3,0),"^",6)=+LEXT S $P(^LEX(757.03,3,0),"^",5)=+LEXA
 S:LEXH>0 $P(^LEX(757.03,4,0),"^",6)=+LEXH S $P(^LEX(757.03,4,0),"^",5)=+LEXB
 N LEXTD,LEXFD S LEXTD=$$DT^XLFDT,LEXFD=$$FMADD^XLFDT(LEXTD,365)
 K ^TMP("LEXXGI3",$J) S (LEXA,LEXT,LEXI)=0 F  S LEXI=$O(^LEX(757.02,"ASRC","SCT",LEXI)) Q:+LEXI'>0  D
 . N LEXC,LEXS S LEXC=$P($G(^LEX(757.02,+LEXI,0)),"^",2) Q:$D(^TMP("LEXXGI3",$J,(LEXC_" ")))
 . S LEXT=LEXT+1 S LEXS=$$STATCHK^LEXSRC2(LEXC,LEXFD,,"SCT")
 . S:+LEXS>0 LEXA=LEXA+1 S ^TMP("LEXXGI3",$J,(LEXC_" "))=""
 K ^TMP("LEXXGI3",$J) S:LEXT>0 $P(^LEX(757.03,56,0),"^",6)=+LEXT S $P(^LEX(757.03,56,0),"^",5)=+LEXA
 D:$D(LEXALL) OTH
 Q
TOT ; Code Set Totals
 N LEXT,LEXA,LEXC W:$L($G(IOF)) @IOF
 W !,?2,"Code Set              ",?27,$J("Active",6),?36,$J("Inactive",8),?49,$J(" Total",6)
 W !,?2,"----------------------",?27,$J("------",6),?36,$J("--------",8),?49,$J(" -----",6)
 S LEXT="ICD-9-CM Diagnosis    ",LEXA=$P($G(^LEX(757.03,1,0)),"^",5),LEXC=$P($G(^LEX(757.03,1,0)),"^",6),LEXI=LEXC-LEXA
 W !,?2,LEXT,?27,$J(LEXA,6),?36,$J(LEXI,8),?49,$J(LEXC,6)
 S LEXT="ICD-9 Procedures      ",LEXA=$P($G(^LEX(757.03,2,0)),"^",5),LEXC=$P($G(^LEX(757.03,2,0)),"^",6),LEXI=LEXC-LEXA
 W !,?2,LEXT,?27,$J(LEXA,6),?36,$J(LEXI,8),?49,$J(LEXC,6)
 S LEXT="ICD-10-CM Diagnosis   ",LEXA=$P($G(^LEX(757.03,30,0)),"^",5),LEXC=$P($G(^LEX(757.03,30,0)),"^",6),LEXI=LEXC-LEXA
 W !,?2,LEXT,?27,$J(LEXA,6),?36,$J(LEXI,8),?49,$J(LEXC,6)
 S LEXT="ICD-10-CM Procedures  ",LEXA=$P($G(^LEX(757.03,31,0)),"^",5),LEXC=$P($G(^LEX(757.03,31,0)),"^",6),LEXI=LEXC-LEXA
 W !,?2,LEXT,?27,$J(LEXA,6),?36,$J(LEXI,8),?49,$J(LEXC,6)
 S LEXT="CPT Procedures        ",LEXA=$P($G(^LEX(757.03,3,0)),"^",5),LEXC=$P($G(^LEX(757.03,3,0)),"^",6),LEXI=LEXC-LEXA
 W !,?2,LEXT,?27,$J(LEXA,6),?36,$J(LEXI,8),?49,$J(LEXC,6)
 S LEXT="HCPCS Procedures      ",LEXA=$P($G(^LEX(757.03,4,0)),"^",5),LEXC=$P($G(^LEX(757.03,4,0)),"^",6),LEXI=LEXC-LEXA
 W !,?2,LEXT,?27,$J(LEXA,6),?36,$J(LEXI,8),?49,$J(LEXC,6)
 S LEXT="SNOMED CT Codes       ",LEXA=$P($G(^LEX(757.03,56,0)),"^",5),LEXC=$P($G(^LEX(757.03,56,0)),"^",6),LEXI=LEXC-LEXA
 W !,?2,LEXT,?27,$J(LEXA,6),?36,$J(LEXI,8),?49,$J(LEXC,6),!
 Q
OTH ; Other SAB Totals
 N LEXCSI,LEXTD,LEXFD S LEXTD=$$DT^XLFDT,LEXFD=$$FMADD^XLFDT(LEXTD,365)
 S LEXCSI=0 F  S LEXCSI=$O(^LEX(757.03,+LEXCSI)) Q:+LEXCSI'>0  D
 . N LEXSAB,LEXSCI,LEXTOT,LEXACT
 . S LEXSAB=$E($G(^LEX(757.03,+LEXCSI,0)),1,3) Q:$L(LEXSAB)'=3
 . Q:"^CPT^CPC^ICD^ICP^10D^10P^SCT^"[("^"_LEXSAB_"^")
 . K ^TMP("LEXXGI3",$J,LEXSAB) S (LEXTOT,LEXACT,LEXSCI)=0
 . F  S LEXSCI=$O(^LEX(757.02,"ASRC",LEXSAB,LEXSCI)) Q:+LEXSCI'>0  D
 . . N LEXCOD,LEXSTA
 . . S LEXCOD=$P($G(^LEX(757.02,+LEXSCI,0)),"^",2) Q:'$L(LEXCOD)
 . . Q:$D(^TMP("LEXXGI3",$J,LEXSAB,LEXCOD))
 . . S LEXTOT=LEXTOT+1
 . . S LEXSTA=$$STATCHK^LEXSRC2(LEXCOD,LEXFD,,LEXSAB)
 . . S:+LEXSTA>0 LEXACT=LEXACT+1
 . . S ^TMP("LEXXGI3",$J,LEXSAB,LEXCOD)=""
 . S $P(^LEX(757.03,+LEXCSI,0),"^",5)=+LEXACT
 . S $P(^LEX(757.03,+LEXCSI,0),"^",6)=+LEXTOT
 . K ^TMP("LEXXGI3",$J,LEXSAB)
 K ^TMP("LEXXGI3",$J)
 Q