some new RNF processing tools
This commit is contained in:
parent
eeacfa8f09
commit
232bf48292
21
p/C0CDIC.m
21
p/C0CDIC.m
|
@ -21,6 +21,25 @@ C0CDIC ; CCDCCR/GPL - CCR Dictionary utilities; 6/1/08
|
|||
W !
|
||||
Q
|
||||
;
|
||||
DIC2CSV ;OUTPUT THE CCR DICTIONARY TO A CSV FILE
|
||||
;
|
||||
N ZI
|
||||
S ZI=""
|
||||
S G1=$NA(^TMP($J,"C0CCSV",1))
|
||||
S G1A=$NA(@G1@("V"))
|
||||
S G2=$NA(^TMP($J,"C0CCSV",2))
|
||||
D GETN2^C0CRNF(G1,170) ; GET THE MATRIX
|
||||
F S ZI=$O(@G1A@(ZI)) Q:ZI="" D ;FOR EACH ROW IN THE MATRIX
|
||||
. I $G(@G1A@(ZI,"MAPPING METHOD",1))'="" D ;
|
||||
. . W @G1A@(ZI,"MAPPING METHOD",1),!
|
||||
. . ;K @G1A@(ZI,"MAPPING METHOD")
|
||||
. ;W !,ZI,$G(@G1A@(ZI,"MAPPING METHOD",1))
|
||||
D RNF2CSV^C0CRNF(G2,G1,"VN") ; PREPARE THE CVS FILE
|
||||
K @G1
|
||||
D FILEOUT^C0CRNF(G2,"FILE_"_170_".csv")
|
||||
K @G2
|
||||
Q
|
||||
;
|
||||
GVARS(C0CVARS,C0CT) ; Get the CCR variables from the CCR template
|
||||
; and return them in C0CVARS, which is passed by name
|
||||
; FIRST PIECE OF C0CVARS(x) IS THE VARIABLE NAME, SECOND PIECE
|
||||
|
@ -185,4 +204,4 @@ ZVALUE(ZFN,ZTAB) ;EXTRINSIC TO RETURN VALUE FOR FIELD NAME PASSED
|
|||
; IF ZTAB IS NULL, IT DEFAULTS TO C0CA
|
||||
I '$D(ZTAB) S ZTAB="C0CA"
|
||||
Q $P(@ZTAB@(ZFN),"^",3)
|
||||
;
|
||||
;
|
||||
|
|
51
p/C0CRNF.m
51
p/C0CRNF.m
|
@ -259,7 +259,7 @@ NV(RNRTN,RNIN) ;
|
|||
F S RNI=$O(@RNC@(RNI)) Q:RNI="" D ; FOR EACH COLUMN
|
||||
. S RNX=RNX_RNI_"," ;ADD THE COLUMM ELEMENT AND A COMMA
|
||||
S RNX=$E(RNX,1,$L(RNX)-1) ; STRIP OFF THE LAST COMMA
|
||||
D PUSH^GPLXPATH(RNRTN,RNX) ; FIRST LINE CONTAINS COLUMN HEADINGS
|
||||
D PUSH^C0CXPATH(RNRTN,RNX) ; FIRST LINE CONTAINS COLUMN HEADINGS
|
||||
S RNI=""
|
||||
F S RNI=$O(@RNR@(RNI)) Q:RNI="" D ; FOR EACH ROW
|
||||
. S RNX=""""_RNI_""""_"," ; FIRST ELEMENT ON ROW IS THE FIELD
|
||||
|
@ -269,7 +269,7 @@ NV(RNRTN,RNIN) ;
|
|||
. . . S RNX=RNX_""""_@RNC@(RNJ,RNI,1)_""""_"," ; ADD THE ELEMENT PLUS A COMMA
|
||||
. . E S RNX=RNX_"," ; NUL COLUMN
|
||||
. S RNX=$E(RNX,1,$L(RNX)-1) ; STRIP OFF THE LAST COMMA
|
||||
. D PUSH^GPLXPATH(RNRTN,RNX)
|
||||
. D PUSH^C0CXPATH(RNRTN,RNX)
|
||||
Q
|
||||
;
|
||||
VN(RNRTN,RNIN) ;
|
||||
|
@ -281,7 +281,7 @@ VN(RNRTN,RNIN) ;
|
|||
F S RNI=$O(@RNC@(RNI)) Q:RNI="" D ; FOR EACH COLUMN
|
||||
. S RNX=RNX_RNI_"," ;ADD THE COLUMM ELEMENT AND A COMMA
|
||||
S RNX=$E(RNX,1,$L(RNX)-1) ; STRIP OFF THE LAST COMMA
|
||||
D PUSH^GPLXPATH(RNRTN,RNX) ; FIRST LINE CONTAINS COLUMN HEADINGS
|
||||
D PUSH^C0CXPATH(RNRTN,RNX) ; FIRST LINE CONTAINS COLUMN HEADINGS
|
||||
S RNI=""
|
||||
F S RNI=$O(@RNR@(RNI)) Q:RNI="" D ; FOR EACH ROW
|
||||
. S RNX=""""_RNI_""""_"," ; FIRST ELEMENT ON ROW IS THE FIELD
|
||||
|
@ -291,7 +291,7 @@ VN(RNRTN,RNIN) ;
|
|||
. . . S RNX=RNX_""""_@RNR@(RNI,RNJ,1)_""""_"," ; ADD THE ELEMENT PLUS A COMMA
|
||||
. . E S RNX=RNX_"," ; NUL COLUMN
|
||||
. S RNX=$E(RNX,1,$L(RNX)-1) ; STRIP OFF THE LAST COMMA
|
||||
. D PUSH^GPLXPATH(RNRTN,RNX)
|
||||
. D PUSH^C0CXPATH(RNRTN,RNX)
|
||||
Q
|
||||
;
|
||||
READCSV(PATH,NAME,GLB) ; READ A CSV FILE IN FROM UNIX TO GLB, PASSED BY NAME
|
||||
|
@ -313,7 +313,7 @@ FILE2CSV(FNUM,FVN) ; WRITES OUT A FILEMAN FILE TO CSV
|
|||
;
|
||||
FILEOUT(FOARY,FONAM) ; WRITE OUT A FILE
|
||||
;
|
||||
W $$OUTPUT^GPLXPATH($NA(@FOARY@(1)),FONAM,^TMP("GPLCCR","ODIR"))
|
||||
W $$OUTPUT^C0CXPATH($NA(@FOARY@(1)),FONAM,^TMP("GPLCCR","ODIR"))
|
||||
Q
|
||||
;
|
||||
FILEREF(FNUM) ; EXTRINSIC THAT RETURNS A CLOSED ROOT FOR FILE NUMBER FNUM
|
||||
|
@ -335,6 +335,47 @@ SKIP ;
|
|||
. Q
|
||||
Q
|
||||
;
|
||||
RNF2HNV(ZOUT,ZIN) ;RETURN AN HTML TABLE IN ZOUT, PASSED BY NAME
|
||||
; OF ZIN, WHICH IS PASSED BY NAME AND IS IN RNF2 FORMAT
|
||||
; ZOUT IS NOT INITIALIZED, SO THE TABLE WILL GO AT THE END
|
||||
; THE TABLE WILL BE IN NV FORMAT, ROWS ARE NAMES COLUMNS ARE VALUES
|
||||
D PUSH^C0CXPATH(ZOUT,"<table>")
|
||||
N ZI,ZJ,ZV,ZN S ZI="" S ZJ=0
|
||||
D PUSH^C0CXPATH(ZOUT,"<tr><td></td>") ;begin row and leave a blank col
|
||||
F S ZJ=$O(@ZIN@("V",ZJ)) Q:+ZJ=0 D ; FOR EACH OCCURANCE
|
||||
. S ZV="<td>"_ZJ_"</td>" ; OCCURANCE AS COLUMNS HEADER
|
||||
D PUSH^C0CXPATH(ZOUT,"</tr>") ;end of first row
|
||||
F S ZI=$O(@ZIN@("F",ZI)) Q:ZI="" D ; FOR EACH VARIABLE
|
||||
. S ZN="<tr><td>"_ZI_"</td>" ; VARIABLE NAME IN FIRST COLUMN
|
||||
. S ZJ=0 ;RESET TO DO IT AGAIN
|
||||
. F S ZJ=$O(@ZIN@("V",ZJ)) Q:+ZJ=0 D ; FOR EACH OCCURANCE
|
||||
. . S ZV="<td>"_$G(@ZIN@("V",ZJ,ZI,1))_"</td>"
|
||||
. . D PUSH^C0CXPATH(ZOUT,ZV)
|
||||
. D PUSH^C0CXPATH(ZOUT,"</tr>") ;END OF ROW
|
||||
D PUSH^C0CXPATH(ZOUT,"</table>") ; end of table
|
||||
Q
|
||||
;
|
||||
RNF2HVN(ZOUT,ZIN) ;RETURN AN HTML TABLE IN ZOUT, PASSED BY NAME
|
||||
; OF ZIN, WHICH IS PASSED BY NAME AND IS IN RNF2 FORMAT
|
||||
; ZOUT IS NOT INITIALIZED, SO THE TABLE WILL GO AT THE END
|
||||
; THE TABLE WILL BE IN VN FORMAT, ROWS ARE VALUES COLUMNS ARE NAMES
|
||||
D PUSH^C0CXPATH(ZOUT,"<table>")
|
||||
N ZI,ZJ S ZI="" S ZJ=0
|
||||
D PUSH^C0CXPATH(ZOUT,"<tr>") ;new row for column headers
|
||||
F S ZI=$O(@ZIN@("F",ZI)) Q:ZI="" D ; FOR EACH VARIABLE
|
||||
. S ZV="<td>"_ZI_"</td>"
|
||||
. D PUSH^C0CXPATH(ZOUT,ZV) ; name
|
||||
D PUSH^C0CXPATH(ZOUT,"</tr>") ; end header row
|
||||
S ZI="" ;RESET TO DO AGAIN
|
||||
F S ZJ=$O(@ZIN@("V",ZJ)) Q:+ZJ=0 D ; FOR EACH ROW OF VARIABLES
|
||||
. D PUSH^C0CXPATH(ZOUT,"<tr>") ;begin row
|
||||
. F S ZI=$O(@ZIN@("F",ZI)) Q:ZI="" D ; FOR EACH VARIABLE
|
||||
. . S ZV="<td>"_$G(@ZIN@("V",ZJ,ZI,1))_"</td>" ; value
|
||||
. . D PUSH^C0CXPATH(ZOUT,ZV) ; value
|
||||
. D PUSH^C0CXPATH(ZOUT,"</tr>") ; end header
|
||||
D PUSH^C0CXPATH(ZOUT,"</table>") ;end of table
|
||||
Q
|
||||
;
|
||||
ZFILE(ZFN,ZTAB) ; EXTRINSIC TO RETURN FILE NUMBER FOR FIELD NAME PASSED
|
||||
; BY VALUE IN ZFN. FILE NUMBER IS PIECE 1 OF @ZTAB@(ZFN)
|
||||
; IF ZTAB IS NULL, IT DEFAULTS TO C0CA
|
||||
|
|
Loading…
Reference in New Issue