Skip to content
Pathology Residents' On-Call Tracking Database Application
Branch: master
Clone or download
Pull request Compare This branch is 1 commit behind compumaster:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Open-Source Online Database for Clinical Pathology Consults


One effective method for assessing core competencies in Clinical Pathology is through evaluation of a log of clinical cases. This application was created to log resident consults received on Clinical Pathology call and is currently used by the Laboratory Medicine residents at the University of Washington. It uses the Flask python framework and a PostgreSQL instance hosted on a server. The application is configured to use Apache and University of Washington's pubCookie web authentication services but can be configured to use forms authentication.

The application offers:

  • Interfaces to track incoming calls to on-call residents, as well as search, list and view each record.
  • Search functionality that allows residents to search the meta-data fields and free text regions separately and allows saving search queries for future use and reporting.
  • Formatted printing for presenting cases during call rounds, with an option for excluding protected health information (from metadata) for educational purposes.
  • Features such as templates for pre-determined text structures, insertion of tables for specific call types, automatic saving of non-submitted data to the server for auto-restore, tagging, flagging, linking to other database entries and PubMed records, and automated search for a patient’s previous entries in the database when a medical record number is entered.
  • User commenting (eg. faculty) on other user entries for follow up and education and voting for useful entries to make them more visible.
  • Multiple user account levels, allowing some users permission to create and delete other users and maintain various aspects of the system.

This application has been tested on all major browsers and operating systems. An instance has been used by the University of Washington Department of Laboratory Medicine since July 2013.

Details about the tool and its development were presented at the 2014 meeting for the Academy of Clinical Laboratory Physicians and Scientists: "An Open-Source Online Database for Clinical Pathology Consults", Cigdem Himmetoglu Ussakli, Patrick C. Mathias, Sinan Ussakli, Noah G. Hoffman, ACLPS 2014, San Francisco, CA.

Directory Structure

$ tree -d -L 2 --charset=ASCII lmr_database/
|-- database
`-- src
 |-- static
 |-- templates
 `-- uwdb

[D] database  - contains schema of the database and data of some utility tables.
[D] src       - sources.
[D] static    - contains all assets, also javascript scripts.
[D] templates - contains Jinja templates used in Flask.      - everything about authenticating to the application, user check etc.  - database connection layer.     - model, all of the database queries are here. Note, we are using direct SQL queries.      - controller, all of the business logic, controller, and view port handling, some utility functions.    - all configuration of the application, database connection string, logging, and other configurations.
uwdb.wsgi    - wsgi gate for Apache.


Apache2    - no specific version, we're using latest as of 2013.
Python     - version 2.7
Postgresql - version 8.4, database connection configuration is at /src/
Flask      - Installation:
psycopg2   - Python PostgreSQL2 connection

The client side uses Twitter Bootstrap and jQuery and several plugins they're all checked in to /src/static/assets.
Site's JavaScipt file  /src/static/assets/js/site.js
Site's CSS file        /src/static/assets/css/site.css
There are many javascript extensions installed. They're listed at the end of /templates/layout.html.
Site's CSS's HTML insert point is at /templates/head.html

A very quick installation guide

Check the file for a more detailed installation guide. The information below doesn't consider python virtual environments, https, or database security, but it gets you the app up and running as fast as possible.

Apache configuration


This app is configured to work either with pubcookie or with basic HTML forms login. If your organization uses pubcookie you need to install pubcookie and enable it at Apache, you'll need similar configuration at, complete guide is at the same page.

Apache Site configuration

The apache settings:

<VirtualHost *:80>

        # redirect user to https
        RewriteEngine On
        RewriteCond %{HTTPS} off
        RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

<VirtualHost *:443>

        DocumentRoot /path/to/script/location

        # certs used for https
        SSLEngine on
        SSLCertificateFile /etc/ssl/certs/certificatefile.pem
        SSLCertificateKeyFile  /etc/ssl/certs/private/certificatefilekey.key

        # main entry point for the wsgi application
        WSGIScriptAlias /oncalldb /path/to/script/location/uwdb.wsgi

		# if you are using pubcookie you need this configuration or else just remove it.

		# [[[ pubcookie configuration start ]]]

		# in order to get the pubcookie to work, a subdirectory is required.
        # or else the wsgi conflicts with the pubcookie's authentication response.
        <Directory /home/sinan/oncalldb/oncalldb>
                Options FollowSymLinks
                Order deny,allow
                allow from all
                # pubcookie configuration
                AuthType UWNetID
                AuthName "OnCall Database"
                PubcookieAppID "OnCall Database"
                require valid-user

        # these two location matches are for logout.
        <LocationMatch .*/LOGOUT-REDIRECT.*>
                AuthType UWNetID
                require valid-user
                PubcookieEndSession redirect

        <LocationMatch .*/LOGOUT-CLEARLOGIN.*>
                AuthType UWNetId
                require valid-user
                PubcookieEndSession clearLogin

		# [[[ pubcookie configuration end ]]]

		ErrorLog ${APACHE_LOG_DIR}/error.log

        # Possible values include: debug, info, notice, warn, error, crit, alert, emerg.
        LogLevel info

        CustomLog ${APACHE_LOG_DIR}/access.log combined


3 types of log files:

  • Application's users' access log: access.{date}.log at the path defined in the
  • Application's exceptions are logged to the log file defined in the
  • Apache's log as defined on apache configuration. This doesn't contain any useful data other than apache issues.


Sinan Ussakli, Copyright (c) 2013, 2014

You can’t perform that action at this time.