VistA Analysis » VistA Reference » RPCs » GMV CLOSEST READING

GMV CLOSEST READING

This remote procedure call returns the observation date/time and reading of the record closest to the date/time specified for the patient and vitaltype.

Properties

Property Value
Label CLOSEST
MUMPS Implementation GMVGETD
Return Type SINGLE VALUE

Input Parameters

Name Type Maximum Data Length Required Description
GMVDFN LITERAL 12 true A pointer to the Patient (#2) file (i.e., DFN).
GMVDT LITERAL 14 true The date/time to search from. The default is NOW.
GMVT LITERAL 5 true The vital type abbreviation as it appears in FILE 120.51, Field 1 (e.g., WT).
GMVFLAG LITERAL 1 true A flag to indicate if the search should look before or after the date/timespecified in the GMVDT value where 1 indicates before, 2 indicates afterand 0 indicates either direction.

MUMPS Method Description

Property Value
Method CLOSEST^GMVGETD
Method Comment GMV CLOSEST READING [RPC entry point]
Input Parameters GMVDFN, GMVDT, GMVT, GMVFLAG
First Comment
 Get nearest reading to date(/time) provided
Input: GMVDFN - DFN (required)
GMVDT - FileMan date/time (optional)
Default is NOW
GMVT - Vital Type abbreviation, FILE 120.51, Field 1 (required)
GMVFLAG - Where to look (optional)
0 = either before or after GMVDT (default)
1 = before GMVDT
2 = after GMVDT
Output: RESULT - piece1^piece2
where piece1 = date/time of reading (FileMan internal format)
piece2 = reading
If no records found piece 1 = -2
and piece 2 = message text
If an error was encountered piece1 = -1
and piece2 = error message
Code
 N GMVADIFF,GMVADT,GMVAVAL,GMVBDIFF,GMVBDT,GMVBVAL,GMVDATA,GMVTI
S GMVDFN=+$G(GMVDFN),GMVDT=+$G(GMVDT),GMVT=$G(GMVT),GMVFLAG=+$G(GMVFLAG)
S GMVFLAG=$S(GMVFLAG=2:2,GMVFLAG=1:1,1:0)
I 'GMVDFN S RESULT="-1^DFN not defined" Q
I '$D(^PXRMINDX(120.5,"PI",GMVDFN)) S RESULT="-2^Patient has no Vitals data on file" Q
I 'GMVDT S GMVDT=$$NOW^XLFDT()
I GMVT="" S RESULT="-1^Vital Type not defined" Q
S GMVTI=$$GETIEN^GMVGETVT(GMVT,2)
I 'GMVTI S RESULT="-1^Vital Type not found" Q
I '$D(^PXRMINDX(120.5,"PI",GMVDFN,GMVTI)) S RESULT="-2^Patient has no data on file for this type" Q
S (GMVADT,GMVAVAL,GMVBDT,GMVBVAL,GMVDATA)=""
I GMVFLAG=0!(GMVFLAG=1) D
.S GMVDATA=$$FIND(GMVDFN,GMVTI,GMVDT,0,-1)
.S GMVBDT=$P(GMVDATA,U,1),GMVBVAL=$P(GMVDATA,U,2)
S GMVDATA=""
I GMVFLAG=0!(GMVFLAG=2) D
.S GMVDATA=$$FIND(GMVDFN,GMVTI,GMVDT,0,1)
.S GMVADT=$P(GMVDATA,U,1),GMVAVAL=$P(GMVDATA,U,2)
I GMVFLAG=1 D
.I GMVBDT'>0 S RESULT="-2^Before date not found" Q
.I GMVBVAL="" S RESULT="-2^Before value not found" Q
.S RESULT=GMVBDT_U_GMVBVAL
I GMVFLAG=2 D
.I GMVADT'>0 S RESULT="-2^After date not found" Q
.I GMVAVAL="" S RESULT="-2^After value not found" Q
.S RESULT=GMVADT_U_GMVAVAL
I GMVFLAG=0 D
.I GMVADT'>0,GMVBDT'>0 D Q
..S RESULT="-2^No records found"
.I GMVADT'>0,GMVBDT>0 D Q
..S:GMVBVAL]"" RESULT=GMVBDT_U_GMVBVAL
..S:GMVBVAL="" RESULT="-2^No records found"
.I GMVADT>0,GMVBDT'>0 D Q
..S:GMVAVAL]"" RESULT=GMVADT_U_GMVAVAL
..S:GMVAVAL="" RESULT="-2^No records found"
.I GMVADT>0,GMVBDT>0 D
..S GMVBDIFF=+$$FMDIFF^XLFDT(GMVDT,GMVBDT,2)
..S GMVADIFF=+$$FMDIFF^XLFDT(GMVADT,GMVDT,2)
..I GMVBDIFF ..I GMVADIFF ..I GMVADIFF=GMVBDIFF S RESULT=GMVADT_U_GMVAVAL

CPRS

File Type Description
DLL File No Source Code Available (GMV_VitalsViewEnter.dll)


Document generated on August 31st 2022, 2:55:43 pm