Skip to main content
logo

PyPI Version PyPI Downloads Python Versions License DOI

MINDS is a framework designed to integrate multimodal oncology data. It queries and integrates data from multiple sources, including clinical data, genomic data, and imaging data from the NIH NCI CRDC and IDC (Imaging Data Commons) portals.

Installation

Currently the cloud version of MINDS is in closed beta, but, you can still recreate the MINDS database locally. To get the local version of the MINDS database running, you will need to setup a PostgreSQL database and populate it with the MINDS schema. This can be easily done using a docker container. First, you will need to install docker. You can find the installation instructions for your operating system here. Next, you will need to pull the PostgreSQL docker image and run a container with the following command.

docker run -d --name minds -e POSTGRES_PASSWORD=my-secret-pw -e POSTGRES_DB=minds -p port:5432 postgres

Finally, to install the MINDS python package use the following pip command:

pip install med-minds

After installing the package, please create a .env file in the root directory of the project with the following variables:

HOST=127.0.0.1
PORT=5432
DB_USER=postgres
PASSWORD=my-secret-pw
DATABASE=minds   

PostgreSQL Migration (v0.0.6)

Version 0.0.6 introduces a migration from MySQL to PostgreSQL as the database backend, offering:

  • Better performance for complex queries
  • Advanced data types and indexing options
  • More robust transaction support
  • Better standards compliance

If you're upgrading from a previous version that used MySQL, please ensure your database environment is updated to use PostgreSQL 12 or later.

Usage

Initial setup and automated updates

If you have locally setup the MINDS database, then you will need to populate it with data. To do this, or to update the database with the latest data, you can use the following command:

# Import the med_minds package
import med_minds

# Update the database with the latest data
med_minds.update()

Querying the MINDS database

The MINDS python package provides a python interface to the MINDS database. You can use this interface to query the database and return the results as a pandas dataframe.

import med_minds

# get a list of all the tables in the database
tables = med_minds.get_tables()

# get a list of all the columns in a table
columns = med_minds.get_columns("clinical")

# Query the database directly
query = "SELECT * FROM clinical WHERE project_project_id = 'TCGA-LUAD' LIMIT 10"
df = med_minds.query(query)

Building the cohort and downloading the data

# Generate a cohort to download from query
query_cohort = med_minds.build_cohort(query=query, output_dir="./data")

# or you can now directly supply a cohort from GDC
gdc_cohort = med_minds.build_cohort(gdc_cohort="cohort_Unsaved_Cohort.2024-02-12.tsv", output_dir="./data")

# to get the cohort details
gdc_cohort.stats()

# to download the data from the cohort to the output directory specified
# you can also specify the number of threads to use and the modalities to exclude or include
gdc_cohort.download(threads=12, exclude=["Slide Image"])

Please cite our work

@Article{s24051634,
    AUTHOR = {Tripathi, Aakash and Waqas, Asim and Venkatesan, Kavya and Yilmaz, Yasin and Rasool, Ghulam},
    TITLE = {Building Flexible, Scalable, and Machine Learning-Ready Multimodal Oncology Datasets},
    JOURNAL = {Sensors},
    VOLUME = {24},
    YEAR = {2024},
    NUMBER = {5},
    ARTICLE-NUMBER = {1634},
    URL = {https://www.mdpi.com/1424-8220/24/5/1634},
    ISSN = {1424-8220},
    DOI = {10.3390/s24051634}
}

Contributing

We welcome contributions from the community. If you would like to contribute to the MINDS project, please read our contributing guidelines.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Metadata

Release files for med-minds 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for med-minds 0.2.1
File Size Uploaded
med_minds-0.2.1.tar.gz 45.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for med-minds 0.2.1
File Interpreter ABI Platform
med_minds-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 74.3 kB

Release files / med_minds-0.2.1.tar.gz

Download URL med_minds-0.2.1.tar.gz
Size 45.2 kB
Tags Source
SHA-256 checksum
How to use checksums
f678e240cbdad55b67033401a17d71748d489334fbd5e28e9410a9d517344197
BLAKE2b-256 checksum
How to use checksums
95ee20922e8de36c9f3b8e3b27e94fd9a4fb3d91e4390c59645a97af76004ad0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.22

Release files / med_minds-0.2.1-py3-none-any.whl

Download URL med_minds-0.2.1-py3-none-any.whl
Size 29.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8387f5a4ab9e236cbf0d722b3299620c319eaf207462bac2139873771795f18e
BLAKE2b-256 checksum
How to use checksums
16b1b16f219d1d6bdb11f7da472fdd7929418f693914fafe20d127d167c4d674
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.22

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.0

2 release files

0.0.7

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page