Patient, date of birth is wrong why?

29 views
Skip to first unread message

AlanNSanDiego

unread,
Nov 2, 2009, 4:33:27 PM11/2/09
to Hardhats

Well I thought I was done with Retrieving the Patient data program,
but working on method two;
using Fileman to print out the same data I have found an error;
anybody see what it is?

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 Hdob, DOB: 2350407 03/12/8276 ADDRESS: 1312 Ashton Place
CITY: Rowling STATE: WEST VIRGINIA ZIP: 99998
PHONE: 222-555-8235

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

VISTA>


ONE,PATIENT 4-7-35 that looks like 4/7/1935 to me?

my program write out 3/12/8276 WHY? any ideas? anyone?

I printed out the raw date for information

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



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 DOB=$P($G(^DPT(DGDFN,.0)),"^",3)
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," Hdob, DOB: ",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
;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; So what you are seeing in this line:
; S DIC="^DPT(",DIC(0)="AEMQ"
;
; Input Variables
; DIC (Required) The file number or an explicit global root in the
form
; ^GLOBAL( or ^GLOBAL(X,Y,.
;
; is this:
;
; set DIC="^DPT("
; set DIC(0)="AEMQ"
;
; This is done to prepare for a classic fileman lookup function
; DIC is the variable that tells which global (and thus which file)
to
; look in.
; DIC(0) holds a series of flags. See the link above to see what
each
; flag means.
;
; Then typically the function will be called with
; do ^DIC.
; ======================================================
; ^DIC: Lookup/Add
; http://www.hardhats.org/fileman/pm/cl_dic.htm
; ======================================================
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
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

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;



kdt...@gmail.com

unread,
Nov 2, 2009, 7:27:11 PM11/2/09
to Hardhats
Without reading all your code, I suspect that you are working with the
internal date format that Fileman stores dates in. If so, you will
need to convert to an external format. There are formatting routines
in both classic fileman, and I think maybe the XLF library in the
kernal. Check the Hardhats website.

Kevin

AlanNSanDiego

unread,
Nov 2, 2009, 10:07:57 PM11/2/09
to Hardhats


S ZDOB=$ZDATE(DOB)

converts $horolog to standard format?

do you mean anything else?

what do you mean internal date format?

Yes, one might need to read the code to figure out the problem?

Alan

AlanNSanDiego

unread,
Nov 2, 2009, 10:55:38 PM11/2/09
to Hardhats


1 November 2009,

Yes, FileMan has it own date format, that is not $HOROLOG.

While working on method #2, I found an error in the date for
the patient
that I have corrected in my program below.

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

USER>D ^%CD

Namespace: VISTA
You're in namespace VISTA
Default directory is c:\cachesys\mgr\vista\
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>

=======================================================================
;
; 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,"^"

skip ormsby

unread,
Nov 3, 2009, 4:49:36 AM11/3/09
to hard...@googlegroups.com
Alan, I would suggest using one of the XLF Functions that are described in the Kernel's Developer's Guide.  I would also suggest of not getting into a habit of wanting to use M-OS Z commands as they are vendor specific.

JohnLeo Zimmer

unread,
Nov 3, 2009, 5:02:54 AM11/3/09
to hard...@googlegroups.com
On Mon, Nov 2, 2009 at 10:55 PM, AlanNSanDiego
<alanns...@hotmail.com> wrote:
>
>  While working on method #2, I found an error in the date for
> the patient that I have corrected in my program below.

Well done! :-)

Welcome back to the trenches, Alan.
We were beginning to miss you here.

Regards,
JL.Z

Reply all
Reply to author
Forward
0 new messages