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