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

APCLDF.m

Go to the documentation of this file.
APCLDF ; IHS/CMI/LAB - YRULER<->PCC INTERFACE ;
 ;;2.0;IHS PCC SUITE;**5,10**;MAY 14, 2009;Build 88
 ;The above line will be changed to be nonparameter as of the
 ;next version of this package.  All callers should enter this
 ;routine at entry point START1^APCLDF(,,,)
 ;FIRST LINE PARAMETER PASS OKAY'ED BY SAC COMMITTEE TO ALLOW OTHER PACKAGES TO CHANGE THEIR CALLS
 ;
 G START2
 ;
START1(APCLX,APCLY,APCLINT,APCLTYPE) ;PEP - PUBLISHED ENTRY POINT - main entry point for data fetcher utility
START2 ;
 ;
 ; input vars via parameter pass (required):
 ; APCLX - contains the pt dfn^script
 ; APCLY - contains the array in which results to be sent back in
 ; ** IT IS THE RESPONSIBILITY OF THE CALLER TO KILL THE ARRAY
 ; ** PRIOR TO CALLING THIS ROUTINE
 ;
 ; input vars via parameter pass :
 ; APCLINT - set to 1 to invoke interactive mode
 ;         - set to 0 or do not pass for background mode
 ;
 ; output vars:
 ; 1. APCLTYPE - returned (if APCLINT set) with file type, NV, D, etc.
 ; 2. ARRAY designated by caller (will be undefined if no hits or if
 ; error) note: array var will exist if demo. info asked for and
 ; value is null
 ; 3. APCLER - if error, set to a code delineated in APCLDF2, returned 
 ; as value of function
 ; 4. APCLTYPE - returned with value of file type D, NV, or V
 ; (if APCLINT was set=1 and caller called by reference)
 ;
START ;
 NEW %,C,D,E,I,N,X,Y,Z,COND,FILE,FLD,FN,HIT,LINE,LKUP,NUM,NVAL,PAT,SCRN,STP,TABLE,TAX,TVAL,TVAL2,TYPE,VAL,XREF,APCLTX,BOOL,DATE,STDATE,EDATE,APCLFILE,APCLER,DIC,B
 I '$D(APCLX) S APCLER=1 G XIT
 I '$D(APCLY) S APCLER=2 G XIT
 I $G(APCLINT) S APCLINT=""
 E  K APCLINT
 D SETUP I $D(APCLER) G XIT
 I $E("PATIENT",1,$L($P(X," ")))=$P(X," ")!($P(X," ")="PT") D D^APCLDF4 G XIT
 D PARSE^APCLDF1
 D SET
 I $D(APCLER) G XIT
 D PROCESS^APCLDF1
XIT ;
 K ^TMP("APCLDF",$J),^TMP("APCLTAX",$J)
 I '$D(APCLER) S APCLER=0
 Q APCLER
 ;
SETUP ;
 K ^TMP("APCLDF",$J),^TMP("APCLTAX",$J),APCLER
 S U="^"
 NEW % F %=1:1:$L(APCLX) S:$E(APCLX,%)?1L APCLX=$E(APCLX,0,%-1)_$C($A(APCLX,%)-32)_$E(APCLX,%+1,999)
 S PAT=$P(APCLX,U),X=$P(APCLX,U,2)
 I X="" S APCLER=6
 Q
 ;
SET ;
 ; Rosetta Stone for the text line is:
 ; FILE;TYPE;LOOKUP GLOBAL;PCC GLOBAL;SCREEN;QMAN TERM FOR TAXONOMY;TABLE XREF;SAVED;SAVED;SYNONYM;SYNONYM;SYNONYM
 ;F I=1:1 S:$T(LKUP+I)=""&('$D(HIT)) APCLER=5 Q:$D(APCLER)!($T(LKUP+I)="")  I $E($P($T(LKUP+I),";",3),1,$L(FILE))=FILE!($P($T(LKUP+I),";",12,99)[FILE) S:$D(HIT) APCLER=12 S HIT=I K APCLHIT
 F I=1:1 S:$T(LKUP+I)=""&('$D(HIT)) APCLER=5 Q:$D(APCLER)!($T(LKUP+I)="")  D  I $E($P($T(LKUP+I),";",3),1,$L(FILE))=FILE!$D(APCLHIT) S:$D(HIT) APCLER=12 S HIT=I K APCLHIT
 . NEW APCLI
 . F APCLI=12:1:99 Q:$P($T(LKUP+I),";",APCLI)=""!$D(APCLHIT)  S APCLTXT=$P($T(LKUP+I),";",APCLI) I $E(APCLTXT,1,$L(FILE))=FILE S APCLHIT="" Q
 . K APCLTXT
 I $D(APCLER) G X1
 S LINE=$P($T(LKUP+HIT),";",3,99)
 I $D(APCLINT) S APCLFILE=$P(LINE,";")
 S TYPE=$P(LINE,";",2)
 I $D(APCLINT) S APCLTYPE=TYPE
 S TABLE=$P(LINE,";",3)
 S LKUP=$P(LINE,";",4)
 I $D(APCLINT) S APCLFILE=$P(@LKUP@(0),U)
 S SCRN=$P(LINE,";",5)
 S TAX=$P(LINE,";",6)
 I TAX="",(VAL["["!(VAL="*")) S APCLER=3 G X1
 I VAL="*",TAX]"",$D(APCLINT) D TAX
 S XREF=$P(LINE,";",7)
X1 Q
 ;
TAX ; User may create a taxonomy if they choose     
 S X=TAX,DIC="^AMQQ(5,",DIC(0)="FM",DIC("S")="I $P(^(0),U,14)" D ^DIC I Y=-1 S APCLER=7 G X5
 S X=+Y D EN1^AMQQTX I '$D(^UTILITY("AMQQ TAX",$J)) S APCLER=11 G X5
 I $G(AMQQTDFN)>0 S VAL="["_$P(^ATXAX(AMQQTDFN,0),U)_"]"
 I $D(^UTILITY("AMQQ TAX",$J)) D
 . S T=$O(^UTILITY("AMQQ TAX",$J,""))
 . F TX=0:0 S TX=$O(^UTILITY("AMQQ TAX",$J,T,TX)) Q:'TX  S ^TMP("APCLTAX",$J,TX)=""
 . K ^UTILITY("AMQQ TAX")
 K AMQQCCLS,AMQQCNAM,AMQQDF,AMQQQ,AMQQTAX,AMQQURGN,AMQQTDFN,AMQQQUIT,AMQQECHO,AMQQGTX,AMQQTAXT,AMQQTGBL
X5 Q
 ;
LKUP ; D=Demographic, VI="AA" xref doesn't include .01 ptr val, VV does, NV is non-"V" file,VISIT=VISIT file
 ;;PURPOSE OF VISITS;VI;^ICD9;^AUPNVPOV;;DIAGNOSIS;BA;;;POV;DX;DIAGNOSIS
 ;;DENTAL SERVICES;VI;^AUTTADA;^AUPNVDEN;;ADA CODE;BA;;;ADA CODE
 ;;EXAMINATIONS;VV;^AUTTEXAM;^AUPNVXAM;;;B;;;EXAMS
 ;;VISIT;VISIT;;^AUPNVSIT;;;B;;;VISITS
 ;;MEDICATIONS;VI;^PSDRUG;^AUPNVMED;;RX;B;;;RX;MEDS
 ;;LABS;VV;^LAB(60);^AUPNVLAB;;LAB TAX;B;;;LABORATORY;LAB TESTS
 ;;MEASUREMENTS;VV;^AUTTMSR;^AUPNVMSR;;;B
 ;;PROCEDURES;VI;^ICD0;^AUPNVPRC;;PROCEDURE (MEDICAL);BA;;;
 ;;SKIN TESTS;VV;^AUTTSK;^AUPNVSK;;;B
 ;;IMMUNIZATIONS;VV;^AUTTIMM;^AUPNVIMM;;;B
 ;;DIAGNOSTIC PROCEDURE;VV;^AUTTDXPR;^AUPNVDXP;;;B
 ;;RADIOLOGY;VV;^RAMIS(71);^AUPNVRAD;;;B;;;XRAY;FILMS;RADIOLOGY STUDIES
 ;;EDUCATION;VI;^AUTTEDT;^AUPNVPED;;PATIENT ED TOPIC;B;;;PT EDUCATION;EDUCATION TOPICS;PATIENT ED
 ;;ACTIVE PROBLEMS;NV;^ICD9;^AUPNPROB;I $P(@LKUP@(D,0),U,12)'="D",$P(@LKUP@(D,0),U,12)'="I";PROBLEM LIST DIAGNOSIS;BA
 ;;PROBLEMS;NV;^ICD9;^AUPNPROB;I $P(@LKUP@(D,0),U,12)'="D";PROBLEM LIST DIAGNOSIS;BA
 ;;INACTIVE PROBLEMS;NV;^ICD9;^AUPNPROB;I $P(@LKUP@(D,0),U,12)="I";PROBLEM LIST DIAGNOSIS;BA
 ;;FAMILY HISTORY;NV;^ICD9;^AUPNFH;;DIAGNOSIS;BA
 ;;PERSONAL HISTORY;NV;^ICD9;^AUPNPH;;DIAGNOSIS;BA
 ;;HLTH STATUS;NV;^AUTTHF;^AUPNHF;;HEALTH FACTORS;B
 ;;HEALTH FACTORS;VV;^AUTTHF;^AUPNVHF;;HEALTH FACTORS;B;;;HEALTH STATUS