Skip to content
This repository has been archived by the owner on Apr 17, 2024. It is now read-only.

CancerDataAggregator/cda-python

Repository files navigation

CDA Python

This library sits on top of the machine generated CDA Python Client and offers some syntactic sugar to make it more pleasant to query the CDA.

Documentation for CDA python is in our readthedocs repo and browsable at https://cda.readthedocs.io/

Accessing Example Notebooks

Interactive versions of those notebooks can be used at this MyBinder link:

Binder

If you would like to bulk download the notebooks without the website, they are in this folder

Contributing

If you have comments, questions, or feature requests for CDA python or the documentation site, please tell us at our Discussions page

If you have used CDA python in your work and want to be featured as a use case, start a conversation with us in the Show and Tell

If you have used CDA python and would like to contribute your own notebook for others to use, please make a pull request to our Community Notebooks repo

Swagger endpoints

You can access our swagger endpoints directly at https://cda.datacommons.cancer.gov/api/swagger-ui.html

Installation Guide

There are two methods for local installation in virtual environments: Docker or Conda + pip.

Installation without a virtual environment may have unexpected/unresolvable conflicts, and is not supported.

Docker

requirements

  1. Download and install docker

  2. Open Terminal or PowerShell and run:

git clone https://github.com/CancerDataAggregator/cda-python.git
  1. Navigate to the cda-python folder:
cd cda-python
  1. Build the docker container:
docker-compose up --build
  1. Open a Browser to http://localhost:8888. This will open a docker container with all the required packages for using the API in ipython notebook.

notes

  • To stop the container from running, return to the terminal window (from step 2), and type Control C to stop the container.

notes

To delete the container from your machine, use this command in the cda-python project directory.

docker compose down

Conda + Pip install

requirements

  1. Open Terminal or PowerShell and create a new conda environment:
conda create -n cda python=3.7

type y when prompted

  1. Activate the environment:
conda activate cda
conda install jupyter
pip install git+https://github.com/CancerDataAggregator/cda-python.git
cd cda-python
jupyter notebook

type y when prompted

  1. Click on the folder called notebooks, then the file called example.ipynb to open the example workflow, or create a new notebook to run your own.

notes

You only need to create a new conda environment once!

  • To exit the conda environment, return to the terminal window (from step 1), and type Control C to stop the notebook then:
conda deactivate
  • To return to the notebook in conda, open a terminal and type:
conda activate cda
jupyter notebooks

For Testers use this Binder

Click on the logo below. This will launch a Jupyter Notebook instance with our example notebook ready to run.

MyBinder.org