cobra-db


Namecobra-db JSON
Version 0.4.6 PyPI version JSON
download
home_page
SummaryCOnsolidated BReast cancer Analysis DataBase
upload_time2024-03-06 16:12:35
maintainer
docs_urlNone
authorFernando Cossio
requires_python>=3.8,<4.0
licenseApache-2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # <img src="static/img/cobra_db.png" alt="" height="30"/> cobra_db



<center>

[![DOI:10.1117/1.JMI.10.6.061404](https://zenodo.org/badge/DOI/10.1117/1.JMI.10.6.061404.svg)](https://doi.org/10.1117/1.JMI.10.6.061404)
[![PyPI version](https://badge.fury.io/py/cobra_db.svg)](https://badge.fury.io/py/cobra_db)
[![Documentation Status](https://readthedocs.org/projects/cobra-db/badge/?version=latest)](https://cobra-db.readthedocs.io/en/latest/?badge=latest)
[![codecov](https://codecov.io/gh/mammoai/cobra-db/branch/main/graph/badge.svg?token=ASQPS89408)](https://codecov.io/gh/mammoai/cobra-db)

<img src="static/img/cobra_db.png" alt="" height="200"/>

**Co**nsolidated **Br**east Cancer **A**nalysis **D**ata**B**ase
</center>



## What is ```cobra_db```?
_cobra_db_ is a python package that allows you to extract DICOM metadata and store it in a MongoDB database. Allowing you to index, transform, and export your medical imaging metadata.

With cobra_db, you will have more visibility of your data enabling you to get more value from your medical imaging studies.

Once the metadata is in the database, you can import other text-based information (csv or json) into a custom collection and then run queries. This allows you to mix and match data extracted from different sources in different formats.

For example, let's say you have 1 million mammography DICOM files and you would like to obtain the path of the files that belong to women scanned at an age of between 40 and 50 years old.

If you had cobra_db, you could run the following query in just a few seconds directly in the mongo shell.

```javascript
db.ImageMetadata.find(
  // filter the data
  {patient_age:{$gt:40, $lte:50}},
  // project it into a flat structure
  {
    patient_id: "$dicom_tags.PatientID.Value"
    drive_name: "$file_source.drive_name",
    rel_path:"$file_source.rel_path",
  })
```
This would return the patient id, the drive name and the relative path (to the drive) for all the files that match the selection criteria.

## Installation
If you already have a working instance of the database, you only need to install the python package.

```bash
$ pip install cobra_db
```

If you would like to create a database from scratch, go ahead and follow the [tutorial](https://cobra-db.readthedocs.io/en/latest/tutorial.html).

## Usage

If you have an `ImageMetadata` instance id that you would like to access from python.

```python
from cobra_db import Connector, ImageMetadataDao

# the _id of the ImageMetadata instance that you want to access
im_id = '62de8e38dc2414586e4ddb25'

# prompt user for password
connector = Connector.get_pass(
  host='my_host.server.com',
  port=27017,
  db_name='cobra_db',
  username='my_user'
)
# connect to the ImageMetadata collection
im_dao = ImageMetadataDao(connector)
im = im_dao.get_by_id(im_id)
print(im.date.file_source.rel_path)

# this will return
... rel/path/to/my_file.dcm
```

## Contributing

Interested in contributing? Check out the contributing guidelines. Please note that this project is released with a [Code of Conduct](https://cobra-db.readthedocs.io/en/latest/conduct.html). By contributing to this project, you agree to abide by its terms.

## License

`cobra_db` was created by Fernando Cossio, Apostolia Tsirikoglou, Annika Gregoorian, Haiko Schurz, Hui Li, and Fredrik Strand. It is licensed under the terms of the Apache License 2.0 license.

## Aknowledgements

This project has been funded by research grants Regional Cancer Centers in Collaboration 21/00060, and Vinnova 2021-0261.


            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "cobra-db",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "Fernando Cossio",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/75/95/d585a29767cfa6a5ba65feeb08d2974c97003aefb1e47ddb575372e153ad/cobra_db-0.4.6.tar.gz",
    "platform": null,
    "description": "# <img src=\"static/img/cobra_db.png\" alt=\"\" height=\"30\"/> cobra_db\n\n\n\n<center>\n\n[![DOI:10.1117/1.JMI.10.6.061404](https://zenodo.org/badge/DOI/10.1117/1.JMI.10.6.061404.svg)](https://doi.org/10.1117/1.JMI.10.6.061404)\n[![PyPI version](https://badge.fury.io/py/cobra_db.svg)](https://badge.fury.io/py/cobra_db)\n[![Documentation Status](https://readthedocs.org/projects/cobra-db/badge/?version=latest)](https://cobra-db.readthedocs.io/en/latest/?badge=latest)\n[![codecov](https://codecov.io/gh/mammoai/cobra-db/branch/main/graph/badge.svg?token=ASQPS89408)](https://codecov.io/gh/mammoai/cobra-db)\n\n<img src=\"static/img/cobra_db.png\" alt=\"\" height=\"200\"/>\n\n**Co**nsolidated **Br**east Cancer **A**nalysis **D**ata**B**ase\n</center>\n\n\n\n## What is ```cobra_db```?\n_cobra_db_ is a python package that allows you to extract DICOM metadata and store it in a MongoDB database. Allowing you to index, transform, and export your medical imaging metadata.\n\nWith cobra_db, you will have more visibility of your data enabling you to get more value from your medical imaging studies.\n\nOnce the metadata is in the database, you can import other text-based information (csv or json) into a custom collection and then run queries. This allows you to mix and match data extracted from different sources in different formats.\n\nFor example, let's say you have 1 million mammography DICOM files and you would like to obtain the path of the files that belong to women scanned at an age of between 40 and 50 years old.\n\nIf you had cobra_db, you could run the following query in just a few seconds directly in the mongo shell.\n\n```javascript\ndb.ImageMetadata.find(\n  // filter the data\n  {patient_age:{$gt:40, $lte:50}},\n  // project it into a flat structure\n  {\n    patient_id: \"$dicom_tags.PatientID.Value\"\n    drive_name: \"$file_source.drive_name\",\n    rel_path:\"$file_source.rel_path\",\n  })\n```\nThis would return the patient id, the drive name and the relative path (to the drive) for all the files that match the selection criteria.\n\n## Installation\nIf you already have a working instance of the database, you only need to install the python package.\n\n```bash\n$ pip install cobra_db\n```\n\nIf you would like to create a database from scratch, go ahead and follow the [tutorial](https://cobra-db.readthedocs.io/en/latest/tutorial.html).\n\n## Usage\n\nIf you have an `ImageMetadata` instance id that you would like to access from python.\n\n```python\nfrom cobra_db import Connector, ImageMetadataDao\n\n# the _id of the ImageMetadata instance that you want to access\nim_id = '62de8e38dc2414586e4ddb25'\n\n# prompt user for password\nconnector = Connector.get_pass(\n  host='my_host.server.com',\n  port=27017,\n  db_name='cobra_db',\n  username='my_user'\n)\n# connect to the ImageMetadata collection\nim_dao = ImageMetadataDao(connector)\nim = im_dao.get_by_id(im_id)\nprint(im.date.file_source.rel_path)\n\n# this will return\n... rel/path/to/my_file.dcm\n```\n\n## Contributing\n\nInterested in contributing? Check out the contributing guidelines. Please note that this project is released with a [Code of Conduct](https://cobra-db.readthedocs.io/en/latest/conduct.html). By contributing to this project, you agree to abide by its terms.\n\n## License\n\n`cobra_db` was created by Fernando Cossio, Apostolia Tsirikoglou, Annika Gregoorian, Haiko Schurz, Hui Li, and Fredrik Strand. It is licensed under the terms of the Apache License 2.0 license.\n\n## Aknowledgements\n\nThis project has been funded by research grants Regional Cancer Centers in Collaboration 21/00060, and Vinnova 2021-0261.\n\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "COnsolidated BReast cancer Analysis DataBase",
    "version": "0.4.6",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7b51cd15d738ae5f962c0ba21c345a73066fb5cb2fa386bb3d208a506ace2673",
                "md5": "3b564b6cfa66fc77ff76c9951d30b943",
                "sha256": "5eff19960b3ded4b98b7de825504b74ce3fa08b19309395dc1c0b477a719c49a"
            },
            "downloads": -1,
            "filename": "cobra_db-0.4.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3b564b6cfa66fc77ff76c9951d30b943",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<4.0",
            "size": 43034,
            "upload_time": "2024-03-06T16:12:33",
            "upload_time_iso_8601": "2024-03-06T16:12:33.434810Z",
            "url": "https://files.pythonhosted.org/packages/7b/51/cd15d738ae5f962c0ba21c345a73066fb5cb2fa386bb3d208a506ace2673/cobra_db-0.4.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7595d585a29767cfa6a5ba65feeb08d2974c97003aefb1e47ddb575372e153ad",
                "md5": "993dacd7cdaa3c1b3a39e9d8811a5726",
                "sha256": "2c854d31dd85ed6391a1f57edadee41a326c84d6cf212aa7e242c8ae74f2c7c9"
            },
            "downloads": -1,
            "filename": "cobra_db-0.4.6.tar.gz",
            "has_sig": false,
            "md5_digest": "993dacd7cdaa3c1b3a39e9d8811a5726",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<4.0",
            "size": 35950,
            "upload_time": "2024-03-06T16:12:35",
            "upload_time_iso_8601": "2024-03-06T16:12:35.243152Z",
            "url": "https://files.pythonhosted.org/packages/75/95/d585a29767cfa6a5ba65feeb08d2974c97003aefb1e47ddb575372e153ad/cobra_db-0.4.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-06 16:12:35",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "cobra-db"
}
        
Elapsed time: 0.22135s