VistA-ccr/p/GPLACTORS.m

165 lines
7.1 KiB
Mathematica
Raw Normal View History

GPLACTORS ; CCDCCR/GPL - CCR/CCD PROCESSING FOR ACTORS ; 7/3/08
2008-07-14 10:53:09 -04:00
;;0.3;CCDCCR;nopatch;noreleasedate
;Copyright 2008 WorldVistA. 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.
2008-07-03 21:02:47 -04:00
;
; PROCESS THE ACTORS SECTION OF THE CCR
;
; ===Revision History===
; 0.1 Initial Writing of Skeleton--GPL
; 0.2 Patient Data Extraction--SMH
; 0.3 Information System Info Extraction--SMH
2008-07-03 21:02:47 -04:00
;
2008-07-05 19:57:32 -04:00
EXTRACT(IPXML,ALST,AXML) ; EXTRACT ACTOR FROM ALST INTO PROVIDED XML TEMPLATE
; IPXML is the Input Actor Template into which we are going to substitute values
; This is straight XML. Values to be substituted are in @@VAL@@ format.
; ALST is the actor list global generated by ACTLST^GPLCCR and is in the following format
; ^TMP(7542,1,"ACTORS",0)=Count
; ^TMP(7542,1,"ACTORS",n)="ActorID^ActorType^ActorIEN"
; ActorType is an enum containing either "PROVIDER" "PATIENT" "SYSTEM"
; AXML is the output arrary, to contain XML.
2008-07-05 19:57:32 -04:00
N I,J,AMAP,AOID,ATYP,AIEN
D CP^GPLXPATH(IPXML,AXML) ; MAKE A COPY OF ACTORS XML
D REPLACE^GPLXPATH(AXML,"","//Actors") ; DELETE THE INSIDES
W "PROCESSING ACTORS ",!
F I=1:1:@ALST@(0) D ; PROCESS ALL ACTORS IN THE LIST
. I @ALST@(I)["@@" Q ; NOT A VALID ACTOR
. S AOID=$P(@ALST@(I),"^",1) ; ACTOR OBJECT ID
. S ATYP=$P(@ALST@(I),"^",2) ; ACTOR TYPE
. S AIEN=$P(@ALST@(I),"^",3) ; ACTOR RECORD NUMBER
. I ATYP="" Q ; NOT A VALID ACTOR
. ;
2008-07-05 19:57:32 -04:00
. W AOID_" "_ATYP_" "_AIEN,!
2008-07-05 11:49:50 -04:00
. I ATYP="PATIENT" D ; PATIENT ACTOR TYPE
. . D QUERY^GPLXPATH(IPXML,"//Actors/ACTOR-PATIENT","ATMP")
. . D PATIENT("ATMP",@ALST@(I),"ATMP2")
. ;
2008-07-05 11:49:50 -04:00
. I ATYP="SYSTEM" D ; SYSTEM ACTOR TYPE
. . D QUERY^GPLXPATH(IPXML,"//Actors/ACTOR-SYSTEM","ATMP")
. . D SYSTEM("ATMP",@ALST@(I),"ATMP2")
. ;
2008-07-05 11:49:50 -04:00
. I ATYP="NOK" D ; NOK ACTOR TYPE
. . D QUERY^GPLXPATH(IPXML,"//Actors/ACTOR-NOK","ATMP")
. . D NOK("ATMP",@ALST@(I),"ATMP2")
. ;
. I ATYP="PROVIDER" D ; PROVIDER ACTOR TYPE
. . D QUERY^GPLXPATH(IPXML,"//Actors/ACTOR-PROVIDER","ATMP")
. . D PROVIDER("ATMP",@ALST@(I),"ATMP2")
. ;
. I ATYP="ORGANIZATION" D ; PROVIDER ACTOR TYPE
. . D QUERY^GPLXPATH(IPXML,"//Actors/ACTOR-ORG","ATMP")
. . D ORG("ATMP",@ALST@(I),"ATMP2")
. ;
2008-07-05 19:57:32 -04:00
. D INSINNER^GPLXPATH(AXML,"ATMP2") ; INSERT INTO ROOT
;
2008-07-05 19:57:32 -04:00
D MISSING^GPLXPATH(AXML,"ACTTMP") ; SEARCH XML FOR MISSING VARS
2008-07-05 11:49:50 -04:00
I ACTTMP(0)>0 D ; IF THERE ARE MISSING VARS -
. ; STRINGS MARKED AS @@X@@
. W "ACTORS Missing list: ",!
. F I=1:1:ACTTMP(0) W ACTTMP(I),!
Q
;
2008-07-05 11:49:50 -04:00
PATIENT(INXML,ACTREC,OUTXML) ; PROCESS A PATIENT ACTOR
;
2008-07-05 19:57:32 -04:00
W "PROCESSING ACTOR PATIENT ",ACTREC,!
; N AMAP
S AMAP=$NA(^TMP($J,"AMAP"))
D INIT^CCRDPT(AIEN)
2008-07-05 11:49:50 -04:00
S @AMAP@("ACTOROBJECTID")=AOID ;ACTOR OBJECT ID
S @AMAP@("ACTORGIVENNAME")=$$GIVEN^CCRDPT
S @AMAP@("ACTORMIDDLENAME")=$$MIDDLE^CCRDPT
S @AMAP@("ACTORFAMILYNAME")=$$FAMILY^CCRDPT
S @AMAP@("ACTORDATEOFBIRTH")=$$DOB^CCRDPT
S @AMAP@("ACTORGENDER")=$$GENDER^CCRDPT
S @AMAP@("ACTORSSN")=$$SSN^CCRDPT
S @AMAP@("ACTORSSNSOURCEID")=AOID
S @AMAP@("ACTORADDRESSTYPE")=$$ADDRTYPE^CCRDPT
S @AMAP@("ACTORADDRESSLINE1")=$$ADDR1^CCRDPT
S @AMAP@("ACTORADDRESSLINE2")=$$ADDR2^CCRDPT
S @AMAP@("ACTORADDRESSCITY")=$$CITY^CCRDPT
S @AMAP@("ACTORADDRESSSTATE")=$$STATE^CCRDPT
S @AMAP@("ACTORADDRESSZIPCODE")=$$ZIP^CCRDPT
S @AMAP@("ACTORRESTEL")=$$RESTEL^CCRDPT
S @AMAP@("ACTORWORKTEL")=$$WORKTEL^CCRDPT
S @AMAP@("ACTORCELLTEL")=$$CELLTEL^CCRDPT
S @AMAP@("ACTOREMAIL")=$$EMAIL^CCRDPT
S @AMAP@("ACTORADDRESSSOURCEID")=AOID
D DESTROY^CCRDPT
2008-07-05 11:49:50 -04:00
D MAP^GPLXPATH(INXML,AMAP,OUTXML) ; MAP THE VARIABLE
Q
;
SYSTEM(INXML,ACTREC,OUTXML) ; PROCESS A SYSTEM ACTOR
;
2008-07-05 19:57:32 -04:00
; N AMAP
S AMAP=$NA(^TMP($J,"AMAP"))
2008-07-05 11:49:50 -04:00
S @AMAP@("ACTOROBJECTID")=AOID ;ACTOR OBJECT ID
S @AMAP@("ACTORINFOSYSNAME")=$$SYSNAME^CCRSYS
S @AMAP@("ACTORINFOSYSVER")=$$SYSVER^CCRSYS
S @AMAP@("ACTORINFOSYSSOURCEID")=AOID
2008-07-05 11:49:50 -04:00
D MAP^GPLXPATH(INXML,AMAP,OUTXML) ; MAP THE VARIABLE
Q
;
NOK(INXML,ACTREC,OUTXML) ; PROCESS A NEXT OF KIN TYPE ACTOR
;
2008-07-05 19:57:32 -04:00
; N AMAP
S AMAP=$NA(^TMP($J,"AMAP"))
2008-07-05 11:49:50 -04:00
S @AMAP@("ACTOROBJECTID")=AOID ;ACTOR OBJECT ID
S @AMAP@("ACTORDISPLAYNAME")=""
S @AMAP@("ACTORRELATION")=""
S @AMAP@("ACTORRELATIONSOURCEID")=""
D MAP^GPLXPATH(INXML,AMAP,OUTXML) ; MAP THE VARIABLE
Q
;
ORG(INXML,ACTREC,OUTXML) ; PROCESS AN ORGANIZATION TYPE ACTOR
;
; N AMAP
S AMAP=$NA(^TMP($J,"AMAP"))
S @AMAP@("ACTOROBJECTID")=AOID ;ACTOR OBJECT ID
S @AMAP@("ORGANIZATIONNAME")="WORLDVISTA EHR CLINIC"
S @AMAP@("ACTORSOURCEID")="ACTORSYSTEM_1"
D MAP^GPLXPATH(INXML,AMAP,OUTXML) ; MAP THE VARIABLE
Q
;
2008-07-05 11:49:50 -04:00
PROVIDER(INXML,ACTREC,OUTXML) ; PROCESS A PROVIDER TYPE ACTOR
;
2008-07-05 19:57:32 -04:00
; N AMAP
S AMAP=$NA(^TMP($J,"AMAP"))
2008-07-05 11:49:50 -04:00
S @AMAP@("ACTOROBJECTID")=AOID ;ACTOR OBJECT ID
S @AMAP@("ACTORGIVENNAME")=$$GIVEN^CCRVA200(AIEN)
S @AMAP@("ACTORMIDDLENAME")=$$MIDDLE^CCRVA200(AIEN)
S @AMAP@("ACTORFAMILYNAME")=$$FAMILY^CCRVA200(AIEN)
S @AMAP@("ACTORTITLE")=$$TITLE^CCRVA200(AIEN)
S @AMAP@("IDTYPE")=$P($$NPI^CCRVA200(AIEN),U,1)
S @AMAP@("ID")=$P($$NPI^CCRVA200(AIEN),U,2)
S @AMAP@("IDDESC")=$P($$NPI^CCRVA200(AIEN),U,3)
S @AMAP@("ACTORSPECIALITY")=$$SPEC^CCRVA200(AIEN)
S @AMAP@("ACTORADDRESSTYPE")=$$ADDTYPE^CCRVA200(AIEN)
S @AMAP@("ACTORADDRESSLINE1")=$$ADDLINE1^CCRVA200(AIEN)
S @AMAP@("ACTORADDRESSCITY")=$$CITY^CCRVA200(AIEN)
S @AMAP@("ACTORADDRESSSTATE")=$$STATE^CCRVA200(AIEN)
S @AMAP@("ACTORPOSTALCODE")=$$POSTCODE^CCRVA200(AIEN)
S @AMAP@("ACTORTELEPHONE")=$$TEL^CCRVA200(AIEN)
S @AMAP@("ACTORTELEPHONETYPE")=$$TELTYPE^CCRVA200(AIEN)
S @AMAP@("ACTOREMAIL")=$$EMAIL^CCRVA200(AIEN)
S @AMAP@("ACTORADDRESSSOURCEID")="ACTORSYSTEM_1"
2008-07-05 11:49:50 -04:00
D MAP^GPLXPATH(INXML,AMAP,OUTXML) ; MAP THE VARIABLE
Q
;