Single Patient Record Back-up

From VistApedia
Revision as of 03:24, 4 November 2009 by Harshal (talk | contribs)
Jump to: navigation, search

FINISHED PROGRAM FOR RETRIEVING ONE PATIENT DATA METHOD #1:


USER>D ^%CD

Namespace: VISTA You're in namespace VISTA Default directory is c:\cachesys\mgr\vista\ VISTA>

VISTA>S DUZ=10000000020

VISTA>D ^XUP

Setting up programmer environment This is a TEST account.

Terminal Type set to: C-VT320

Select OPTION NAME: VISTA>

VISTA>D ^NAM5SSN

===============================

VISTA SELECT PATIENT PROCEDURE:

===============================

Select PATIENT NAME: ONE

  1   ONE,IMAGEPATIENT        4-15-53    666061001     NO     NSC

VETERAN

  2   ONE,INPATIENT        3-9-45    666000801     NO     NSC VETERAN
  3   ONE,OUTPATIENT        3-9-45    666000601     NO     NSC

VETERAN

  4   ONE,PATIENT        4-7-35    666000001     YES     SC VETERAN
  5   ONEHUNDRED,INPATIENT        3-9-45    666000900     NO     NSC

VETERAN

ENTER '^' TO STOP, OR CHOOSE 1-5: 4 ONE,PATIENT 4-7-35 666000001 YES SC VETERAN

Enrollment Priority: GROUP 3    Category: IN PROCESS    End Date:
===============================

NAME5SSN SELECTED PATIENT DATA:

===============================

Name: ONE,PATIENT SSN: 666000001 SEX: M DOB: 03/12/8276 ADDRESS: 1312 Ashton Place CITY: Rowling STATE: WEST VIRGINIA ZIP: 99998 PHONE: 222-555-8235

===============================

VISTA>

============================================================

OUTPUT.TXT:

====

Name^ONE,PATIENT^SSN^666000001^SEX^M^DOB^03/12/8276^ADDRESS^1312 Ashton Place^CITY^Rowling^STATE^WEST VIRGINIA^ZIP^99998PHONE^222-555-8235^

============================================================
NAM5SSN ; Lab 9 M1; VISTA SELECT PATIENT NAME: W NAME & SSN; AHR;

09/28/2009

Setting up a VistA environment
USER>D ^%CD
Namespace
VISTA
You're in namespace VISTA
Default directory is c
\cachesys\mgr\vista\
VISTA>S DUZ=10000000020
VISTA>D ^XUP
Setting up programmer environment
This is a TEST account.
Terminal Type set to
C-VT320
Select OPTION NAME
VISTA>
VISTA>D ^NAM5SSN
Assuming you want field #9 from File #2, the name of the field is

retrieved

with the MUMPS expression
WRITE $PIECE(^DD(2,9,0),"^",1),!
observe the difference between
field number and global subscript location
Select DATA DICTIONARY UTILITY OPTION
LIST FILE ATTRIBUTES
START WITH WHAT FILE
PATIENT//
GO TO WHAT FILE
PATIENT//
Select SUB-FILE
Select LISTING FORMAT
STANDARD// CUSTOM-TAILORED
SORT BY
LABEL// NUMBER
START WITH NUMBER
FIRST//
WITHIN NUMBER, SORT BY
FIRST PRINT ATTRIBUTE
LABEL
THEN PRINT ATTRIBUTE
NUMBER
THEN PRINT ATTRIBUTE
GLOBAL SUBSCRIPT LOCATION
THEN PRINT ATTRIBUTE
Heading (S/C)
FIELD SEARCH//
DEVICE
0;80;999 TELNET
PATIENT FILE FIELD SEARCH SEP 24,2009 22
01 PAGE 1
LABEL NUMBER GLOBAL
SUBSCRIPT LOCATION
Below is the section on address. Note
Field Label, Number, and Global Subscript Location

­-----
NAME .01 0;1
SEX .02 0;2
DATE OF BIRTH .03 0;3
AGE .033 ;
MARITAL STATUS .05 0;5
RACE .06 0;6
OCCUPATION .07 0;7
RELIGIOUS PREFERENCE .08 0;8
DUPLICATE STATUS .081 0;18
PATIENT MERGED TO .082 0;19
CHECK FOR DUPLICATE .083 0;20
SOCIAL SECURITY NUMBER .09 0;9
STREET ADDRESS [LINE 1] .111 .11;1
ZIP+4 .1112 .11;12
STREET ADDRESS [LINE 2] .112 .11;2
STREET ADDRESS [LINE 3] .113 .11;3
CITY .114 .11;4
STATE .115 .11;5
ZIP CODE .116 .11;6
COUNTY .117 .11;7
ADDRESS CHANGE DT/TM .118 .11;13
ADDRESS CHANGE SOURCE .119 .11;14
Thus the first line of the address is in piece 1 of subscript " .11"
Like so
$P(^DPT(patientnum,.11),"^",1)
And CITY is in piece 4
$P(^DPT(patnumber,.11),"^",4)
Addressing this bit of MUMPS code
S ZSTATE=$P(^DD(5,STATE,0),"^",1)
this says (in MUMPS-ish English)
create a local variable for this process only named ZSTATE
with the value found by reading the local variable STATE
and using it as a FileMan Field Number.
Use this FileMan Field Number to find the FileMan Field Name
by looking it up in the Data Dictionary of the File #5.
(not stated, but known by me, File #5 is the VistA STATE File)
The Field Name is found by retrieving the "Zeroth" node of the
Data Dictionary, and then processing it by removing the first piece
of the string stored in that zeroth node value, which is itself a
string of characters, using a "^" (caret character) as a delimiter.
This does NOT do what you have been saying you want to do.
If you want to look up the name of a state using the index for that
state (the internal entry number of that entry in the STATE File)
you must look in the global used for the STATE File.
If you use the internal entry number of the state as if it were a

field

number, you will get the wrong information.
If you want to get the value of a particular state, you must find

out the

global root for the STATE File. I happen to know that the global

root

for the STATE File is "^DIC(5," I know this because I use the

FileMan

inquire option to find it.
Select OPTION
INQUIRE TO FILE ENTRIES
OUTPUT FROM WHAT FILE
STATE// FILE
Select FILE
STATE
ANOTHER ONE
STANDARD CAPTIONED OUTPUT? Yes// (Yes)
Include COMPUTED fields
(N/Y/R/B): NO// BOTH Computed Fields and

Record Number

(IEN)
NUMBER
5 NAME: STATE
APPLICATION GROUP
VA
DESCRIPTION
This file contains the name of the state (or outlying

area) as

issued by the Department of Veterans Affairs and issued in M-1, Part

I,

Appendix B. These entries should remain as distributed and should

not be

edited or updated unless done via a software upgrade or under

direction of VA

Central Office.
GLOBAL NAME (c)
^DIC(5, ENTRIES (c): 82
DD ACCESS (c)
# WR ACCESS (c): #
DEL ACCESS (c)
# LAYGO ACCESS (c): #
VERSION (c)
5.3 COMPILED CROSS-REFERENCES (c): NO
After I find out the global root for the STATE File, I have to get

the

value for the NAME
of the STATE. I happen to know this is in the Zeroth node and the
first piece using
"^" as a delimiter.
So the code should be
SET ZSTATE=$P(^DIC(5,STATE,0),"^",1)
FROM
DGPHIST ;WASH/ERC - PURPLE HEART REQUEST HISTORY ;23 AUG 00 ;
5.3;Registration;**343**,Aug 13, 1993

EN ;Entry point N DGDFN,DGPAT,DGNAM,DGSSN N SEX,DOB,ADDRESS,CITY,STATE,ZIP,PHONE

I DTIME="" S DTIME=30 ; added 1 line; TIMEOUT 4 READ set if ^XUP not

run S DTIME=9999

W !,"===========================================" W !,"VISTA SELECT PATIENT PROCEDURE: ",! W "===========================================",!

S DGDFN=$$GETDFN() Q:DGDFN'>0

S DGNAM=$$NAME(DGDFN)

S DGSSN=$$SSN(DGDFN)

S SEX=$P($G(^DPT(DGDFN,0)),"^",2)

S DOB=$P($G(^DPT(DGDFN,0)),"^",3) S ZDOB=$ZDATETIME(DOB)

S ADDRESS=$P(^DPT(DGDFN,.11),"^",1)

S CITY=$P(^DPT(DGDFN,.11),"^",4)

S STATE=$P(^DPT(DGDFN,.11),"^",5) SET ZSTATE=$P(^DIC(5,STATE,0),"^",1)

S ZIP=$P(^DPT(DGDFN,.11),"^",6)

S PHONE=$P(^DPT(DGDFN,.13),"^",1)

cell .13;10
S CELLPHONE=$P(^DPT(DGDFN,.13),"^",10)
e-mail address .13;3
S EMAIL=$P(^DPT(DGDFN,.13),"^",3)

W !,"===========================================",! W !,"NAME5SSN SELECTED PATIENT DATA: " W !,"===========================================",! W !,"Name: ",DGNAM," SSN: ",DGSSN W !,"SEX: ",SEX," DOB: ",ZDOB," ADDRESS: ",ADDRESS W !,"CITY: ",CITY," STATE: ",ZSTATE," ZIP: ",ZIP W !,"PHONE: ", PHONE,! W !,"===========================================",!

To write to an external file name

set externalfilename="C:\Documents and Settings\robinson\My Documents \HOMEWORK\MUMPS\Lab 09\out_file.txt" open externalfilename:("NRW") use externalfilename

write to the selected file
write a text file with the format
Field Id Name^Field Data^

W "Name^",DGNAM,"^SSN^",DGSSN,"^" ; Line I have written W "SEX^",SEX,"^DOB^",ZDOB,"^ADDRESS^",ADDRESS,"^" W "CITY^",CITY,"^STATE^",ZSTATE,"^ZIP^",ZIP W "PHONE^", PHONE,"^"

close externalfilename

W !,"WHOLE GLOBAL
",$G(^DPT(DGDFN,0))
FROM
VAFCMS01 ;BP-CIOFO/JRP - ADMISSION RETRANSMISSION;8/3/1998 ;
5.3;Registration;**209**;Aug 13, 1993

GETDFN() ;Get pointer to PATIENT file (#2)

Input 
None
Output 
DFN - Pointer to PATIENT file (#2)
-1 - No entry selected

N DIC,X,Y,DTOUT,DUOUT S DIC="^DPT(" S DIC(0)="AEMNQZ" D ^DIC Q +Y

FROM
DGENPTA ;ALB/CJM - Patient API - Retrieve Data; 13 JUN 1997
5.3;Registration;**121,122,147**;08/13/93

SSN(DFN) ;

Description
Function returns the patient's SSN, or "" on failure.

Q:'DFN "" Q $P($G(^DPT(DFN,0)),"^",9)

NAME(DFN) ;

Description
Function returns the patient's NAME, or "" on failure.

Q:'DFN "" Q $P($G(^DPT(DFN,0)),"^")

QUIT ; END NAM2SSN

VERY IMPORTANT EXAMPLE OF PATIENT LOOKUP MAIN ROUTINE
DPTLK ;ALB/RMO,RTK - MAS Patient Look-up Main Routine ; 3/22/05

4:19pm

5.3;Registration;**32,72,93,73,136,157,197,232,265,277,223,327,244,513,528,541,576,600,485,633,629,647**;Aug 13, 1993

mods made for magstripe read 12/96 - JFP
Optional input
DPTNOFZY='1' to suppress fuzzy lookups implemented
by patch DG*5.3*244