Changeset 308


Ignore:
Timestamp:
Dec 16, 2008, 2:10:26 PM (16 years ago)
Author:
George Lilly
Message:

new RIM2CSVGPLRIMA to output a spreadsheet of CCR/CCD/RIM variables

Location:
ccr/trunk/p
Files:
3 edited

Legend:

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

    r307 r308  
    7070 ;
    7171GETN1(GRTN,GFILE,GREF,GNDX,GNN) ; NEW GET ;GPL ; RETURN A FIELD VALUE MAP
     72 ; THE FOLLOWING COMMENTS ARE WRONG.. THIS ROUTINE STILL RETURNS AN RNF1
     73 ; FORMAT ARRAY @GRTN@("FIELD NAME")="FILE^FIELD#^VALUE" ;GPL
    7274 ; GETN IS AN EXTRINSIC WHICH RETURNS THE NEXT IEN AFTER THE CURRENT GIEN
    7375 ; GRTN, PASSED BY NAME, RETURNS A FIELD MAP AND A VALUE MAP
     
    8890 ;
    8991 N GIEN,GF
    90 
    9192 S GF=$$FILEREF(GFILE) ;CLOSED FILE REFERENCE FOR FILE NUMBER GFILE
    9293 I ('$D(GNDX))!(GNDX="") S GIEN=GREF ; IF NO INDEX USED, GREF IS THE IEN
     
    103104 S C0CREF=GIEN_"," ; OPEN ROOT REFERENCE INTO FILE
    104105 D CLEAN^DILF ; MAKE SURE WE ARE CLEANED UP
     106 K C0CTMP
    105107 D GETS^DIQ(GFILE,C0CREF,"**","","C0CTMP")
    106108 D FIELDS(GRTN,GFILE) ;GET ALL THE FIELD NAMES FOR THE FILE
     
    113115 . . S C0CNAME=$P(^DD(C0CJ,C0CI,0),"^",1) ;PULL THE FIELD NAME
    114116 . . S C0CVALUE=C0CTMP(C0CJ,C0CREF,C0CI) ;
    115  . . I C0CVALUE["C0CTMP" S C0CVALUE=C0CTMP(C0CJ,C0CREF,C0CI,1) ;1ST LINE OF WP
     117 . . I C0CVALUE["C0CTMP" D  ; WP FIELD
     118 . . . N ZT,ZWP S ZWP=0 ;ITERATOR
     119 . . . S C0CVALUE="" ; INITIALIZE
     120 . . . F  S ZWP=$O(C0CTMP(C0CJ,C0CREF,C0CI,ZWP)) Q:'ZWP  D  ;
     121 . . . . S ZT=" "_C0CTMP(C0CJ,C0CREF,C0CI,ZWP) ;LINE OF WP
     122 . . . . S ZT=$TR(ZT,"^""","|'") ;HACK TO GET RID OF ^ AND " IN TEXT "
     123 . . . . S C0CVALUE=C0CVALUE_ZT ;
    116124 . . S $P(@GRTN@(C0CNAME),"^",3)=C0CVALUE ;RETURN VALUE IN P3
    117125 I C0CNN D  ; IF ONLY NON-NULL VALUES ARE TO BE RETURNED
     
    227235 D RNF2CSV(G2,G1,FVN) ; PREPARE THE CVS FILE
    228236 K @G1
    229  W $$OUTPUT^GPLXPATH(@G2@(1),"FILE_"_FNUM_".csv",^TMP("GPLCCR","ODIR"))
     237 D FILEOUT(G2,"FILE_"_FNUM_".csv")
    230238 K @G2
     239 Q
     240 ;
     241FILEOUT(FOARY,FONAM) ; WRITE OUT A FILE
     242 ;
     243 W $$OUTPUT^GPLXPATH($NA(@FOARY@(1)),FONAM,^TMP("GPLCCR","ODIR"))
    231244 Q
    232245 ;
     
    238251 I C0CF["()" S C0CF=$P(C0CF,"()",1)
    239252 Q C0CF
     253 ;
     254SKIP ;
     255 N TXT,DIERR
     256 S TXT=$$GET1^DIQ(8925,TIUIEN,"2","","TXT")
     257 I $D(DIERR) D CLEAN^DILF Q
     258 W "  report_text:",!  ;Progress Note Text
     259 N LN S LN=0
     260 F  S LN=$O(TXT(LN)) Q:'LN  D
     261 . W "    text"_LN_": "_TXT(LN),!
     262 . Q
     263 Q
    240264 ;
    241265ZFILE(ZFN,ZTAB) ; EXTRINSIC TO RETURN FILE NUMBER FOR FIELD NAME PASSED
  • ccr/trunk/p/GPLCCR.m

    r287 r308  
    3939       S OARY=$NA(^TMP("GPLCCR",$J,DFN,"CCR",1))
    4040       S ONAM=UFN
    41        I UFN="" S ONAM="PAT_"_DFN_"_CCR_V1_0_7.xml"
     41       I UFN="" S ONAM="PAT_"_DFN_"_CCR_V1_0_10.xml"
    4242       S ODIRGLB=$NA(^TMP("GPLCCR","ODIR"))
    4343       I '$D(@ODIRGLB) D  ; IF NOT ODIR HAS BEEN SET
     
    142142    ; K @VMAP
    143143    S @VMAP@("DATETIME")=$$FMDTOUTC^CCRUTIL($$NOW^XLFDT,"DT")
    144     I IHDR="" D  ; HEADER ARRAY IS NOT PROVIDED, USE DEFAULTS
     144    ; I IHDR="" D  ; HEADER ARRAY IS NOT PROVIDED, USE DEFAULTS
     145    D  ; ALWAYS MAP THESE VARIABLES
    145146    . S @VMAP@("ACTORPATIENT")="ACTORPATIENT_"_DFN
    146147    . S @VMAP@("ACTORFROM")="ACTORORGANIZATION_"_DUZ ; FROM DUZ - ???
     
    150151    . S @VMAP@("ACTORTOTEXT")="Patient"  ; FOR TEST PURPOSES
    151152    . ; THIS IS THE USE CASE FOR THE PHR WHERE "TO" IS THE PATIENT
    152     I IHDR'="" D  ; HEADER VALUES ARE PROVIDED
    153     . D CP^GPLXPATH(IHDR,VMAP) ; COPY HEADER VARIABLES TO MAP ARRAY
     153    ;I IHDR'="" D  ; HEADER VALUES ARE PROVIDED
     154    ;. D CP^GPLXPATH(IHDR,VMAP) ; COPY HEADER VARIABLES TO MAP ARRAY
    154155    N CTMP
    155156    D MAP^GPLXPATH(CXML,VMAP,"CTMP")
    156157    D CP^GPLXPATH("CTMP",CXML)
     158    N HRIMVARS ;
     159    S HRIMVARS=$NA(^TMP("GPLRIM","VARS",DFN,"HEADER")) ; TO PERSIST VARS
     160    M @HRIMVARS@(1)=@VMAP ; PERSIST THE HEADER VARIABLES IN RIM TABLE
     161    S @HRIMVARS@(0)=1 ; ONLY ONE SET OF HEADERS PER PATIENT
    157162    Q
    158163    ;
  • ccr/trunk/p/GPLRIMA.m

    r271 r308  
    5252    . W "END OF PATIENT LIST, CALL RESET^GPLRIMA",!
    5353    F RIMI=1:1:DFNCNT  D  Q:+RIMDFN=0  ; FOR DFNCNT NUMBER OF PATIENTS OR END
     54    . K @RIMBASE@("VARS",RIMDFN) ; CLEAR OUT OLD VARS
    5455    . D CCRRPC^GPLCCR(.CCRGLO,RIMDFN,"CCR","","","") ;PROCESS THE CCR
    5556    . W RIMDFN,!
    56     . K @RIMBASE@("VARS",RIMDFN) ; CLEAR OUT OLD VARS
    5757    . ;
    5858    . ; COPY ALL THE VARIABLES TO THE RIM MAP AREA INDEXED BY PATIENT
     
    411411    N ZZGI
    412412    I WHICH="ALL" D  ; VARIABLES FROM ALL SECTIONS
    413     . F ZZGI="PROBLEMS","VITALS","MEDS","ALERTS","RESULTS" D  ; EACH SECTION
     413    . F ZZGI="HEADER","PROBLEMS","VITALS","MEDS","ALERTS","RESULTS" D  ;
    414414    . . D ZGVWRK(ZZGI) ; DO EACH SECTION
    415415    E  D ZGVWRK(WHICH) ; ONLY ONE SECTION ASKED FOR
     
    427427    . . K ZZGN2 N ZZGN2 ; NAME FOR MULTIPLE
    428428    . . S ZZGN2=$NA(@ZZGN@(ZGVI))
    429     . . ; W ZZGN2,!,$O(@ZZGN2@("")),!
     429    . . W ZZGN2,!,$O(@ZZGN2@("")),!
    430430    . . D H2ARY^GPLXPATH("ZZGA",ZZGN2,ZGVI) ; CONVERT HASH TO ARRAY
    431431    . . ; D PARY^GPLXPATH("ZZGA")
     
    435435DPATV(DFN,IWHICH) ; DISPLAY VARS FOR PATIENT DFN THAT ARE MAINTAINED IN GPLRIM
    436436    ; ALONG WITH SAMPLE VALUES.
    437     ; IWHICH IS "ALL","MEDS","VITALS","PROBLEMS","ALERTS","RESULTS"
     437    ; IWHICH IS "ALL","MEDS","VITALS","PROBLEMS","ALERTS","RESULTS","HEADER"
    438438    N GTMP
    439439    I '$D(^TMP("GPLRIM","ATTR",DFN)) D  ; RIM VARS NOT PRESENT
     
    444444    Q
    445445    ;
     446RIM2RNF(R2RTN,DFN,RWHICH) ; CONVERTS RIM VARIABLES TO RNF2 FORMAT
     447 ; RETURN IN R2RTN, WHICH IS PASSED BY NAME
     448 ; RWHICH IS RIM SECTION TO RETURN, DEFAULTS TO "ALL"
     449 ;
     450 I '$D(RWHICH) S RWHICH="ALL"
     451 ;N R2TMP
     452 I '$D(^TMP("GPLRIM","ATTR",DFN)) D  ; RIM VARS NOT PRESENT
     453 . D ANALYZE(DFN,1) ; REFRESH THE RIM VARIABLES
     454 D RPCGV(.R2TMP,DFN,RWHICH) ; RETRIEVE ALL THE VARIABLES I AN ARRAY
     455 N R2I,R2J,R2X,R2X1,R2X2,R2Y,R2Z
     456 F R2I=1:1:R2TMP(0) D  ; FOR EVERY LINE OF THE ARRAY
     457 . S R2X=$P(R2TMP(R2I),"^",1) ; OCCURANCE
     458 . S R2Y=$P(R2TMP(R2I),"^",2) ; VARIABLE NAME
     459 . I $L(R2Y)<4 Q  ; SKIP SHORT VARIABLES (THEY ARE FOR DEBUGGING)
     460 . S R2Z=$P(R2TMP(R2I),"^",3) ; VALUE
     461 . I R2X[";" D  ; THERES MULTIPLES
     462 . . S R2X1=$P(R2X,";",1) ; FIRST INDEX
     463 . . S R2X2=$P(R2X,";",2) ; SECOND INDEX
     464 . . S R2J=R2Y_"["_R2X2_"]" ; BUILD THE VARIABLE NAME
     465 . . S @R2RTN@("F",R2J,1)="" ; PUT VARIABLE NAME IN FIELD MAP
     466 . . S @R2RTN@("V",R2X1,R2J,1)=R2Z ; PUT THE VALUE IN THE ARRAY
     467 . E  D  ; NO SUB-MULTIPLES
     468 . . S @R2RTN@("F",R2Y,1)="" ; PUT VARIABLE NAME IN FIELD MAP
     469 . . S @R2RTN@("V",R2X,R2Y,1)=R2Z ; PUT THE VALUE IN THE ARRAY
     470 Q
     471 ;
     472RIM2CSV(DFN) ; WRITE THE RIM VARIABLES FOR A PATIENT TO A CSV FILE
     473 ;
     474 N R2CTMP,R2CARY
     475 D RIM2RNF("R2CTMP",DFN) ; CONVERT VARIABLES TO RNF FORMAT
     476 D RNF2CSV^C0CRNF("R2CARY","R2CTMP","NV") ; CONVERT RNF TO CSV FORMAT
     477 D FILEOUT^C0CRNF("R2CARY","VARS-"_DFN_".csv")
     478 Q
     479 ;
Note: See TracChangeset for help on using the changeset viewer.