Create Local Database from Static Copy of AACT

If you would like to work with the complete set of clinical trials on your own computer... install PostgreSQL locally, download a static copy of the AACT database, and populate a local PostgreSQL AACT database instance with the data. This page provides the instructions.

Windows Users: Click here for step-by-step instructions to install PostgreSQL & create/load a local copy of AACT on a Windows machine.

1

Install PostgreSQL Database Platform

The PostgreSQL package (open source and freely available) includes a number of nice tools. If you intend to access the public AACT database hosted in the cloud, the only PostgreSQL tool you need is psql. If you would like to download a static copy of AACT to use on your local machine, you'll need the full postgreSQL package including the tools to create and populate the database (createdb & pg_restore). These tools are part of the standard PostgreSQL package, so once installed, you will be able to create your own AACT database.

AACT is currently running on version 11.5 of PostgreSQL; it's recommended you install this version or higher. You many download PostgreSQL from the PostgreSQL Download Site or this Enterprise DB site.

We've provided a few screenshots and basic instructions here to help guide you through the installation process.

2

Download Package Containing Static Copy of AACT Database

Download a zip file that contains the AACT database file. With a single command (see below), this file can be used to automatically configure the database & populate it with the clinical trials dataset. The zip file also contains documentation that describes the database at the time the static copy was created. (The download typically takes 3-7 minutes, depending on your network speed.)

Current Month's Daily Static Copies

Monthly Archive of Static Copies



On Novermber 15, 2021 our database structured changed slightly. Monthly files generated after November 15, 2021 are not backwards compatible. They can still be loaded into an SQL server or used.

Click here to see a list of these archived files


3

Populate Local PostgreSQL Database from the Static Copy

Once PostgreSQL is installed on your local machine and you have downloaded a static copy of the AACT database, you can create and populate your own database. You have two alternatives for installing it: 1) via a terminal session using command lines or 2) via a graphical user interface (GUI) such as pgAdmin. The command line option is somewhat simpler, so we've highlighted instructions for this below and provided guidance for using the GUI here.

Database Creation Via Command Line

Open a terminal session

This should open a terminal session where you can enter the following commands.

Locate and unzip the database package/zipfile

Verify the location of the database package you downloaded in step 2 - both the path and the file name. You'll need to unzip this package and use the data dump file it contains to create and populate your own, local instance of the database.

        

-> unzip ~/Downloads/YYYYMMDD_clinical_trials.zip

This will unpack the files contained in the zip package and save them to the directory where the zip file exists. These files include:

Create and populate your local database instance

Enter the following command(s) to create the AACT database on your local machine & populate it with clinical trials data.

If this is the first time you're creating a local copy of the AACT database, enter these commands from a terminal session:

        

-> createdb aact -> pg_restore -e -v -O -x -d aact --no-owner ~/Downloads/postgres_data.dmp

If the AACT database already exists on your local machine and you want to refresh it with another version, note that older dump files may not be compatible with your current database. This is because we make changes to schema structure from time to time as well as upgrade PostgreSQL.

To refresh your existing database use this command:

        

-> pg_restore -e -v -O -x -d aact --clean --no-owner ~/Downloads/postgres_data.dmp

This typically takes 5-15 minutes, depending on the speed of your machine.

Verify the database

Confirm the download was successful by logging into the database and perusing the data.

  

-> psql aact psql (9.6.1) Type "help" for help. aact=# _

The aact=# prompt indicates that you're in a pSQL console session and can enter SQL commands. AACT tables are saved in a schema named ctgov. You need to add this schema to your pSQL search path:

  

aact=# alter role your-username in database aact set search_path = ctgov, public; ALTER ROLE aact=# _

You will need to logout of psql (with command \q) and then back in for the search path to take effect. Then you can query the database. For example, to find the number of studies in the database:

  

aact=# select count(*) from studies; count -------- 387486 (1 row) aact=# _ As of 08/24/21