Changeset 647 for ccr


Ignore:
Timestamp:
Dec 15, 2009, 4:41:11 PM (15 years ago)
Author:
George Lilly
Message:

template generation tools

Location:
ccr/trunk/p
Files:
3 edited

Legend:

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

    r639 r647  
    216216 Q
    217217 ;
    218 OUTCCD ; OUTPUT THE PARSED CCD TO A TEXT FILE
    219  D TEST3^C0CMXML
     218OUTCCD(GARYIN) ; OUTPUT THE PARSED CCD TO A TEXT FILE
     219 ;D TEST3^C0CMXML
    220220 N ZT S ZT=$NA(^TMP("CCDOUT",$J))
    221221 N ZI,ZJ
    222222 S ZI=1 S ZJ=""
    223223 K @ZT
    224  F  S ZJ=$O(GARY(ZJ)) Q:ZJ=""  D  ;
    225  . S @ZT@(ZI)=ZJ_"^"_GARY(ZJ)
     224 F  S ZJ=$O(GARYIN(ZJ)) Q:ZJ=""  D  ;
     225 . S @ZT@(ZI)=ZJ_"^"_GARYIN(ZJ)
    226226 . S ZI=ZI+1
    227227 S ONAME=$NA(@ZT@(1))
  • ccr/trunk/p/C0CMXML.m

    r646 r647  
    3131 S REDUX="//ContinuityOfCareRecord/Body"
    3232 D XPATH(1,"/","GIDX","GARY",,REDUX)
     33 D SEPARATE^C0CMCCD("GARY2","GARY")
     34 S ZI=""
     35 F  S ZI=$O(GARY2(ZI)) Q:ZI=""  D  ;
     36 . N GTMP,G2
     37 . M G2=GARY2(ZI)
     38 . D DEMUXARY^C0CMXP("GTMP","G2",2)
     39 . M GARY3(ZI)=GTMP
    3340 Q
    3441 ;
     
    5966 K C0CCBK("TAG")
    6067 D SEPARATE^C0CMCCD("GARY2","GARY") ; SEPARATE FOR EASIER BROWSING
    61  ;S C0CDOCID=$$PARSE(C0CXMLIN) W !,"DOCID: ",C0CDOCID  ;CALL REGULAR PARSER
    62  ;D XPATH(1,"/","GIDX2","GARY2",,REDUX)
     68 S ZI=""
     69 F  S ZI=$O(GARY2(ZI)) Q:ZI=""  D  ;
     70 . N GTMP,G2
     71 . M G2=GARY2(ZI)
     72 . D DEMUXARY^C0CMXP("GTMP","G2",2)
     73 . M GARY4(ZI)=GTMP
    6374 Q
    6475 ;
  • ccr/trunk/p/C0CMXP.m

    r646 r647  
    7777 Q
    7878 ;
    79 MKTPLATE(INXML,OUTT) ;MAKE A TEMPLATE FROM INXML, RETURNED IN OUTT
     79MKTPLATE(OUTT,INXML,REDUX) ;MAKE A TEMPLATE FROM INXML, RETURNED IN OUTT
    8080 ; BOTH PASSED BY NAME
    8181 ;
    8282 S C0CDOCID=$$PARSE^C0CMXML(INXML,"C0CMKT")
    8383 S C0CDOM=$NA(^TMP("MXMLDOM",$J,C0CDOCID))
     84 ;N GIDX,GIDX2,GARY,GARY2
     85 I '$D(REDUX) S REDUX=""
     86 D XPATH^C0CMXML(1,"/","GIDX","GARY",,REDUX)
     87 D INVERT("GIDX2","GIDX") ;MAKE ARRAY TO LOOK UP XPATH BY NODE
     88 N ZI,ZD S ZI=""
     89 F  S ZI=$O(@C0CDOM@(ZI)) Q:ZI=""  D  ; FOR EACH NODE IN THE DOM
     90 . K ZD ;FOR DATA
     91 . D DATA^C0CMXML("ZD",ZI) ;SEE IF THERE IS DATA FOR THIS NODE
     92 . I $D(ZD(1)) D  ; IF YES
     93 . . W !,ZD(1)
     94 . . K @C0CDOM@(ZI,"T") ; KILL THE DATA
     95 . . S @C0CDOM@(ZI,"T",1)="@@"_$G(GIDX2(ZI))_"@@"
     96 D OUTXML^C0CMXML(OUTT,C0CDOCID)
     97 Q
     98 ;
     99INVERT(OUTX,INX) ;INVERTS AN XPATH INDEX RETURNING @OUTX@(x)=XPath from
     100 ; @INX@(XPath)=x
    84101 N ZI S ZI=""
    85  F  S ZI=$O(@C0CDOM@(ZI)) Q:ZI=""  D  ; FOR EACH NODE IN THE DOM
    86  . W !,ZI,$$TAG^C0CMXML(ZI)
     102 F  S ZI=$O(@INX@(ZI)) Q:ZI=""  D  ;FOR EACH XPATH IN THE INPUT
     103 . S @OUTX@(@INX@(ZI))=ZI ; SET INVERTED ENTRY
    87104 Q
    88105 ;
     
    105122 Q
    106123 ;
     124DEMUXARY(OARY,IARY,DEPTH) ;CONVERT AN XPATH ARRAY PASSED AS IARY TO
     125 ; FORMAT @OARY@(x,variablename) where x is the first multiple
     126 ; IF DEPTH=2, THE LAST 2 PARTS OF THE XPATH WILL BE USED
     127 N ZI,ZJ,ZK,ZL,ZM S ZI=""
     128 F  S ZI=$O(@IARY@(ZI)) Q:ZI=""  D  ;
     129 . D DEMUX^C0CMXP("ZJ",ZI)
     130 . S ZK=$P(ZJ,"^",3)
     131 . S ZM=$RE($P($RE(ZK),"/",1))
     132 . I $G(DEPTH)=2 D  ;LAST TWO PARTS OF XPATH USED FOR THE VARIABLE NAME
     133 . . S ZM=$RE($P($RE(ZK),"/",2))_ZM
     134 . S ZL=$P(ZJ,"^",1)
     135 . I ZL="" S ZL=0
     136 . I $D(@OARY@(ZL,ZM)) D  ;IT'S A DUP
     137 . . S @OARY@(ZL,ZM_"[2]")=@IARY@(ZI)
     138 . E  S @OARY@(ZL,ZM)=@IARY@(ZI)
     139 Q
     140 ;
     141DEMUXXP1(OARY,IARY) ;IARY IS INCOMING XPATH ARRAY
     142 ; BOTH IARY AND OARY ARE PASSED BY NAME
     143 ; RETURNS A SIMPLE XPATH ARRAY WITHOUT MULTIPLES. DUPLICATES ARE REMOVED
     144 N ZI,ZJ,ZK
     145 S ZI=""
     146 F  S ZI=$O(@IARY@(ZI)) Q:ZI=""  D  ; FOR EACH XPATH IN IARY
     147 . D DEMUX^C0CMXP("ZJ",ZI)
     148 . S ZK=$P(ZJ,"^",3) ;THE XPATH
     149 . S @OARY@(ZK)=@IARY@(ZI) ;THE RESULT. DUPLICATES WILL NOT SHOW
     150 . ; CAUTION, IF THERE ARE MULTIPLES, ONLY THE DATA FOR THE LAST
     151 . ; MULTIPLE WILL BE INCLUDED IN THE OUTPUT ARRAY, ASSIGNED TO THE
     152 . ; COMMON XPATH
     153 Q
     154 ;
     155DEMUXXP2(OARY,IARY) ; IARY AND OARY ARE PASSED BY NAME
     156 ; IARY IS AN XPATH ARRAY THAT MAY CONTAIN MULTIPLES
     157 ; OARY IS THE OUTPUT ARRAY WHERE MULTIPLES ARE RETURNED IN THE FORM
     158 ; @OARY@(x,Xpath)=data or @OARY@(x,y,Xpath)=data WHERE x AND y ARE
     159 ; THE MULTIPLES AND Xpath IS THE BASE XPATH WITHOUT [x] AND [y]
     160 ;
     161 N ZI,ZJ,ZK,ZX,ZY,ZP
     162 S ZI=""
     163 F  S ZI=$O(@IARY@(ZI)) Q:ZI=""  D  ; FOR EACH INPUT XPATH
     164 . D DEMUX("ZJ",ZI) ; PULL OUT THE MULTIPLES
     165 . S ZX=$P(ZJ,"^",1) ;x
     166 . S ZY=$P(ZJ,"^",2) ;y
     167 . S ZP=$P(ZJ,"^",3) ;Xpath
     168 . I ZX="" S ZX=1 ; NO MULTIPLE WILL STORE IN x=1
     169 . I ZY'="" D  ;IS THERE A y?
     170 . . S @OARY@(ZX,ZY,ZP)=@IARY@(ZI)
     171 . E  D  ;NO y
     172 . . S @OARY@(ZX,ZP)=@IARY@(ZI)
     173 Q
     174 ;
    107175UPDIE   ; INTERNAL ROUTINE TO CALL UPDATE^DIE AND CHECK FOR ERRORS
    108176 K ZERR
Note: See TracChangeset for help on using the changeset viewer.