Software for searching the PhysioBank Index

The new PhysioNet website is available at: https://physionet.org. We welcome your feedback.

This software provides tools for searching the PhysioBank Index to find records that satisfy user-defined criteria. The tools include:

pbsqs
a stand-alone command-line tool for simple query searching
pbsqsd
a daemon for processing simple queries
pbsqsc
a command-line client for pbsqsd
pbsearch
a web client for pbsqsd and the pbs-* plugins
pbs-and, pbs-not, pbs-or
a set of plugins to provide additional search functions

The entire package can be downloaded as a tarball or as individual files (below).

pbsqs and pbsqsd are built from the same code (in pbsqs.c; only their main() functions, defined in standalone.c and daemon.c, differ).

The code common to pbsqs and pbsqsd reads the (flat-file) PhysioBank Index from a location defined as PBI_URL in pbsqs.h. Depending on whether the symbol LOCAL is defined at compilation time, PBI_URL is either

/home/physionet/html/physiobank/database/physiobank-index

or

http://physionet.org/physiobank/database/physiobank-index

In normal operation, the Index is read only once and is then kept in memory, so although startup time may be longer if LOCAL was not defined and the Index is read via the network, the time needed to respond to a query is unaffected by this choice.

As noted above, pbsqs and pbsqsd interpret and execute so-called simple queries. Simple queries include a subject (a class of data), a relationship (e.g., equal to, greater than, etc.), and a value (a string or numeric pattern to be compared with the subject elements). For more on simple queries, see the help for pbsqs (pbsqs-help.txt) or pbsearch (help.html).

pbsqsc is a very simple Perl script (only 17 lines of code, plus comments) that can act as a client for pbsqsd. As written, pbsqsc and pbsqsd must run on the same machine, but this restriction can easily be removed by replacing localhost in pbsqsc with the hostname of the machine that is running pbsqsd. To use pbsqsc, enter a simple query in the command line, like this:

pbsqsc 'age >= 85'

Note the use of quotation marks to protect characters such as '>' from the shell. The results of the query appear on the standard output; in most cases, you will want to capture the output in a file, or redirect it into a pipe, as in these examples:

pbsqsc 'ecg-3 ~ 24:0:0' >24-hour-ecgs
pbsqsc 'age = 0' | more

The first of these uses the '~' ("similar") comparison to select records containing 3 or more ECG signals, at least 24 hours in duration, and to save the list of results in a file named '24-hour-ecgs'. The second selects records of infants and passes the results to more, which displays them a page at a time.

pbsearch is a CGI perl script intended to be run by a web server, so that you can interact with it using your web browser. Go to http://physionet.org/cgi-bin/pbsearch to try it out. As for pbsqsc, it must run on the same machine as pbsqsd unless you edit it to replace localhost. Unlike pbsqsc, however, you can feed results of simple query searches to the plugins to answer more complex queries. For example, you can select two or more sets of results and find results belonging to all sets (logical and), or any sets (logical or).

Use Makefile and a make utility to automate the process of building and installing this software. A PhysioNet mirror has all of the required prerequisites. If you are not installing onto a PhysioNet mirror, you will need to have installed the WFDB software package, libcurl, and (for the standalone tool only) libreadline. To install and use pbsearch, you will also need to have Apache httpd configured to run CGI perl scripts in /home/physionet/cgi-bin/. It is recommended that you make a local copy of the PhysioBank Index in the default location (see above), and this is necessary if your machine does not have a network connection. If you have all of the prerequisites, run the command (in this directory):

make install

to install this entire package, and run the command:

make check

to perform a quick test of its basic functionality. If you want pbsqsd to start automatically whenever the computer is rebooted, you must set up this behavior manually (on Linux, typically by adding pbsqsd to /etc/rc.local).

To force the server to reread the index if it has been updated, send it a SIGHUP, for example, by running the command

killall -HUP pbsqsd