Changeset 112 for ccr


Ignore:
Timestamp:
Aug 29, 2008, 1:48:03 PM (16 years ago)
Author:
George Lilly
Message:

fixed indexing of vitals, still not in date order

Location:
ccr/trunk/p
Files:
3 edited

Legend:

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

    r111 r112  
    1 GPLACTORS  ; CCDCCR/GPL - CCR/CCD PROCESSING FOR ACTORS ; 7/3/08
     1GPLACTOR  ; CCDCCR/GPL - CCR/CCD PROCESSING FOR ACTORS ; 7/3/08
    22 ;;0.3;CCDCCR;nopatch;noreleasedate
    33 ;Copyright 2008 WorldVistA.  Licensed under the terms of the GNU
  • ccr/trunk/p/GPLRIMA.m

    r104 r112  
    6464    . I $D(^TMP("GPLCCR",$J,"MEDICATIONS",1)) D  ; MEDS VARS EXISTS
    6565    . . M @RIMBASE@("VARS",RIMDFN,"MEDS")=^TMP("GPLCCR",$J,"MEDICATIONS")
     66    . K ^TMP("GPLCCR",$J) ; KILL WORK AREA FOR CCR BUILDING
    6667    . ;
    6768    . ; EVALUATE THE VARIABLES AND CREATE AN ATTRIBUTE MAP
  • ccr/trunk/p/GPLVITAL.m

    r111 r112  
    1 GPLVITALS ; CCDCCR/CJE - CCR/CCD PROCESSING FOR VITALS ; 07/16/08
     1GPLVITAL ; CCDCCR/CJE - CCR/CCD PROCESSING FOR VITALS ; 07/16/08
    22          ;;0.1;CCDCCR;;JUL 16,2008;
    33          ;Copyright 2008 WorldVistA.  Licensed under the terms of the GNU
     
    2424          ;
    2525          ; VITXML AND OUTXML ARE PASSED BY NAME SO GLOBALS CAN BE USED
    26           ; IVITXML WILL CONTAIN ONLY THE VITALS SECTION OF THE OVERALL TEMPLATE
    27           ;
    28           N VITRSLT,J,K,VITPTMP,X,VITVMAP,TBUF
     26          ; IVITXML CONTAINS ONLY THE VITALS SECTION OF THE OVERALL TEMPLATE
     27          ;
     28          N VITRSLT,J,K,VITPTMP,X,VITVMAP,TBUF,VORDR
    2929          D VITALS^ORQQVI(.VITRSLT,DFN,"","")
    3030          I $P(VITRSLT(1),U,2)="No vitals found." D  ; NULL RESULT FROM RPC
     
    3636          S VITTARYTMP=$NA(^TMP("GPLCCR",$J,"VITALARYTMP"))
    3737          K @VITTVMAP,@VITTARYTMP ; KILL OLD ARRAY VALUES
    38           F J=1:1:VITRSLT(1)  D  ; FOR EACH VITAL IN THE LIST
    39           . I $D(VITRSLT(J)) D
     38          N VSORT,VCNT ; ARRAY FOR DATE SORTED VITALS INDEX
     39          S VCNT=$$VITSORT(.VSORT,.VITRSLT) ; PUT VITALS IN DATE ORDER
     40          ; AND COUNT THEM VSORT CONTAINS INDEXES ONLY
     41          F J=1:1:VCNT  D  ; FOR EACH VITAL IN THE LIST
     42          . I $D(VITRSLT(VSORT(J))) D
    4043          . . S VITVMAP=$NA(@VITTVMAP@(J))
    4144          . . K @VITVMAP
    4245          . . I DEBUG W "VMAP= ",VITVMAP,!
    43           . . S VITPTMP=VITRSLT(J) ; PULL OUT VITAL FROM RPC RETURN ARRAY
    44           . . S @VITVMAP@("VITALSIGNSDATAOBJECTID")="VITAL"_J ; UNIQUE OBJID FOR VITAL
     46          . . S VITPTMP=VITRSLT(VSORT(J)) ; DATE SORTED VITAL FROM RETURN ARRAY
     47          . . W "VITAL ",VSORT(J),!
     48          . . W VITRSLT(VSORT(J))," ",$$FMDTOUTC^CCRUTIL($P(VITPTMP,U,4),"DT"),!
     49          . . W $P(VITPTMP,U,4),!
     50          . . S @VITVMAP@("VITALSIGNSDATAOBJECTID")="VITAL"_J ; UNIQUE OBJID
    4551          . . I $P(VITPTMP,U,2)="HT" D
    4652          . . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
     
    175181          Q
    176182          ;
     183VITSORT(V1,V2) ; DATE SORT VITALS ARRAY AND RETURN INDEX IN V1 AND COUNT
     184               ; AS EXTRINSIC
     185               ; BOTH V1 AND V2 ARE PASSED BY REFERENCE
     186          ; N VSRT ; TEMP FOR HASHING DATES
     187          ; N ZI,ZJ,ZTMP,ZCNT,ZP1,ZP2
     188          S ZCNT=0 ; COUNTING NUMBER OF VITALS
     189          S ZTMP="" ;
     190          F ZI=0:0 D  Q:$O(V2(ZTMP))="" ; FOR EACH VITAL IN THE ARRAY
     191          . S ZCNT=ZCNT+1 ; INCREMENT THE COUNT
     192          . S ZTMP=$O(V2(ZTMP)) ; NEXT VITAL
     193          . I $D(V2(ZTMP)) D  ; IF THE RESULT EXISTS
     194          . . S ZP1=$P($P(V2(ZTMP),U,4),".",1) ; THE DATE PIECE
     195          . . S ZP2=$P($P(V2(ZTMP),U,4),".",2) ; THE TIME PIECE
     196          . . S VSRT(ZP1,ZP2_"00000"_ZCNT)=ZCNT ; HASH ON DATE AND TIME
     197          . . ; S VSRT($P(V2(ZTMP),U,4)_"000000"_ZCNT)=ZCNT ; PULL DATE
     198          . W "ZTMP=",ZTMP," "
     199          S V1(0)=ZCNT ; ARRAYS ARE THE SAME SIZE
     200          S ZJ=""
     201          ZWR V2
     202          ZWR VSRT
     203          F ZI=1:1:ZCNT D  Q:$O(VSRT(ZJ))="" ; VISIT THE ARRAY IN DATE ORDER
     204          . ; S ZJ=$O(VSRT(ZJ)) ; NEXT DATE
     205          . ; S V1(ZI)=VSRT(ZJ) ; ASSIGN INDEX OF NEXT DATE
     206          . S V1(ZI)=ZI ; PLUG FOR NOW, DATES NOT SORTED
     207          Q ZCNT
     208          ;
Note: See TracChangeset for help on using the changeset viewer.