ORWGAPI ; SLC/STAFF - Graph API ;12/21/05 08:14
;;3.0;ORDER ENTRY/RESULTS REPORTING;**215,243**;Dec 17, 1997;Build 242
;
ALLITEMS(ITEMS,DFN) ; API - return all items of data on patient (procedures, tests, codes,..)
N CNT,SUB,TMP,TYPE
K ^TMP("ORWGAPI",$J)
S DFN=+$G(DFN) I 'DFN Q
D TYPES("ORWGAPI",DFN)
D RETURN^ORWGAPIW(.TMP,.ITEMS)
S CNT=0
S SUB=""
F S SUB=$O(^TMP("ORWGAPI",$J,SUB)) Q:SUB="" D
. S TYPE=$P(^TMP("ORWGAPI",$J,SUB),U)
. D ITEMS^ORWGAPIR(.ITEMS,DFN,TYPE,0,,,.CNT,TMP)
D SETLAST^ORWGTASK(DFN)
K ^TMP("ORWGAPI",$J)
Q
;
ALLVIEWS(DATA,VIEW,USER) ; API - get all graph views
D ALLVIEWS^ORWGAPIP(.DATA,+$G(VIEW),+$G(USER))
Q
;
CLASS(DATA,TYPE) ; API - get classification
I TYPE=50.605 D DRUGC^ORWGAPIC(.DATA)
I TYPE=68 D ACC^ORWGAPIC(.DATA)
I TYPE=8925.1 D TIUTITLE^ORWGAPIA(.DATA)
I TYPE=100.98 D OITEM^ORWGAPIA(.DATA)
Q
;
DATEDATA(DATA,OLDEST,NEWEST,TYPEITEM,DFN) ; API - return all data for an item on patient for date range
N CNT,ITEM,SUB,TMP,TYPE
S DFN=+$G(DFN) I 'DFN Q
S OLDEST=+$G(OLDEST)
S NEWEST=+$G(NEWEST,$$NOW^ORWGAPIX)
S TYPEITEM=$G(TYPEITEM) I TYPEITEM'[U Q
I 'OLDEST D ITEMDATA(.DATA,TYPEITEM,NEWEST,DFN,OLDEST) Q
I OLDEST<NEWEST Q
S TYPEITEM=$$UP^ORWGAPIX(TYPEITEM)
D RETURN^ORWGAPIW(.TMP,.DATA)
S TYPE=$P(TYPEITEM,U)
S ITEM=$P(TYPEITEM,U,2)
S CNT=0
D DATA^ORWGAPIR(.DATA,ITEM,TYPE,NEWEST,DFN,.CNT,TMP,OLDEST)
Q
;
DATEITEM(ITEMS,OLDEST,NEWEST,TYPE,DFN) ; API - return all file items on patient for date range
N CNT,SUB,TMP
K ^TMP("ORWGAPI",$J)
S DFN=+$G(DFN) I 'DFN Q
S OLDEST=+$G(OLDEST),NEWEST=+$G(NEWEST),TYPE=$G(TYPE)
I $L(TYPE) S ^TMP("ORWGAPI",$J,1)=TYPE
I '$L(TYPE) D TYPES("ORWGAPI",DFN)
D RETURN^ORWGAPIW(.TMP,.ITEMS)
S CNT=0
S SUB=""
F S SUB=$O(^TMP("ORWGAPI",$J,SUB)) Q:SUB="" D
. S TYPE=$P(^TMP("ORWGAPI",$J,SUB),U)
. D ITEMS^ORWGAPIR(.ITEMS,DFN,TYPE,6,OLDEST,NEWEST,.CNT,TMP)
K ^TMP("ORWGAPI",$J)
Q
;
DELVIEWS(DATA,NAME,PUBLIC) ; API - delete a graph view
D DELVIEWS^ORWGAPIP(.DATA,$G(NAME),$G(PUBLIC))
Q
;
DETAIL(DATA,DFN,DATE1,DATE2,VAL,COMP) ; API - get all reports for types of data from items and date range
D DETAIL^ORWGAPID("ORWGRPC",DFN,DATE1,DATE2,.VAL)
S DATA=$NA(^TMP("ORWGRPC",$J))
Q
;
DETAILS(DATA,DFN,DATE1,DATE2,TYPE,COMP) ; API - get report for type of data for a date or date range
D DETAILS^ORWGAPID("ORWGRPC",DFN,DATE1,DATE2,TYPE)
S DATA=$NA(^TMP("ORWGRPC",$J))
Q
;
FASTDATA(DATA,DFN) ; API - get all data (non-lab) on patient
D FASTDATA^ORWGAPIF(.DATA,DFN)
Q
;
FASTITEM(ITEMS,DFN) ; API - get all items on patient
D FASTITEM^ORWGAPIF(.ITEMS,DFN)
D SETLAST^ORWGTASK(DFN)
Q
;
FASTLABS(DATA,DFN) ; API - get all lab data on patient
D FASTLABS^ORWGAPIF(.DATA,DFN)
Q
;
FASTTASK(STATUS,DFN,OLDDFN) ; API - process cache of all data and items on patient, -1 if turned off
; this should be able to be turned off if needbe (D CLEAN^ORWGTASK)
D UPDATE^ORWGTASK(.STATUS,DFN,DUZ,+$G(OLDDFN))
Q
;
GETDATES(DATA,REPORTID) ; API - get graph date ranges
D GETDATES^ORWGAPID(.DATA,$G(REPORTID))
Q
;
GETPREF(DATA) ; API - get graph settings
D GETPREF^ORWGAPIP(.DATA)
Q
;
GETSIZE(DATA) ; API - get graph positions and sizes
D GETSIZE^ORWGAPIP(.DATA)
Q
;
GETVIEWS(DATA,ALL,PUBLIC,EXT,USER) ; API - get graph views
D GETVIEWS^ORWGAPIP(.DATA,$G(ALL),$G(PUBLIC),$G(EXT),+$G(USER))
Q
;
ITEMDATA(DATA,TYPEITEM,START,DFN,BACKTO) ; API - return data of an item on patient (glucose results)
N CNT,ITEM,TMP,TYPE
S DFN=+$G(DFN) I 'DFN Q
S TYPEITEM=$G(TYPEITEM) I TYPEITEM'[U Q
S TYPEITEM=$$UP^ORWGAPIX(TYPEITEM)
S START=$G(START,$$NOW^ORWGAPIX)
D RETURN^ORWGAPIW(.TMP,.DATA)
S TYPE=$P(TYPEITEM,U)
S ITEM=$P(TYPEITEM,U,2)
S CNT=0
D DATA^ORWGAPIR(.DATA,ITEM,TYPE,START,DFN,.CNT,TMP,$G(BACKTO))
Q
;
ITEMS(ITEMS,DFN,TYPE) ; API - return items of a type of data on patient (lab tests)
N CNT,TMP
S DFN=+$G(DFN) I 'DFN Q
S TYPE=$G(TYPE) I '$L(TYPE) Q
D RETURN^ORWGAPIW(.TMP,.ITEMS)
S CNT=0
D ITEMS^ORWGAPIR(.ITEMS,DFN,TYPE,3,,,.CNT,TMP)
I TYPE=63 D SETLAST^ORWGTASK(DFN)
Q
;
LOOKUP(VAL,FILE,FROM,DIR) ; API - get item names for long lookup
N REF,SCREEN,XREF
D FILE^ORWGAPIU($G(FILE),.REF,.XREF,.SCREEN)
I '$L(REF) Q
D GENERIC^ORWGAPIW(.VAL,.FROM,DIR,FILE,REF,XREF,SCREEN)
Q
;
PUBLIC(USER) ; API - $$(user) -> 1 if user can edit public settings and views
Q $$PUBLIC^ORWGAPIP(USER)
;
RPTPARAM(IEN) ; API - $$(ien) -> PARAM1^PARAM2 for graph report else ""
Q $$RPTPARAM^ORWGAPIP(IEN)
;
SETPREF(DATA,VAL,PUBLIC) ; API - set a graph setting
D SETPREF^ORWGAPIP(.DATA,$G(VAL),$G(PUBLIC))
Q
;
SETSIZE(DATA,VAL) ; API - set graph positions and settings
D SETSIZE^ORWGAPIP(.DATA,.VAL)
Q
;
SETVIEWS(DATA,NAME,PUBLIC,VAL) ; API - set a graph view
D SETVIEWS^ORWGAPIP(.DATA,$G(NAME),$G(PUBLIC),.VAL)
Q
;
TAX(DATA,ALL,REMTAX) ; API - get reminder taxonomies
D TAX^ORWGAPID(.DATA,+$G(ALL),.REMTAX)
Q
;
TESTING(DATA) ; API - return test data
D TESTING^ORWGTEST(.DATA)
Q
;
TESTSPEC(DATA) ; API - return test/spec info on all lab tests
D TESTSPEC^ORWGAPIC(.DATA)
Q
;
TYPES(TYPES,DFN,SUB) ; API - return all types of data on patient (if no dfn, return all)
N TMP
S DFN=+$G(DFN)
S SUB=+$G(SUB)
D RETURN^ORWGAPIW(.TMP,.TYPES)
D TYPES^ORWGAPIT(.TYPES,DFN,SUB,TMP)
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HORWGAPI 5397 printed Oct 16, 2024@18:36:44 Page 2
ORWGAPI ; SLC/STAFF - Graph API ;12/21/05 08:14
+1 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**215,243**;Dec 17, 1997;Build 242
+2 ;
ALLITEMS(ITEMS,DFN) ; API - return all items of data on patient (procedures, tests, codes,..)
+1 NEW CNT,SUB,TMP,TYPE
+2 KILL ^TMP("ORWGAPI",$JOB)
+3 SET DFN=+$GET(DFN)
IF 'DFN
QUIT
+4 DO TYPES("ORWGAPI",DFN)
+5 DO RETURN^ORWGAPIW(.TMP,.ITEMS)
+6 SET CNT=0
+7 SET SUB=""
+8 FOR
SET SUB=$ORDER(^TMP("ORWGAPI",$JOB,SUB))
if SUB=""
QUIT
Begin DoDot:1
+9 SET TYPE=$PIECE(^TMP("ORWGAPI",$JOB,SUB),U)
+10 DO ITEMS^ORWGAPIR(.ITEMS,DFN,TYPE,0,,,.CNT,TMP)
End DoDot:1
+11 DO SETLAST^ORWGTASK(DFN)
+12 KILL ^TMP("ORWGAPI",$JOB)
+13 QUIT
+14 ;
ALLVIEWS(DATA,VIEW,USER) ; API - get all graph views
+1 DO ALLVIEWS^ORWGAPIP(.DATA,+$GET(VIEW),+$GET(USER))
+2 QUIT
+3 ;
CLASS(DATA,TYPE) ; API - get classification
+1 IF TYPE=50.605
DO DRUGC^ORWGAPIC(.DATA)
+2 IF TYPE=68
DO ACC^ORWGAPIC(.DATA)
+3 IF TYPE=8925.1
DO TIUTITLE^ORWGAPIA(.DATA)
+4 IF TYPE=100.98
DO OITEM^ORWGAPIA(.DATA)
+5 QUIT
+6 ;
DATEDATA(DATA,OLDEST,NEWEST,TYPEITEM,DFN) ; API - return all data for an item on patient for date range
+1 NEW CNT,ITEM,SUB,TMP,TYPE
+2 SET DFN=+$GET(DFN)
IF 'DFN
QUIT
+3 SET OLDEST=+$GET(OLDEST)
+4 SET NEWEST=+$GET(NEWEST,$$NOW^ORWGAPIX)
+5 SET TYPEITEM=$GET(TYPEITEM)
IF TYPEITEM'[U
QUIT
+6 IF 'OLDEST
DO ITEMDATA(.DATA,TYPEITEM,NEWEST,DFN,OLDEST)
QUIT
+7 IF OLDEST<NEWEST
QUIT
+8 SET TYPEITEM=$$UP^ORWGAPIX(TYPEITEM)
+9 DO RETURN^ORWGAPIW(.TMP,.DATA)
+10 SET TYPE=$PIECE(TYPEITEM,U)
+11 SET ITEM=$PIECE(TYPEITEM,U,2)
+12 SET CNT=0
+13 DO DATA^ORWGAPIR(.DATA,ITEM,TYPE,NEWEST,DFN,.CNT,TMP,OLDEST)
+14 QUIT
+15 ;
DATEITEM(ITEMS,OLDEST,NEWEST,TYPE,DFN) ; API - return all file items on patient for date range
+1 NEW CNT,SUB,TMP
+2 KILL ^TMP("ORWGAPI",$JOB)
+3 SET DFN=+$GET(DFN)
IF 'DFN
QUIT
+4 SET OLDEST=+$GET(OLDEST)
SET NEWEST=+$GET(NEWEST)
SET TYPE=$GET(TYPE)
+5 IF $LENGTH(TYPE)
SET ^TMP("ORWGAPI",$JOB,1)=TYPE
+6 IF '$LENGTH(TYPE)
DO TYPES("ORWGAPI",DFN)
+7 DO RETURN^ORWGAPIW(.TMP,.ITEMS)
+8 SET CNT=0
+9 SET SUB=""
+10 FOR
SET SUB=$ORDER(^TMP("ORWGAPI",$JOB,SUB))
if SUB=""
QUIT
Begin DoDot:1
+11 SET TYPE=$PIECE(^TMP("ORWGAPI",$JOB,SUB),U)
+12 DO ITEMS^ORWGAPIR(.ITEMS,DFN,TYPE,6,OLDEST,NEWEST,.CNT,TMP)
End DoDot:1
+13 KILL ^TMP("ORWGAPI",$JOB)
+14 QUIT
+15 ;
DELVIEWS(DATA,NAME,PUBLIC) ; API - delete a graph view
+1 DO DELVIEWS^ORWGAPIP(.DATA,$GET(NAME),$GET(PUBLIC))
+2 QUIT
+3 ;
DETAIL(DATA,DFN,DATE1,DATE2,VAL,COMP) ; API - get all reports for types of data from items and date range
+1 DO DETAIL^ORWGAPID("ORWGRPC",DFN,DATE1,DATE2,.VAL)
+2 SET DATA=$NAME(^TMP("ORWGRPC",$JOB))
+3 QUIT
+4 ;
DETAILS(DATA,DFN,DATE1,DATE2,TYPE,COMP) ; API - get report for type of data for a date or date range
+1 DO DETAILS^ORWGAPID("ORWGRPC",DFN,DATE1,DATE2,TYPE)
+2 SET DATA=$NAME(^TMP("ORWGRPC",$JOB))
+3 QUIT
+4 ;
FASTDATA(DATA,DFN) ; API - get all data (non-lab) on patient
+1 DO FASTDATA^ORWGAPIF(.DATA,DFN)
+2 QUIT
+3 ;
FASTITEM(ITEMS,DFN) ; API - get all items on patient
+1 DO FASTITEM^ORWGAPIF(.ITEMS,DFN)
+2 DO SETLAST^ORWGTASK(DFN)
+3 QUIT
+4 ;
FASTLABS(DATA,DFN) ; API - get all lab data on patient
+1 DO FASTLABS^ORWGAPIF(.DATA,DFN)
+2 QUIT
+3 ;
FASTTASK(STATUS,DFN,OLDDFN) ; API - process cache of all data and items on patient, -1 if turned off
+1 ; this should be able to be turned off if needbe (D CLEAN^ORWGTASK)
+2 DO UPDATE^ORWGTASK(.STATUS,DFN,DUZ,+$GET(OLDDFN))
+3 QUIT
+4 ;
GETDATES(DATA,REPORTID) ; API - get graph date ranges
+1 DO GETDATES^ORWGAPID(.DATA,$GET(REPORTID))
+2 QUIT
+3 ;
GETPREF(DATA) ; API - get graph settings
+1 DO GETPREF^ORWGAPIP(.DATA)
+2 QUIT
+3 ;
GETSIZE(DATA) ; API - get graph positions and sizes
+1 DO GETSIZE^ORWGAPIP(.DATA)
+2 QUIT
+3 ;
GETVIEWS(DATA,ALL,PUBLIC,EXT,USER) ; API - get graph views
+1 DO GETVIEWS^ORWGAPIP(.DATA,$GET(ALL),$GET(PUBLIC),$GET(EXT),+$GET(USER))
+2 QUIT
+3 ;
ITEMDATA(DATA,TYPEITEM,START,DFN,BACKTO) ; API - return data of an item on patient (glucose results)
+1 NEW CNT,ITEM,TMP,TYPE
+2 SET DFN=+$GET(DFN)
IF 'DFN
QUIT
+3 SET TYPEITEM=$GET(TYPEITEM)
IF TYPEITEM'[U
QUIT
+4 SET TYPEITEM=$$UP^ORWGAPIX(TYPEITEM)
+5 SET START=$GET(START,$$NOW^ORWGAPIX)
+6 DO RETURN^ORWGAPIW(.TMP,.DATA)
+7 SET TYPE=$PIECE(TYPEITEM,U)
+8 SET ITEM=$PIECE(TYPEITEM,U,2)
+9 SET CNT=0
+10 DO DATA^ORWGAPIR(.DATA,ITEM,TYPE,START,DFN,.CNT,TMP,$GET(BACKTO))
+11 QUIT
+12 ;
ITEMS(ITEMS,DFN,TYPE) ; API - return items of a type of data on patient (lab tests)
+1 NEW CNT,TMP
+2 SET DFN=+$GET(DFN)
IF 'DFN
QUIT
+3 SET TYPE=$GET(TYPE)
IF '$LENGTH(TYPE)
QUIT
+4 DO RETURN^ORWGAPIW(.TMP,.ITEMS)
+5 SET CNT=0
+6 DO ITEMS^ORWGAPIR(.ITEMS,DFN,TYPE,3,,,.CNT,TMP)
+7 IF TYPE=63
DO SETLAST^ORWGTASK(DFN)
+8 QUIT
+9 ;
LOOKUP(VAL,FILE,FROM,DIR) ; API - get item names for long lookup
+1 NEW REF,SCREEN,XREF
+2 DO FILE^ORWGAPIU($GET(FILE),.REF,.XREF,.SCREEN)
+3 IF '$LENGTH(REF)
QUIT
+4 DO GENERIC^ORWGAPIW(.VAL,.FROM,DIR,FILE,REF,XREF,SCREEN)
+5 QUIT
+6 ;
PUBLIC(USER) ; API - $$(user) -> 1 if user can edit public settings and views
+1 QUIT $$PUBLIC^ORWGAPIP(USER)
+2 ;
RPTPARAM(IEN) ; API - $$(ien) -> PARAM1^PARAM2 for graph report else ""
+1 QUIT $$RPTPARAM^ORWGAPIP(IEN)
+2 ;
SETPREF(DATA,VAL,PUBLIC) ; API - set a graph setting
+1 DO SETPREF^ORWGAPIP(.DATA,$GET(VAL),$GET(PUBLIC))
+2 QUIT
+3 ;
SETSIZE(DATA,VAL) ; API - set graph positions and settings
+1 DO SETSIZE^ORWGAPIP(.DATA,.VAL)
+2 QUIT
+3 ;
SETVIEWS(DATA,NAME,PUBLIC,VAL) ; API - set a graph view
+1 DO SETVIEWS^ORWGAPIP(.DATA,$GET(NAME),$GET(PUBLIC),.VAL)
+2 QUIT
+3 ;
TAX(DATA,ALL,REMTAX) ; API - get reminder taxonomies
+1 DO TAX^ORWGAPID(.DATA,+$GET(ALL),.REMTAX)
+2 QUIT
+3 ;
TESTING(DATA) ; API - return test data
+1 DO TESTING^ORWGTEST(.DATA)
+2 QUIT
+3 ;
TESTSPEC(DATA) ; API - return test/spec info on all lab tests
+1 DO TESTSPEC^ORWGAPIC(.DATA)
+2 QUIT
+3 ;
TYPES(TYPES,DFN,SUB) ; API - return all types of data on patient (if no dfn, return all)
+1 NEW TMP
+2 SET DFN=+$GET(DFN)
+3 SET SUB=+$GET(SUB)
+4 DO RETURN^ORWGAPIW(.TMP,.TYPES)
+5 DO TYPES^ORWGAPIT(.TYPES,DFN,SUB,TMP)
+6 QUIT