Single Patient Record Back-up: Difference between revisions
No edit summary |
Single Patient record back-up |
||
| Line 1: | Line 1: | ||
Thanks Alan for the program. | |||
This program retrieves single patient record from VistA | |||
USER>D ^%CD | USER>D ^%CD | ||
Namespace: VISTA | Namespace: VISTA | ||
You're in namespace VISTA | You're in namespace VISTA | ||
Default directory is c:\cachesys\mgr\vista\ | Default directory is c:\cachesys\mgr\vista\ | ||
VISTA> | VISTA> | ||
VISTA>D ^NAM5SSN | VISTA>D ^NAM5SSN | ||
"===========================================" | |||
VISTA SELECT PATIENT PROCEDURE: | VISTA SELECT PATIENT PROCEDURE: | ||
"===========================================" | |||
Select PATIENT NAME: ONE | Select PATIENT NAME: ONE | ||
1 ONE,IMAGEPATIENT 4-15-53 666061001 NO NSC | 1 ONE,IMAGEPATIENT 4-15-53 666061001 NO NSC VETERAN | ||
VETERAN | |||
2 ONE,INPATIENT 3-9-45 666000801 NO NSC VETERAN | 2 ONE,INPATIENT 3-9-45 666000801 NO NSC VETERAN | ||
3 ONE,OUTPATIENT 3-9-45 666000601 NO NSC VETERAN | |||
3 ONE,OUTPATIENT 3-9-45 666000601 NO NSC | |||
VETERAN | |||
4 ONE,PATIENT 4-7-35 666000001 YES SC VETERAN | 4 ONE,PATIENT 4-7-35 666000001 YES SC VETERAN | ||
5 ONEHUNDRED,INPATIENT 3-9-45 666000900 NO NSC VETERAN | |||
5 ONEHUNDRED,INPATIENT 3-9-45 666000900 NO NSC | |||
VETERAN | |||
ENTER '^' TO STOP, OR | ENTER '^' TO STOP, OR | ||
CHOOSE 1-5: 4 ONE,PATIENT 4-7-35 666000001 YES SC | CHOOSE 1-5: 4 ONE,PATIENT 4-7-35 666000001 YES SC VETERAN | ||
VETERAN | |||
Enrollment Priority: GROUP 3 Category: IN PROCESS End Date: | Enrollment Priority: GROUP 3 Category: IN PROCESS End Date: | ||
"===========================================" | |||
NAME5SSN SELECTED PATIENT DATA: | |||
"===========================================" | |||
Name: ONE,PATIENT SSN: 666000001 | |||
SEX: M DOB: APR 7,1935 ADDRESS: 1312 Ashton Place | |||
CITY: Rowling STATE: WEST VIRGINIA ZIP: 99998 | CITY: Rowling STATE: WEST VIRGINIA ZIP: 99998 | ||
PHONE: 222-555-8235 | PHONE: 222-555-8235 | ||
"===========================================" | |||
VISTA> | VISTA> | ||
"=======================================================================" | |||
FILE OUTPUT | |||
"=======================================================================" | |||
Name^ONE,PATIENT^SSN^666000001^SEX^M^DOB^ | Name^ONE,PATIENT^SSN^666000001^SEX^M^DOB^APR 7,1935^ADDRESS^1312 Ashton Place^CITY^Rowling^STATE^WEST VIRGINIA^ZIP^99998PHONE^222-555-8235^ | ||
Ashton Place^CITY^Rowling^STATE^WEST | |||
VIRGINIA^ZIP^99998PHONE^222-555-8235^ | "========================================================================" | ||
- Show quoted text - | |||
NAM5SSN ; Lab 9 M1; VISTA SELECT PATIENT NAME: W NAME & SSN; AHR; | NAM5SSN ; Lab 9 M1; VISTA SELECT PATIENT NAME: W NAME & SSN; AHR; 09/28/2009 | ||
09/28/2009 | |||
; | ; | ||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| Line 99: | Line 77: | ||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
; | ; | ||
; Assuming you want field #9 from File #2, the name of the field is | ; Assuming you want field #9 from File #2, the name of the field is retrieved | ||
retrieved | |||
; with the MUMPS expression | ; with the MUMPS expression | ||
; WRITE $PIECE(^DD(2,9,0),"^",1),! | ; WRITE $PIECE(^DD(2,9,0),"^",1),! | ||
| Line 130: | Line 107: | ||
; Field Label, Number, and Global Subscript Location | ; Field Label, Number, and Global Subscript Location | ||
; | ; | ||
; | ; "--------------------------------------------------------------------------------" | ||
-------------------------------------------------------------------------------- | |||
; | ; | ||
; NAME .01 0;1 | ; NAME .01 0;1 | ||
| Line 188: | Line 164: | ||
; you must look in the global used for 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 | ; If you use the internal entry number of the state as if it were a field | ||
field | |||
; number, you will get the wrong information. | ; number, you will get the wrong information. | ||
; If you want to get the value of a particular state, you must find | ; If you want to get the value of a particular state, you must find out the | ||
out the | ; global root for the STATE File. I happen to know that the global root | ||
; global root for the STATE File. I happen to know that the global | ; for the STATE File is "^DIC(5," I know this because I use the FileMan | ||
root | |||
; for the STATE File is "^DIC(5," I know this because I use the | |||
FileMan | |||
; inquire option to find it. | ; inquire option to find it. | ||
; | ; | ||
| Line 206: | Line 178: | ||
; ANOTHER ONE: | ; ANOTHER ONE: | ||
; STANDARD CAPTIONED OUTPUT? Yes// (Yes) | ; STANDARD CAPTIONED OUTPUT? Yes// (Yes) | ||
; Include COMPUTED fields: (N/Y/R/B): NO// BOTH Computed Fields and | ; Include COMPUTED fields: (N/Y/R/B): NO// BOTH Computed Fields and Record Number | ||
Record Number | |||
; (IEN) | ; (IEN) | ||
; | ; | ||
; NUMBER: 5 NAME: STATE | ; NUMBER: 5 NAME: STATE | ||
; APPLICATION GROUP: VA | ; APPLICATION GROUP: VA | ||
; DESCRIPTION: This file contains the name of the state (or outlying | ; DESCRIPTION: This file contains the name of the state (or outlying area) as | ||
area) as | ; issued by the Department of Veterans Affairs and issued in M-1, Part I, | ||
; issued by the Department of Veterans Affairs and issued in M-1, Part | ; Appendix B. These entries should remain as distributed and should not be | ||
I, | ; edited or updated unless done via a software upgrade or under direction of VA | ||
; 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. | ; Central Office. | ||
; GLOBAL NAME (c): ^DIC(5, ENTRIES (c): 82 | ; GLOBAL NAME (c): ^DIC(5, ENTRIES (c): 82 | ||
| Line 226: | Line 193: | ||
; VERSION (c): 5.3 COMPILED CROSS-REFERENCES (c): NO | ; VERSION (c): 5.3 COMPILED CROSS-REFERENCES (c): NO | ||
; | ; | ||
; After I find out the global root for the STATE File, I have to get | ; After I find out the global root for the STATE File, I have to get the | ||
the | |||
; value for the NAME | ; value for the NAME | ||
; of the STATE. I happen to know this is in the Zeroth node and the | ; of the STATE. I happen to know this is in the Zeroth node and the | ||
| Line 249: | Line 215: | ||
N SEX,DOB,ADDRESS,CITY,STATE,ZIP,PHONE | N SEX,DOB,ADDRESS,CITY,STATE,ZIP,PHONE | ||
; | ; | ||
;I DTIME="" S DTIME=30 ; added 1 line; TIMEOUT 4 READ set if ^XUP not | ;I DTIME="" S DTIME=30 ; added 1 line; TIMEOUT 4 READ set if ^XUP not run | ||
run | |||
S DTIME=9999 | S DTIME=9999 | ||
; | ; | ||
| Line 266: | Line 231: | ||
S SEX=$P($G(^DPT(DGDFN,0)),"^",2) | S SEX=$P($G(^DPT(DGDFN,0)),"^",2) | ||
; | ; | ||
S DOB=$P($G(^DPT(DGDFN,0)),"^",3) | |||
; | |||
; FileMan Internal to External Date | |||
; X ^DD("DD"): Internal to External Date | |||
; Introduction to Date/Time Formats: %DT | |||
; This introduction pertains to this and the %DT calls. %DT is used to validate date/time input and convert it to VA FileMan's conventional internal format: "YYYMMDD.HHMMSS", where: | |||
; YYY is number of years since 1700 (hence always 3 digits) | |||
; MM is month number (00-12) | |||
; DD is day number (00-31) | |||
; HH is hour number (00-23) | |||
; MM is minute number (01-59) | |||
; SS is the seconds number (01-59) | |||
; This format allows for representation of imprecise dates like JULY '78 or 1978 (which would be equivalent to 2780700 and 2780000, respectively). Dates are always returned as a canonic number (no trailing zeroes after the decimal). | |||
; There are two ways to convert a date from internal YYYMMDD format to external format€�this call and DD^%DT. (This is the reverse of what %DT does.) Simply set the variable Y equal to the internal date and execute ^DD("DD"). | |||
; Example | |||
; >S Y=2690720.163 X ^DD("DD") W Y | |||
; JUL 20,1969@1630 | |||
; This results in Y being equal to JUL 20,1969@16:30. (No space before the 4-digit year.) | |||
; Input Variable | |||
; Y | |||
; (Required) This contains the internal date to be converted. If this has five or six decimal places, seconds will automatically be returned. | |||
; Output Variable | |||
; Y | |||
; Y is returned as the external form of the date. | |||
; See also DT^DIO2, which takes an internal date in the variable Y and writes out its external form. | |||
; March 1999 VA FileMan V. 22.0 Programmer Manual 1-5 | |||
;Revised December 2007 | |||
; | |||
S Y=DOB X ^DD("DD") | |||
S DOB=Y | |||
; | ; | ||
; MUMPS DATE, DOES NOT APPLY; S ZDOB=$ZDATE(DOB) | |||
S ZDOB=$ | |||
; | ; | ||
S ADDRESS=$P(^DPT(DGDFN,.11),"^",1) | S ADDRESS=$P(^DPT(DGDFN,.11),"^",1) | ||
| Line 286: | Line 281: | ||
; S EMAIL=$P(^DPT(DGDFN,.13),"^",3) | ; S EMAIL=$P(^DPT(DGDFN,.13),"^",3) | ||
; | ; | ||
W !,"===========================================" | W !,"===========================================" | ||
W !,"NAME5SSN SELECTED PATIENT DATA: " | W !,"NAME5SSN SELECTED PATIENT DATA: " | ||
W !,"===========================================",! | W !,"===========================================",! | ||
W !,"Name: ",DGNAM," SSN: ",DGSSN | W !,"Name: ",DGNAM," SSN: ",DGSSN | ||
W !,"SEX: ",SEX," DOB: ", | W !,"SEX: ",SEX," DOB: ",DOB," ADDRESS: ",ADDRESS | ||
W !,"CITY: ",CITY," STATE: ",ZSTATE," ZIP: ",ZIP | W !,"CITY: ",CITY," STATE: ",ZSTATE," ZIP: ",ZIP | ||
W !,"PHONE: ", PHONE,! | W !,"PHONE: ", PHONE,! | ||
| Line 298: | Line 294: | ||
; To write to an external file name: | ; To write to an external file name: | ||
; | ; | ||
set externalfilename="C:\Documents and Settings\robinson\My Documents | set externalfilename="C:\Documents and Settings\robinson\My Documents\HOMEWORK\MUMPS\Lab 09\out_file.txt" | ||
\HOMEWORK\MUMPS\Lab 09\out_file.txt" | |||
open externalfilename:("NRW") | open externalfilename:("NRW") | ||
use externalfilename | use externalfilename | ||
| Line 307: | Line 302: | ||
; | ; | ||
W "Name^",DGNAM,"^SSN^",DGSSN,"^" ; Line I have written | W "Name^",DGNAM,"^SSN^",DGSSN,"^" ; Line I have written | ||
W "SEX^",SEX,"^DOB^", | W "SEX^",SEX,"^DOB^",DOB,"^ADDRESS^",ADDRESS,"^" | ||
Revision as of 06:55, 4 November 2009
Thanks Alan for the program.
This program retrieves single patient record from VistA
USER>D ^%CD
Namespace: VISTA You're in namespace VISTA Default directory is c:\cachesys\mgr\vista\ 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: APR 7,1935 ADDRESS: 1312 Ashton Place
CITY: Rowling STATE: WEST VIRGINIA ZIP: 99998 PHONE: 222-555-8235
"==========================================="
VISTA> "=======================================================================" FILE OUTPUT "======================================================================="
Name^ONE,PATIENT^SSN^666000001^SEX^M^DOB^APR 7,1935^ADDRESS^1312 Ashton Place^CITY^Rowling^STATE^WEST VIRGINIA^ZIP^99998PHONE^222-555-8235^
"========================================================================"
- Show quoted text -
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)
- FileMan Internal to External Date
- X ^DD("DD")
- Internal to External Date
- Introduction to Date/Time Formats
- %DT
- This introduction pertains to this and the %DT calls. %DT is used to validate date/time input and convert it to VA FileMan's conventional internal format
- "YYYMMDD.HHMMSS", where:
- YYY is number of years since 1700 (hence always 3 digits)
- MM is month number (00-12)
- DD is day number (00-31)
- HH is hour number (00-23)
- MM is minute number (01-59)
- SS is the seconds number (01-59)
- This format allows for representation of imprecise dates like JULY '78 or 1978 (which would be equivalent to 2780700 and 2780000, respectively). Dates are always returned as a canonic number (no trailing zeroes after the decimal).
- There are two ways to convert a date from internal YYYMMDD format to external format€�this call and DD^%DT. (This is the reverse of what %DT does.) Simply set the variable Y equal to the internal date and execute ^DD("DD").
- Example
- >S Y=2690720.163 X ^DD("DD") W Y
- JUL 20,1969@1630
- This results in Y being equal to JUL 20,1969@16
- 30. (No space before the 4-digit year.)
- Input Variable
- Y
- (Required) This contains the internal date to be converted. If this has five or six decimal places, seconds will automatically be returned.
- Output Variable
- Y
- Y is returned as the external form of the date.
- See also DT^DIO2, which takes an internal date in the variable Y and writes out its external form.
- March 1999 VA FileMan V. 22.0 Programmer Manual 1-5
- Revised December 2007
S Y=DOB X ^DD("DD") S DOB=Y
- MUMPS DATE, DOES NOT APPLY; S ZDOB=$ZDATE(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: ",DOB," 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^",DOB,"^ADDRESS^",ADDRESS,"^"