Changeset 639


Ignore:
Timestamp:
Dec 6, 2009, 1:16:46 PM (15 years ago)
Author:
George Lilly
Message:

reorganizing MXML routines

Location:
ccr/trunk/p
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • ccr/trunk/p/C0CMCCD.m

    r630 r639  
    2020 Q
    2121 ;
    22 TEST    ;
    23  S C0CXMLIN=$NA(^TMP("C0CMXML",$J))
    24  K GARY
    25  W $$FTG^%ZISH("/home/vademo2/EHR/p/","mxml-test.xml",$NA(@C0CXMLIN@(1)),3)
    26  S C0CDOCID=$$PARSE(C0CXMLIN) W !,"DocID: ",C0CDOCID
    27  S REDUX="//ContinuityOfCareRecord/Body"
    28  D XPATH(1,"/","GIDX","GARY",,REDUX)
    29  Q
    30  ;
    31 TEST2   ;
    32  S REDUX="//soap:Envelope/soap:Body/GetPatientFullMedicationHistory5Response/GetPatientFullMedicationHistory5Result/patientDrugDetail"
    33  D XPATH(1,"/","GIDX","GARY","",REDUX)
    34  Q
    35  ;
    36 TEST3
    37  S C0CXMLIN=$NA(^TMP("C0CMXML",$J))
    38  K GARY,GTMP,GIDX
    39  K @C0CXMLIN
    40  W $$FTG^%ZISH("/home/vademo2/CCR/","SampleCCDDocument.xml",$NA(@C0CXMLIN@(1)),3)
    41  D CLEANARY("GTMP",C0CXMLIN) ; REMOVE CONTROL CHARACTERS
    42  K @C0CXMLIN
    43  M @C0CXMLIN=GTMP
    44  K GTMP
    45  D STRIPTXT("GTMP",C0CXMLIN)
    46  K @C0CXMLIN
    47  M @C0CXMLIN=GTMP
    48  K GTMP
    49  S C0CDOCID=$$PARSCCD(C0CXMLIN,"W") W !,"DocID: ",C0CDOCID
    50  S REDUX="//ClinicalDocument/component/structuredBody"
    51  D FINDTID ; FIND THE TEMPLATE IDS
    52  D FINDALT ; FIND ALTERNATE TAGS
    53  D SETCBK ; SET THE CALLBACK ROUTINE FOR TAGS
    54  D XPATH(1,"/","GIDX","GARY",,REDUX)
    55  K C0CCBK("TAG")
    56  D SEPARATE("GARY2","GARY") ; SEPARATE FOR EASIER BROWSING
    57  ;S C0CDOCID=$$PARSE(C0CXMLIN) W !,"DOCID: ",C0CDOCID  ;CALL REGULAR PARSER
    58  ;D XPATH(1,"/","GIDX2","GARY2",,REDUX)
    59  Q
    60  ;
    61 TEST4 ; TEST OF OUTPUTING AN XML FILE FROM THE DOM .. this one is the CCR
    62  ;
    63  D TEST ; SET UP THE DOM
    64  D START^C0CMXMLB($$TAG(1),,"G")
    65  D NDOUT($$FIRST(1))
    66  D END^C0CMXMLB ;END THE DOCUMENT
    67  M ZCCR=^TMP("MXMLBLD",$J)
    68  ZWR ZCCR
    69  Q
    70  ;
    71 TEST5 ; SAME AS TEST4, BUT THIS TIME THE CCD
    72  S C0CXMLIN=$NA(^TMP("C0CMXML",$J))
    73  K GARY,GTMP,GIDX
    74  K @C0CXMLIN
    75  W $$FTG^%ZISH("/home/vademo2/CCR/","SampleCCDDocument.xml",$NA(@C0CXMLIN@(1)),3)
    76  D CLEANARY("GTMP",C0CXMLIN) ; REMOVE CONTROL CHARACTERS
    77  K @C0CXMLIN
    78  M @C0CXMLIN=GTMP
    79  K GTMP
    80  D STRIPTXT("GTMP",C0CXMLIN)
    81  K @C0CXMLIN
    82  M @C0CXMLIN=GTMP
    83  K GTMP
    84  S C0CDOCID=$$PARSE(C0CXMLIN) W !,"DOCID: ",C0CDOCID  ;CALL REGULAR PARSER
    85  ;D XPATH(1,"/","GIDX2","GARY2",,REDUX)
    86  D OUTXML("ZCCD",C0CDOCID)
    87  ;D START^C0CMXMLB($$TAG(1),,"G")
    88  ;D NDOUT($$FIRST(1))
    89  ;D END^C0CMXMLB ;END THE DOCUMENT
    90  ;M ZCCD=^TMP("MXMLBLD",$J)
    91  ZWR ZCCD(1:30)
    92  Q
    93  ;
    9422PARSCCD(DOC,OPTION) ; THIS WAS COPIED FROM EN^MXMLDOM TO CUSTIMIZE FOR
    9523 ; PROCESSING CCDS
     
    10028 S HANDLE=$O(^TMP("MXMLDOM",$J,""),-1)+1,^(HANDLE)=""
    10129 L -^TMP("MXMLDOM",$J)
    102  S CBK("STARTELEMENT")="STARTELE^C0CMXML" ; ONLY THIS ONE IS CHANGED ;GPL
     30 S CBK("STARTELEMENT")="STARTELE^C0CMCCD" ; ONLY THIS ONE IS CHANGED ;GPL
    10331 S CBK("ENDELEMENT")="ENDELE^MXMLDOM"
    10432 S CBK("COMMENT")="COMMENT^MXMLDOM"
     
    13058 Q
    13159 ;
     60ISMULT(ZOID) ; RETURN TRUE IF ZOID IS ONE OF A MULTIPLE
     61 N ZN
     62 ;I $$TAG(ZOID)["entry" B
     63 S ZN=$$NXTSIB(ZOID)
     64 I ZN'="" Q $$TAG(ZOID)=$$TAG(ZN) ; IF TAG IS THE SAME AS NEXT SIB TAG
     65 Q 0
     66 ;
     67FIRST(ZOID) ;RETURNS THE OID OF THE FIRST CHILD OF ZOID
     68 Q $$CHILD^MXMLDOM(C0CDOCID,ZOID)
     69 ;
     70PARENT(ZOID) ;RETURNS THE OID OF THE PARENT OF ZOID
     71 Q $$PARENT^MXMLDOM(C0CDOCID,ZOID)
     72 ;
     73ATT(RTN,NODE) ;GET ATTRIBUTES FOR ZOID
     74 S HANDLE=C0CDOCID
     75 K @RTN
     76 D GETTXT^MXMLDOM("A")
     77 Q
     78 ;
     79TAG(ZOID) ; RETURNS THE XML TAG FOR THE NODE
     80 ;I ZOID=149 B ;GPLTEST
     81 N X,Y
     82 S Y=""
     83 S X=$G(C0CCBK("TAG")) ;IS THERE A CALLBACK FOR THIS ROUTINE
     84 I X'="" X X ; EXECUTE THE CALLBACK, SHOULD SET Y
     85 I Y="" S Y=$$NAME^MXMLDOM(C0CDOCID,ZOID)
     86 Q Y
     87 ;
     88NXTSIB(ZOID) ; RETURNS THE NEXT SIBLING
     89 Q $$SIBLING^MXMLDOM(C0CDOCID,ZOID)
     90 ;
     91DATA(ZT,ZOID) ; RETURNS DATA FOR THE NODE
     92 ;N ZT,ZN S ZT=""
     93 ;S C0CDOM=$NA(^TMP("MXMLDOM",$J,C0CDOCID))
     94 ;Q $G(@C0CDOM@(ZOID,"T",1))
     95 S ZN=$$TEXT^MXMLDOM(C0CDOCID,ZOID,ZT)
     96 Q
     97 ;
    13298CLEANARY(OUTARY,INARY) ; GOES THROUGH AN ARRAY AND CALLS CLEAN ON EACH NODE
    13399 ; INARY AND OUTARY PASSED BY NAME
     
    247213 ;
    248214SETCBK ; SET THE TAG CALLBACK FOR XPATH PROCESSSING OF THE CCD
    249  S C0CCBK("TAG")="D ALTTAG(ZOID)"
     215 S C0CCBK("TAG")="D ALTTAG^C0CMCCD(ZOID)"
    250216 Q
    251217 ;
    252218OUTCCD ; OUTPUT THE PARSED CCD TO A TEXT FILE
    253  D TEST3
     219 D TEST3^C0CMXML
    254220 N ZT S ZT=$NA(^TMP("CCDOUT",$J))
    255221 N ZI,ZJ
  • ccr/trunk/p/C0CMXML.m

    r630 r639  
    4343 K @C0CXMLIN
    4444 W $$FTG^%ZISH("/home/vademo2/CCR/","SampleCCDDocument.xml",$NA(@C0CXMLIN@(1)),3)
    45  D CLEANARY("GTMP",C0CXMLIN) ; REMOVE CONTROL CHARACTERS
    46  K @C0CXMLIN
    47  M @C0CXMLIN=GTMP
    48  K GTMP
    49  D STRIPTXT("GTMP",C0CXMLIN)
    50  K @C0CXMLIN
    51  M @C0CXMLIN=GTMP
    52  K GTMP
    53  S C0CDOCID=$$PARSCCD(C0CXMLIN,"W") W !,"DocID: ",C0CDOCID
     45 D CLEANARY^C0CMCCD("GTMP",C0CXMLIN) ; REMOVE CONTROL CHARACTERS
     46 K @C0CXMLIN
     47 M @C0CXMLIN=GTMP
     48 K GTMP
     49 D STRIPTXT^C0CMCCD("GTMP",C0CXMLIN)
     50 K @C0CXMLIN
     51 M @C0CXMLIN=GTMP
     52 K GTMP
     53 S C0CDOCID=$$PARSCCD^C0CMCCD(C0CXMLIN,"W") W !,"DocID: ",C0CDOCID
    5454 S REDUX="//ClinicalDocument/component/structuredBody"
    55  D FINDTID ; FIND THE TEMPLATE IDS
    56  D FINDALT ; FIND ALTERNATE TAGS
    57  D SETCBK ; SET THE CALLBACK ROUTINE FOR TAGS
     55 D FINDTID^C0CMCCD ; FIND THE TEMPLATE IDS
     56 D FINDALT^C0CMCCD ; FIND ALTERNATE TAGS
     57 D SETCBK^C0CMCCD ; SET THE CALLBACK ROUTINE FOR TAGS
    5858 D XPATH(1,"/","GIDX","GARY",,REDUX)
    5959 K C0CCBK("TAG")
    60  D SEPARATE("GARY2","GARY") ; SEPARATE FOR EASIER BROWSING
     60 D SEPARATE^C0CMCCD("GARY2","GARY") ; SEPARATE FOR EASIER BROWSING
    6161 ;S C0CDOCID=$$PARSE(C0CXMLIN) W !,"DOCID: ",C0CDOCID  ;CALL REGULAR PARSER
    6262 ;D XPATH(1,"/","GIDX2","GARY2",,REDUX)
     
    7878 K @C0CXMLIN
    7979 W $$FTG^%ZISH("/home/vademo2/CCR/","SampleCCDDocument.xml",$NA(@C0CXMLIN@(1)),3)
    80  D CLEANARY("GTMP",C0CXMLIN) ; REMOVE CONTROL CHARACTERS
    81  K @C0CXMLIN
    82  M @C0CXMLIN=GTMP
    83  K GTMP
    84  D STRIPTXT("GTMP",C0CXMLIN)
     80 D CLEANARY^C0CMCCD("GTMP",C0CXMLIN) ; REMOVE CONTROL CHARACTERS
     81 K @C0CXMLIN
     82 M @C0CXMLIN=GTMP
     83 K GTMP
     84 D STRIPTXT^C0CMCCD("GTMP",C0CXMLIN)
    8585 K @C0CXMLIN
    8686 M @C0CXMLIN=GTMP
     
    9191 ;D START^C0CMXMLB($$TAG(1),,"G")
    9292 ;D NDOUT($$FIRST(1))
    93  ;D END^C0CMXMLB ;END THE DOCUMENT
     93 ;D END^C0CMXMLB ;EOND THE DOCUMENT
    9494 ;M ZCCD=^TMP("MXMLBLD",$J)
    9595 ZWR ZCCD(1:30)
  • ccr/trunk/p/C0CMXP.m

    r630 r639  
    2020 Q
    2121 ;
    22 TEST    ;
    23  S C0CXMLIN=$NA(^TMP("C0CMXML",$J))
    24  K GARY
    25  W $$FTG^%ZISH("/home/vademo2/EHR/p/","mxml-test.xml",$NA(@C0CXMLIN@(1)),3)
    26  S C0CDOCID=$$PARSE(C0CXMLIN) W !,"DocID: ",C0CDOCID
    27  S REDUX="//ContinuityOfCareRecord/Body"
    28  D XPATH(1,"/","GIDX","GARY",,REDUX)
    29  Q
    30  ;
    31 TEST2   ;
    32  S REDUX="//soap:Envelope/soap:Body/GetPatientFullMedicationHistory5Response/GetPatientFullMedicationHistory5Result/patientDrugDetail"
    33  D XPATH(1,"/","GIDX","GARY","",REDUX)
    34  Q
    35  ;
    36 TEST3
    37  S C0CXMLIN=$NA(^TMP("C0CMXML",$J))
    38  K GARY,GTMP,GIDX
    39  K @C0CXMLIN
    40  W $$FTG^%ZISH("/home/vademo2/CCR/","SampleCCDDocument.xml",$NA(@C0CXMLIN@(1)),3)
    41  D CLEANARY("GTMP",C0CXMLIN) ; REMOVE CONTROL CHARACTERS
    42  K @C0CXMLIN
    43  M @C0CXMLIN=GTMP
    44  K GTMP
    45  D STRIPTXT("GTMP",C0CXMLIN)
    46  K @C0CXMLIN
    47  M @C0CXMLIN=GTMP
    48  K GTMP
    49  S C0CDOCID=$$PARSCCD(C0CXMLIN,"W") W !,"DocID: ",C0CDOCID
    50  S REDUX="//ClinicalDocument/component/structuredBody"
    51  D FINDTID ; FIND THE TEMPLATE IDS
    52  D FINDALT ; FIND ALTERNATE TAGS
    53  D SETCBK ; SET THE CALLBACK ROUTINE FOR TAGS
    54  D XPATH(1,"/","GIDX","GARY",,REDUX)
    55  K C0CCBK("TAG")
    56  D SEPARATE("GARY2","GARY") ; SEPARATE FOR EASIER BROWSING
    57  ;S C0CDOCID=$$PARSE(C0CXMLIN) W !,"DOCID: ",C0CDOCID  ;CALL REGULAR PARSER
    58  ;D XPATH(1,"/","GIDX2","GARY2",,REDUX)
    59  Q
    60  ;
    61 TEST4 ; TEST OF OUTPUTING AN XML FILE FROM THE DOM .. this one is the CCR
    62  ;
    63  D TEST ; SET UP THE DOM
    64  D START^C0CMXMLB($$TAG(1),,"G")
    65  D NDOUT($$FIRST(1))
    66  D END^C0CMXMLB ;END THE DOCUMENT
    67  M ZCCR=^TMP("MXMLBLD",$J)
    68  ZWR ZCCR
    69  Q
    70  ;
    71 TEST5 ; SAME AS TEST4, BUT THIS TIME THE CCD
    72  S C0CXMLIN=$NA(^TMP("C0CMXML",$J))
    73  K GARY,GTMP,GIDX
    74  K @C0CXMLIN
    75  W $$FTG^%ZISH("/home/vademo2/CCR/","SampleCCDDocument.xml",$NA(@C0CXMLIN@(1)),3)
    76  D CLEANARY("GTMP",C0CXMLIN) ; REMOVE CONTROL CHARACTERS
    77  K @C0CXMLIN
    78  M @C0CXMLIN=GTMP
    79  K GTMP
    80  D STRIPTXT("GTMP",C0CXMLIN)
    81  K @C0CXMLIN
    82  M @C0CXMLIN=GTMP
    83  K GTMP
    84  S C0CDOCID=$$PARSE(C0CXMLIN) W !,"DOCID: ",C0CDOCID  ;CALL REGULAR PARSER
    85  ;D XPATH(1,"/","GIDX2","GARY2",,REDUX)
    86  D OUTXML("ZCCD",C0CDOCID)
    87  ;D START^C0CMXMLB($$TAG(1),,"G")
    88  ;D NDOUT($$FIRST(1))
    89  ;D END^C0CMXMLB ;END THE DOCUMENT
    90  ;M ZCCD=^TMP("MXMLBLD",$J)
    91  ZWR ZCCD(1:30)
    92  Q
    93  ;
    9422MKTPLATE(INXML,OUTT) ;MAKE A TEMPLATE FROM INXML, RETURNED IN OUTT
    9523 ; BOTH PASSED BY NAME
Note: See TracChangeset for help on using the changeset viewer.