Access Patient List

12 views
Skip to first unread message

pianoman

unread,
Jul 1, 2008, 6:07:39 PM7/1/08
to Hardhats
Hello Hardhats,

Can any one tell me what the idiom is to programmatically (ie not from
FileMan) interrogate the VistA data?

According to the ADT Outputs manual, the ^DPT global holds patient
data.

Now, I also understand that the M/MUMPS command to find all the
children of a global is something along these lines:

GTM>S y="^DPT"
GTM>F y=$QUERY(@y) Q:y="" W y,"=",@y,!

But when I do this, I don't get a list of patients: I get this:
^DPT(0)=PATIENT^2I^26^26

I have discovered that I can persuade VistA to spit out the patients
one at a time if I do this:

GTM>S y="^DPT(1)" <-------- ask for subvariable 1
GTM>F y=$QUERY(@y) Q:y="" W y,"=",@y,!
^DPT(1,0)=ZZ PATIENT,TEST ONE^F^2450124^^2^^NOE^^666663322^^LAS
VEGAS^32^^^68^30
60511^^^^1

Can any one tell me what the idiom is to programmatically (ie not from
FileMan) interrogate the VistA data?

Many thanks,

Robin

Skip Ormsby

unread,
Jul 1, 2008, 7:11:21 PM7/1/08
to Hard...@googlegroups.com
Pianoman, is this what you are looking for?:
PLAY>S IEN=0

PLAY>F  S IEN=$O(^DPT(IEN)) Q:'IEN  W !,^DPT(IEN,0)

ZZ PATIENT,TEST ONE^F^2450124^^2^^NOE^^000003322^^LAS VEGAS^32^^^68^3060511^^^^1
ZZ PATIENT,TEST TWO^M^2571225^^7^^SAILOR^29^^Test patient only, please use to te
st, train^BOSTON^25^^^^^^^^1
ZZ PATIENT,TEST THREE^M^2680115^^7^^UNEMPLOYED^^^^MIAMI^12^^^^^^^^1
ZZCHILD,FIVE^M^3080108^^^^^^^^^^^^^^^^^1
ZZCHILD,SIX^M^3080109^^^^^^^^^^^^^^^^^1

-skip
Montani Semper Liberi

Skip Ormsby

unread,
Jul 1, 2008, 7:13:45 PM7/1/08
to Hard...@googlegroups.com
I apologize for not using Robin.  :-(
-skip
Montani Semper Liberi

Nancy Anthracite

unread,
Jul 1, 2008, 7:52:17 PM7/1/08
to Hard...@googlegroups.com

Why should you apologize for not using Robin? I think I am missing something.


--
Nancy Anthracite

Jim Self

unread,
Jul 1, 2008, 8:39:22 PM7/1/08
to Hard...@googlegroups.com
pianoman wrote:
Hello Hardhats,

Can any one tell me what the idiom is to programmatically (ie not from
FileMan) interrogate the VistA data?
  
The contradictory phrasing of this question stopped me from answering for a while. The standard way to programmatically interrogate VistA data is to *use* Fileman - if not the interactive mode, then the API's.


According to the ADT Outputs manual, the ^DPT global holds patient
data.

Now, I also understand that the M/MUMPS command to find all the
children of a global is something along these lines:

GTM>S y="^DPT"
GTM>F y=$QUERY(@y) Q:y=""  W y,"=",@y,!

But when I do this, I don't get a list of patients: I get this:
^DPT(0)=PATIENT^2I^26^26
  

The M-code above is somewhat malformed in that it specifies a single step of iteration where you obviously intended an indefinite number of steps to be terminated only after traversal of all nodes of the global. Try this instead to list 20 nodes at a time

F i=1:1:20 S y=$QUERY(@y) Q:y=""  W y,"=",@y,!

-- 

---------------------------------------
Jim Self
Systems Architect, Lead Developer
VMTH Information Technology Services, UC Davis
(http://www.vmth.ucdavis.edu/us/jaself)
---------------------------------------
M2Web Demonstration with VistA
(http://vista.vmth.ucdavis.edu/)
---------------------------------------

pianoman

unread,
Jul 2, 2008, 3:08:00 AM7/2/08
to Hardhats
Dear Hardhats,

1. Thank you all very much for prompt and comprehensive assistance. It
was not previously clear to me that FileMan had an API that one could
use to program to. I had picked up the (erroneous) idea that it was a
'roll and scroll' interactive application.

2. Next, my lack of familiarity with M/MUMPS led me to omit a SET
command in the above given sample code. For anyone learner who comes
after me, I resubmit a corrected version, which actually works,
although bearing in mind from previous responses in this thread that
this is not how an experienced VistA person would do it:-

GTM>S y="^DPT"
GTM>F S y=$QUERY(@y) Q:y="" W y,"=",@y,! <-----------------
inserted previously absent S command.

output appears to be all the subvariables in the tree below ^DPT
(which I presume is the main patient data store).

Best wishes,

Robin

kdt...@gmail.com

unread,
Jul 2, 2008, 7:49:37 PM7/2/08
to Hardhats
Robin,

I don't know if you found the link to the Fileman API manual, but here
it is.

http://www.hardhats.org/fileman/pm/index.html

I love programming, and had to figure a lot of this out myself. If
you want some feedback etc, just post here and I think you will find
lots of help.

Kevin

Jim Self

unread,
Jul 2, 2008, 9:35:22 PM7/2/08
to Hard...@googlegroups.com
pianoman wrote:
2. Next, my lack of familiarity with M/MUMPS led me to omit a SET
command in the above given sample code. For anyone learner who comes
after me, I resubmit a corrected version, which actually works,
although bearing in mind from previous responses in this thread that
this is not how an experienced VistA person would do it:-

GTM>S y="^DPT"
GTM>F  S y=$QUERY(@y) Q:y=""  W y,"=",@y,!       <-----------------
inserted previously absent S command.

One of the reasons why you would generally not dump a whole global as above is that the ouput could easily be hundreds of megabytes, far too large to examine visually. That is why I gave you a variation that limits the number of nodes to be dumped. If you execute that command line once after setting y="^DPT" it will dump the first 20 nodes of the global. If you recall the command line (press the up-arrow key) and re-execute, it will dump the next 20 nodes, etc.

Another reason is that the mapping of files and file attributes can be complex so that many of the global nodes would be irrelevant and/or redundant to a given query. One global may contain many files. A file may contain a large number of attributes (total as well as per node), including sub-files and indexes.

Nancy Anthracite

unread,
Jul 2, 2008, 10:51:54 PM7/2/08
to Hard...@googlegroups.com
Now I get it! Kevin was talking about Robin the person, not Robin, our
development machine!


--
Nancy Anthracite

pianoman

unread,
Jul 3, 2008, 7:12:49 PM7/3/08
to Hardhats
I'm going to like it here. You called one of your machines after me,
and I've only just joined !

:-)

Best wishes,

Robin
Reply all
Reply to author
Forward
0 new messages