Software Open Access

Software for searching the PhysioBank Index

Published: Feb. 6, 2012. Version: 1.0.0

Please include the standard citation for PhysioNet: (show more options)
Goldberger, A., Amaral, L., Glass, L., Hausdorff, J., Ivanov, P. C., Mark, R., ... & Stanley, H. E. (2000). PhysioBank, PhysioToolkit, and PhysioNet: Components of a new research resource for complex physiologic signals. Circulation [Online]. 101 (23), pp. e215–e220.

Software Description

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


a stand-alone command-line tool for simple query searching


a daemon for processing simple queries


a command-line client for pbsqsd


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



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 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


Access Policy:
Anyone can access the files, as long as they conform to the terms of the specified license.

License (for files):
Open Data Commons Attribution License v1.0

Corresponding Author
You must be logged in to view the contact information.


Total uncompressed size: 0 B.

Access the files

Folder Navigation: <base>
Name Size Modified
Makefile (download) 3.2 KB 2019-04-12
daemon.c (download) 3.3 KB 2019-04-12
doctype.html (download) 197 B 2019-04-12
expected (download) 37 B 2019-04-12
footer.html (download) 367 B 2019-04-12
head.html (download) 14.5 KB 2019-04-12
help.html (download) 5 KB 2019-04-12
pbs-and.c (download) 1.4 KB 2019-04-12
pbs-erase.c (download) 1.1 KB 2019-04-12
pbs-not.c (download) 1.7 KB 2019-04-12
pbs-or.c (download) 1.8 KB 2019-04-12
pbsearch (download) 12.9 KB 2019-04-12
pbsqs-help.txt (download) 4.8 KB 2019-04-12
pbsqs-short-help.txt (download) 794 B 2019-04-12
pbsqs.c (download) 24.8 KB 2019-04-12
pbsqs.h (download) 11.2 KB 2019-04-12
pbsqsc (download) 1.0 KB 2019-04-12
results.html (download) 1.3 KB 2019-04-12
standalone.c (download) 2.8 KB 2019-04-12