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
Icon  Name                    Last modified      Size  Description
[DIR] Parent Directory - [TXT] pbsqs-short-help.txt 15-Feb-2012 18:35 794 brief help for pbsqs and pbsqsc [TXT] pbsqs-help.txt 21-Feb-2012 18:12 4.8K help for pbsqs and pbsqsc [TXT] pbs-or.c 26-Feb-2012 02:36 1.8K write records present in any input list [TXT] pbs-and.c 26-Feb-2012 23:10 1.4K write records present in all input lists [TXT] pbs-erase.c 27-Feb-2012 00:04 1.1K erase named files and remove them from index of results [TXT] doctype.html 28-Feb-2012 22:32 197 top of pbsearch page (precedes head.html) [TXT] pbs-not.c 01-Mar-2012 01:38 1.7K write records not in input list [TXT] footer.html 01-Mar-2012 23:30 367 footer for pbsearch page [TXT] results.html 02-Mar-2012 19:09 1.3K heading and buttons for results section of pbsearch page [TXT] standalone.c 03-Mar-2012 16:11 2.8K source for standalone pbsqs's main() function [   ] expected 03-Mar-2012 16:32 37 expected output of pbsqsc '#record ~ mitdb' [TXT] pbsqsc 03-Mar-2012 17:26 1.0K perl command-line client for pbsqsd [TXT] pbsearch 13-Mar-2012 20:27 13K perl CGI (web) client for pbsqsd and pbs-* [TXT] help.html 13-May-2012 13:03 5.0K help for pbsearch [TXT] pbsqs.h 13-May-2012 15:33 11K definitions shared by pbsqs.c, daemon.c, standalone.c [TXT] Makefile 13-May-2012 15:45 3.2K 'make' description file to automate installation [TXT] local.css 02-Oct-2015 23:29 3.1K C# source file [TXT] pbsqs.c 24-Aug-2016 20:52 25K source for common functions of pbsqsd and pbsqsc [TXT] head.html 21-Oct-2016 00:14 14K header for pbsearch page [TXT] daemon.c 15-May-2017 23:22 3.3K source for pbsqsd's main() function

Questions and Comments

If you would like help understanding, using, or downloading content, please see our Frequently Asked Questions.

If you have any comments, feedback, or particular questions regarding this page, please send them to the webmaster.

Comments and issues can also be raised on PhysioNet's GitHub page.

Updated Friday, 28-Oct-2016 22:58:42 CEST

PhysioNet is supported by the National Institute of General Medical Sciences (NIGMS) and the National Institute of Biomedical Imaging and Bioengineering (NIBIB) under NIH grant number 2R01GM104987-09.