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