From 879c00d44aa361302d987e77172e6c96b9b16357 Mon Sep 17 00:00:00 2001 From: george Date: Wed, 19 Nov 2008 17:01:28 +0000 Subject: [PATCH] updated alert coding analysis --- p/KBAICSNA.m | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/p/KBAICSNA.m b/p/KBAICSNA.m index 5cafb9f..751bc78 100644 --- a/p/KBAICSNA.m +++ b/p/KBAICSNA.m @@ -42,22 +42,22 @@ ANALYZE(BEGIEN,IENCNT) ; SNOMED RETRIEVAL ANALYSIS ROUTINE . N SNORTN,TTERM ; RETURN ARRAY . S TTERM=$P(@GMRBASE@(SNOIEN,0),"^",1)_" ALLERGY" . D TEXTRPC(.SNORTN,TTERM) - . I '$D(SNORTN) Q ; - . S TVUID=$$GET1^DIQ(120.82,SNOIEN,"VUID") - . W "VUID:",VUID,! - . K @SNOBASE@("VARS",SNOIEN) ; CLEAR OUT OLD VARS - . I $P(TTMP,"^",1)=1 S @SNOBASE@("VARS",SNOIEN)=TTERM_"^"_TTMP_"^"_SNORTN(0) - . ; - . ; EVALUATE THE VARIABLES AND CREATE AN ATTRIBUTE MAP - . ; - . S RATTR=$$SETATTR(SNOIEN) ; SET THE ATTRIBUTE STRING BASED ON THE VARS - . S @SNOBASE@("ATTR",SNOIEN)=RATTR ; SAVE THE ATRIBUTES FOR THIS DRUG - . ; - . N CATNAME,CATTBL - . S CATNAME="" - . D CPUSH(.CATNAME,SNOBASE,"SNOTBL",SNOIEN,RATTR) ; ADD TO CATEGORY - . ; W "CATEGORY NAME: ",CATNAME,! - . ; + . I $D(SNORTN) D ; + . . S TVUID=$$GET1^DIQ(120.82,SNOIEN,"VUID") + . . W "VUID:",TVUID,! + . . K @SNOBASE@("VARS",SNOIEN) ; CLEAR OUT OLD VARS + . . I $P(TTMP,"^",1)=1 S @SNOBASE@("VARS",SNOIEN)=TTERM_"^"_TTMP_"^"_SNORTN(0)_"^"_TVUID_"^"_SNORTN("F") + . . ; + . . ; EVALUATE THE VARIABLES AND CREATE AN ATTRIBUTE MAP + . . ; + . . S RATTR=$$SETATTR(SNOIEN) ; SET THE ATTRIBUTE STRING BASED ON THE VARS + . . S @SNOBASE@("ATTR",SNOIEN)=RATTR ; SAVE THE ATRIBUTES FOR THIS DRUG + . . ; + . . N CATNAME,CATTBL + . . S CATNAME="" + . . D CPUSH(.CATNAME,SNOBASE,"SNOTBL",SNOIEN,RATTR) ; ADD TO CATEGORY + . . ; W "CATEGORY NAME: ",CATNAME,! + . . ; . S SNOIEN=$O(@GMRBASE@(SNOIEN)) ; NEXT RECORD . S @SNOBASE@("RESUME")=SNOIEN ; WHERE WE ARE LEAVING OFF THIS RUN ; D PARY^GPLXPATH(@SNOBASE@("ATTRTBL")) @@ -182,10 +182,11 @@ REUSE ; GET SAVED VALUES FROM ^TMP("GPLSAV") AND PUT THEM IN A DATABASE D AINIT N SNOI,SNOJ,SNOK,SNOSNO,SNOSEC,SNOIEN,SNOOLD,SNOSRCH D DO^KBAICX1 ; INITIALIZE GPLSAV VARIABLES - S SAVBASE=$NA(^TMP("GPLSAV","VARS")) + ;S SAVBASE=$NA(^TMP("GPLSAV","VARS")) + S SAVBASE=$NA(@SNOBASE@("VARS")) S CSVARY=$NA(^TMP("GPLSNO","CSV")) K @CSVARY - D PUSH^GPLXPATH(CSVARY,"OLDCODE|GMRText|MediationCode|MediationText") ; header for CSV file + D PUSH^GPLXPATH(CSVARY,"VUID|VUIDText|MediationCode|MediationText") ; header for CSV file S SNOI="" F D Q:$O(@SAVBASE@(SNOI))="" ;THE WHOLE LIST . S SNOI=$O(@SAVBASE@(SNOI)) @@ -196,14 +197,16 @@ REUSE ; GET SAVED VALUES FROM ^TMP("GPLSAV") AND PUT THEM IN A DATABASE . S SNOSNO=$P(SNOJ,"^",4) ; SNOMED CODE . S SNOSEC=$P(SNOJ,"^",5) ; SECTION OF SNOMED FOR THIS CODE . S SNOOLD=$P(SNOJ,"^",7) ; OLD NUMBER FOR THIS CODE - . D PUSH^GPLXPATH(CSVARY,SNOOLD_"|"_$P(SNOSRCH," ALLERGY",1)_"|"_SNOSNO_"|"_SNOSRCH_"("_SNOSEC_")") + . S SNOVUID=$P(SNOJ,"^",9) ; VUID FOR THIS RECORD + . S SNOTXT=$P(SNOJ,"^",10) ; NOMED TEXT FOR CODE + . D PUSH^GPLXPATH(CSVARY,SNOVUID_"|"_$P(SNOSRCH," ALLERGY",1)_"|"_SNOSNO_"|"_SNOTXT) . W "SEARCH:",SNOSRCH," IEN:",SNOIEN," CODE:",SNOSNO," SEC:",SNOSEC," OLD:",SNOOLD,! . W SNOK,! . W SNOJ,! S OARY=$NA(@CSVARY@(1)) ; SETUP FOR OUTPUT ROUTINE D PARY^GPLXPATH(CSVARY) S OFILE="GMR_ALLERGY_MAPPING_TABLE.csv" - S ODIR="/home/glilly/" + S ODIR="/home/vademo2/" S ZY=$$OUTPUT^GPLXPATH(OARY,OFILE,ODIR) I ZY W "WROTE ",OFILE," to ",ODIR,! Q