reorganizing MXML routines
This commit is contained in:
parent
768f3a32e1
commit
fcc97c8411
116
p/C0CMCCD.m
116
p/C0CMCCD.m
|
@ -19,78 +19,6 @@ C0CMCCD ; GPL - MXML based CCD utilities;12/04/09 17:05
|
|||
;
|
||||
Q
|
||||
;
|
||||
TEST ;
|
||||
S C0CXMLIN=$NA(^TMP("C0CMXML",$J))
|
||||
K GARY
|
||||
W $$FTG^%ZISH("/home/vademo2/EHR/p/","mxml-test.xml",$NA(@C0CXMLIN@(1)),3)
|
||||
S C0CDOCID=$$PARSE(C0CXMLIN) W !,"DocID: ",C0CDOCID
|
||||
S REDUX="//ContinuityOfCareRecord/Body"
|
||||
D XPATH(1,"/","GIDX","GARY",,REDUX)
|
||||
Q
|
||||
;
|
||||
TEST2 ;
|
||||
S REDUX="//soap:Envelope/soap:Body/GetPatientFullMedicationHistory5Response/GetPatientFullMedicationHistory5Result/patientDrugDetail"
|
||||
D XPATH(1,"/","GIDX","GARY","",REDUX)
|
||||
Q
|
||||
;
|
||||
TEST3
|
||||
S C0CXMLIN=$NA(^TMP("C0CMXML",$J))
|
||||
K GARY,GTMP,GIDX
|
||||
K @C0CXMLIN
|
||||
W $$FTG^%ZISH("/home/vademo2/CCR/","SampleCCDDocument.xml",$NA(@C0CXMLIN@(1)),3)
|
||||
D CLEANARY("GTMP",C0CXMLIN) ; REMOVE CONTROL CHARACTERS
|
||||
K @C0CXMLIN
|
||||
M @C0CXMLIN=GTMP
|
||||
K GTMP
|
||||
D STRIPTXT("GTMP",C0CXMLIN)
|
||||
K @C0CXMLIN
|
||||
M @C0CXMLIN=GTMP
|
||||
K GTMP
|
||||
S C0CDOCID=$$PARSCCD(C0CXMLIN,"W") W !,"DocID: ",C0CDOCID
|
||||
S REDUX="//ClinicalDocument/component/structuredBody"
|
||||
D FINDTID ; FIND THE TEMPLATE IDS
|
||||
D FINDALT ; FIND ALTERNATE TAGS
|
||||
D SETCBK ; SET THE CALLBACK ROUTINE FOR TAGS
|
||||
D XPATH(1,"/","GIDX","GARY",,REDUX)
|
||||
K C0CCBK("TAG")
|
||||
D SEPARATE("GARY2","GARY") ; SEPARATE FOR EASIER BROWSING
|
||||
;S C0CDOCID=$$PARSE(C0CXMLIN) W !,"DOCID: ",C0CDOCID ;CALL REGULAR PARSER
|
||||
;D XPATH(1,"/","GIDX2","GARY2",,REDUX)
|
||||
Q
|
||||
;
|
||||
TEST4 ; TEST OF OUTPUTING AN XML FILE FROM THE DOM .. this one is the CCR
|
||||
;
|
||||
D TEST ; SET UP THE DOM
|
||||
D START^C0CMXMLB($$TAG(1),,"G")
|
||||
D NDOUT($$FIRST(1))
|
||||
D END^C0CMXMLB ;END THE DOCUMENT
|
||||
M ZCCR=^TMP("MXMLBLD",$J)
|
||||
ZWR ZCCR
|
||||
Q
|
||||
;
|
||||
TEST5 ; SAME AS TEST4, BUT THIS TIME THE CCD
|
||||
S C0CXMLIN=$NA(^TMP("C0CMXML",$J))
|
||||
K GARY,GTMP,GIDX
|
||||
K @C0CXMLIN
|
||||
W $$FTG^%ZISH("/home/vademo2/CCR/","SampleCCDDocument.xml",$NA(@C0CXMLIN@(1)),3)
|
||||
D CLEANARY("GTMP",C0CXMLIN) ; REMOVE CONTROL CHARACTERS
|
||||
K @C0CXMLIN
|
||||
M @C0CXMLIN=GTMP
|
||||
K GTMP
|
||||
D STRIPTXT("GTMP",C0CXMLIN)
|
||||
K @C0CXMLIN
|
||||
M @C0CXMLIN=GTMP
|
||||
K GTMP
|
||||
S C0CDOCID=$$PARSE(C0CXMLIN) W !,"DOCID: ",C0CDOCID ;CALL REGULAR PARSER
|
||||
;D XPATH(1,"/","GIDX2","GARY2",,REDUX)
|
||||
D OUTXML("ZCCD",C0CDOCID)
|
||||
;D START^C0CMXMLB($$TAG(1),,"G")
|
||||
;D NDOUT($$FIRST(1))
|
||||
;D END^C0CMXMLB ;END THE DOCUMENT
|
||||
;M ZCCD=^TMP("MXMLBLD",$J)
|
||||
ZWR ZCCD(1:30)
|
||||
Q
|
||||
;
|
||||
PARSCCD(DOC,OPTION) ; THIS WAS COPIED FROM EN^MXMLDOM TO CUSTIMIZE FOR
|
||||
; PROCESSING CCDS
|
||||
N CBK,SUCCESS,LEVEL,NODE,HANDLE
|
||||
|
@ -99,7 +27,7 @@ PARSCCD(DOC,OPTION) ; THIS WAS COPIED FROM EN^MXMLDOM TO CUSTIMIZE FOR
|
|||
E Q 0
|
||||
S HANDLE=$O(^TMP("MXMLDOM",$J,""),-1)+1,^(HANDLE)=""
|
||||
L -^TMP("MXMLDOM",$J)
|
||||
S CBK("STARTELEMENT")="STARTELE^C0CMXML" ; ONLY THIS ONE IS CHANGED ;GPL
|
||||
S CBK("STARTELEMENT")="STARTELE^C0CMCCD" ; ONLY THIS ONE IS CHANGED ;GPL
|
||||
S CBK("ENDELEMENT")="ENDELE^MXMLDOM"
|
||||
S CBK("COMMENT")="COMMENT^MXMLDOM"
|
||||
S CBK("CHARACTERS")="CHAR^MXMLDOM"
|
||||
|
@ -129,6 +57,44 @@ STARTELE(ELE,ATTR) ; COPIED FROM STARTELE^MXMLDOM AND MODIFIED TO TREAT
|
|||
. D ENDELE^MXMLDOM(ELE) ; POP BACK UP A LEVEL
|
||||
Q
|
||||
;
|
||||
ISMULT(ZOID) ; RETURN TRUE IF ZOID IS ONE OF A MULTIPLE
|
||||
N ZN
|
||||
;I $$TAG(ZOID)["entry" B
|
||||
S ZN=$$NXTSIB(ZOID)
|
||||
I ZN'="" Q $$TAG(ZOID)=$$TAG(ZN) ; IF TAG IS THE SAME AS NEXT SIB TAG
|
||||
Q 0
|
||||
;
|
||||
FIRST(ZOID) ;RETURNS THE OID OF THE FIRST CHILD OF ZOID
|
||||
Q $$CHILD^MXMLDOM(C0CDOCID,ZOID)
|
||||
;
|
||||
PARENT(ZOID) ;RETURNS THE OID OF THE PARENT OF ZOID
|
||||
Q $$PARENT^MXMLDOM(C0CDOCID,ZOID)
|
||||
;
|
||||
ATT(RTN,NODE) ;GET ATTRIBUTES FOR ZOID
|
||||
S HANDLE=C0CDOCID
|
||||
K @RTN
|
||||
D GETTXT^MXMLDOM("A")
|
||||
Q
|
||||
;
|
||||
TAG(ZOID) ; RETURNS THE XML TAG FOR THE NODE
|
||||
;I ZOID=149 B ;GPLTEST
|
||||
N X,Y
|
||||
S Y=""
|
||||
S X=$G(C0CCBK("TAG")) ;IS THERE A CALLBACK FOR THIS ROUTINE
|
||||
I X'="" X X ; EXECUTE THE CALLBACK, SHOULD SET Y
|
||||
I Y="" S Y=$$NAME^MXMLDOM(C0CDOCID,ZOID)
|
||||
Q Y
|
||||
;
|
||||
NXTSIB(ZOID) ; RETURNS THE NEXT SIBLING
|
||||
Q $$SIBLING^MXMLDOM(C0CDOCID,ZOID)
|
||||
;
|
||||
DATA(ZT,ZOID) ; RETURNS DATA FOR THE NODE
|
||||
;N ZT,ZN S ZT=""
|
||||
;S C0CDOM=$NA(^TMP("MXMLDOM",$J,C0CDOCID))
|
||||
;Q $G(@C0CDOM@(ZOID,"T",1))
|
||||
S ZN=$$TEXT^MXMLDOM(C0CDOCID,ZOID,ZT)
|
||||
Q
|
||||
;
|
||||
CLEANARY(OUTARY,INARY) ; GOES THROUGH AN ARRAY AND CALLS CLEAN ON EACH NODE
|
||||
; INARY AND OUTARY PASSED BY NAME
|
||||
N ZI S ZI=""
|
||||
|
@ -246,11 +212,11 @@ ALTTAG(NODE) ; SET Y EQUAL TO THE ALT TAG FOUND IN C0CTAGS IF NODE IF FOUND
|
|||
Q
|
||||
;
|
||||
SETCBK ; SET THE TAG CALLBACK FOR XPATH PROCESSSING OF THE CCD
|
||||
S C0CCBK("TAG")="D ALTTAG(ZOID)"
|
||||
S C0CCBK("TAG")="D ALTTAG^C0CMCCD(ZOID)"
|
||||
Q
|
||||
;
|
||||
OUTCCD ; OUTPUT THE PARSED CCD TO A TEXT FILE
|
||||
D TEST3
|
||||
D TEST3^C0CMXML
|
||||
N ZT S ZT=$NA(^TMP("CCDOUT",$J))
|
||||
N ZI,ZJ
|
||||
S ZI=1 S ZJ=""
|
||||
|
|
20
p/C0CMXML.m
20
p/C0CMXML.m
|
@ -42,22 +42,22 @@ TEST3
|
|||
K GARY,GTMP,GIDX
|
||||
K @C0CXMLIN
|
||||
W $$FTG^%ZISH("/home/vademo2/CCR/","SampleCCDDocument.xml",$NA(@C0CXMLIN@(1)),3)
|
||||
D CLEANARY("GTMP",C0CXMLIN) ; REMOVE CONTROL CHARACTERS
|
||||
D CLEANARY^C0CMCCD("GTMP",C0CXMLIN) ; REMOVE CONTROL CHARACTERS
|
||||
K @C0CXMLIN
|
||||
M @C0CXMLIN=GTMP
|
||||
K GTMP
|
||||
D STRIPTXT("GTMP",C0CXMLIN)
|
||||
D STRIPTXT^C0CMCCD("GTMP",C0CXMLIN)
|
||||
K @C0CXMLIN
|
||||
M @C0CXMLIN=GTMP
|
||||
K GTMP
|
||||
S C0CDOCID=$$PARSCCD(C0CXMLIN,"W") W !,"DocID: ",C0CDOCID
|
||||
S C0CDOCID=$$PARSCCD^C0CMCCD(C0CXMLIN,"W") W !,"DocID: ",C0CDOCID
|
||||
S REDUX="//ClinicalDocument/component/structuredBody"
|
||||
D FINDTID ; FIND THE TEMPLATE IDS
|
||||
D FINDALT ; FIND ALTERNATE TAGS
|
||||
D SETCBK ; SET THE CALLBACK ROUTINE FOR TAGS
|
||||
D FINDTID^C0CMCCD ; FIND THE TEMPLATE IDS
|
||||
D FINDALT^C0CMCCD ; FIND ALTERNATE TAGS
|
||||
D SETCBK^C0CMCCD ; SET THE CALLBACK ROUTINE FOR TAGS
|
||||
D XPATH(1,"/","GIDX","GARY",,REDUX)
|
||||
K C0CCBK("TAG")
|
||||
D SEPARATE("GARY2","GARY") ; SEPARATE FOR EASIER BROWSING
|
||||
D SEPARATE^C0CMCCD("GARY2","GARY") ; SEPARATE FOR EASIER BROWSING
|
||||
;S C0CDOCID=$$PARSE(C0CXMLIN) W !,"DOCID: ",C0CDOCID ;CALL REGULAR PARSER
|
||||
;D XPATH(1,"/","GIDX2","GARY2",,REDUX)
|
||||
Q
|
||||
|
@ -77,11 +77,11 @@ TEST5 ; SAME AS TEST4, BUT THIS TIME THE CCD
|
|||
K GARY,GTMP,GIDX
|
||||
K @C0CXMLIN
|
||||
W $$FTG^%ZISH("/home/vademo2/CCR/","SampleCCDDocument.xml",$NA(@C0CXMLIN@(1)),3)
|
||||
D CLEANARY("GTMP",C0CXMLIN) ; REMOVE CONTROL CHARACTERS
|
||||
D CLEANARY^C0CMCCD("GTMP",C0CXMLIN) ; REMOVE CONTROL CHARACTERS
|
||||
K @C0CXMLIN
|
||||
M @C0CXMLIN=GTMP
|
||||
K GTMP
|
||||
D STRIPTXT("GTMP",C0CXMLIN)
|
||||
D STRIPTXT^C0CMCCD("GTMP",C0CXMLIN)
|
||||
K @C0CXMLIN
|
||||
M @C0CXMLIN=GTMP
|
||||
K GTMP
|
||||
|
@ -90,7 +90,7 @@ TEST5 ; SAME AS TEST4, BUT THIS TIME THE CCD
|
|||
D OUTXML("ZCCD",C0CDOCID)
|
||||
;D START^C0CMXMLB($$TAG(1),,"G")
|
||||
;D NDOUT($$FIRST(1))
|
||||
;D END^C0CMXMLB ;END THE DOCUMENT
|
||||
;D END^C0CMXMLB ;EOND THE DOCUMENT
|
||||
;M ZCCD=^TMP("MXMLBLD",$J)
|
||||
ZWR ZCCD(1:30)
|
||||
Q
|
||||
|
|
72
p/C0CMXP.m
72
p/C0CMXP.m
|
@ -19,78 +19,6 @@ C0CMXP ; GPL - MXML based XPath utilities;12/04/09 17:05
|
|||
;
|
||||
Q
|
||||
;
|
||||
TEST ;
|
||||
S C0CXMLIN=$NA(^TMP("C0CMXML",$J))
|
||||
K GARY
|
||||
W $$FTG^%ZISH("/home/vademo2/EHR/p/","mxml-test.xml",$NA(@C0CXMLIN@(1)),3)
|
||||
S C0CDOCID=$$PARSE(C0CXMLIN) W !,"DocID: ",C0CDOCID
|
||||
S REDUX="//ContinuityOfCareRecord/Body"
|
||||
D XPATH(1,"/","GIDX","GARY",,REDUX)
|
||||
Q
|
||||
;
|
||||
TEST2 ;
|
||||
S REDUX="//soap:Envelope/soap:Body/GetPatientFullMedicationHistory5Response/GetPatientFullMedicationHistory5Result/patientDrugDetail"
|
||||
D XPATH(1,"/","GIDX","GARY","",REDUX)
|
||||
Q
|
||||
;
|
||||
TEST3
|
||||
S C0CXMLIN=$NA(^TMP("C0CMXML",$J))
|
||||
K GARY,GTMP,GIDX
|
||||
K @C0CXMLIN
|
||||
W $$FTG^%ZISH("/home/vademo2/CCR/","SampleCCDDocument.xml",$NA(@C0CXMLIN@(1)),3)
|
||||
D CLEANARY("GTMP",C0CXMLIN) ; REMOVE CONTROL CHARACTERS
|
||||
K @C0CXMLIN
|
||||
M @C0CXMLIN=GTMP
|
||||
K GTMP
|
||||
D STRIPTXT("GTMP",C0CXMLIN)
|
||||
K @C0CXMLIN
|
||||
M @C0CXMLIN=GTMP
|
||||
K GTMP
|
||||
S C0CDOCID=$$PARSCCD(C0CXMLIN,"W") W !,"DocID: ",C0CDOCID
|
||||
S REDUX="//ClinicalDocument/component/structuredBody"
|
||||
D FINDTID ; FIND THE TEMPLATE IDS
|
||||
D FINDALT ; FIND ALTERNATE TAGS
|
||||
D SETCBK ; SET THE CALLBACK ROUTINE FOR TAGS
|
||||
D XPATH(1,"/","GIDX","GARY",,REDUX)
|
||||
K C0CCBK("TAG")
|
||||
D SEPARATE("GARY2","GARY") ; SEPARATE FOR EASIER BROWSING
|
||||
;S C0CDOCID=$$PARSE(C0CXMLIN) W !,"DOCID: ",C0CDOCID ;CALL REGULAR PARSER
|
||||
;D XPATH(1,"/","GIDX2","GARY2",,REDUX)
|
||||
Q
|
||||
;
|
||||
TEST4 ; TEST OF OUTPUTING AN XML FILE FROM THE DOM .. this one is the CCR
|
||||
;
|
||||
D TEST ; SET UP THE DOM
|
||||
D START^C0CMXMLB($$TAG(1),,"G")
|
||||
D NDOUT($$FIRST(1))
|
||||
D END^C0CMXMLB ;END THE DOCUMENT
|
||||
M ZCCR=^TMP("MXMLBLD",$J)
|
||||
ZWR ZCCR
|
||||
Q
|
||||
;
|
||||
TEST5 ; SAME AS TEST4, BUT THIS TIME THE CCD
|
||||
S C0CXMLIN=$NA(^TMP("C0CMXML",$J))
|
||||
K GARY,GTMP,GIDX
|
||||
K @C0CXMLIN
|
||||
W $$FTG^%ZISH("/home/vademo2/CCR/","SampleCCDDocument.xml",$NA(@C0CXMLIN@(1)),3)
|
||||
D CLEANARY("GTMP",C0CXMLIN) ; REMOVE CONTROL CHARACTERS
|
||||
K @C0CXMLIN
|
||||
M @C0CXMLIN=GTMP
|
||||
K GTMP
|
||||
D STRIPTXT("GTMP",C0CXMLIN)
|
||||
K @C0CXMLIN
|
||||
M @C0CXMLIN=GTMP
|
||||
K GTMP
|
||||
S C0CDOCID=$$PARSE(C0CXMLIN) W !,"DOCID: ",C0CDOCID ;CALL REGULAR PARSER
|
||||
;D XPATH(1,"/","GIDX2","GARY2",,REDUX)
|
||||
D OUTXML("ZCCD",C0CDOCID)
|
||||
;D START^C0CMXMLB($$TAG(1),,"G")
|
||||
;D NDOUT($$FIRST(1))
|
||||
;D END^C0CMXMLB ;END THE DOCUMENT
|
||||
;M ZCCD=^TMP("MXMLBLD",$J)
|
||||
ZWR ZCCD(1:30)
|
||||
Q
|
||||
;
|
||||
MKTPLATE(INXML,OUTT) ;MAKE A TEMPLATE FROM INXML, RETURNED IN OUTT
|
||||
; BOTH PASSED BY NAME
|
||||
;
|
||||
|
|
Loading…
Reference in New Issue