Changeset 308 for ccr/trunk/p/GPLRIMA.m


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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.