Skip to content

Commit

Permalink
refactor: Merge remote-tracking branch 'origin' into docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jjjermiah committed Feb 25, 2024
2 parents 1c1f9b6 + d9ef88b commit 5c3fa28
Show file tree
Hide file tree
Showing 38 changed files with 1,649 additions and 859 deletions.
50 changes: 9 additions & 41 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
name: CI-CD

# only run on pushes to main or pull requests
on:
push:
# push to any branch
branches: [ main , docs]
# push to any branch *
branches: [ "*"]
pull_request:
branches: [ main , development]
jobs:

jobs:
Unit-Tests:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, macos-14]
python-version: ["3.12", "3.11"] # "3.10",

steps:
- uses: actions/checkout@v3

Expand All @@ -33,7 +33,7 @@ jobs:
- name: Test with pytest
run: |
# Github action runners now have 4 cores
poetry run pytest -n 4 --cov --cov-report xml:coverage-report/coverage.xml
poetry run pytest -s -v -n 4 --cov --cov-report xml:coverage-report/coverage.xml
- name: Upload coverage report artifact to be used by Codecov
# only upload if matrix.os is ubuntu-latest and matrix.python-version is 3.12
Expand Down Expand Up @@ -67,7 +67,6 @@ jobs:

Build-Documentation:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/docs'
steps:
- name: Checkout code
uses: actions/checkout@v3
Expand Down Expand Up @@ -228,15 +227,15 @@ jobs:
matrix:
os: [ubuntu-latest, macos-latest, macos-14]
python-version: ["3.12", "3.11"]

steps:
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install using PyPi
run: |
pip install nbiatoolkit;
Expand Down Expand Up @@ -362,34 +361,3 @@ jobs:
# No changes
echo "No changes found. Nothing to commit or push."
fi
# # git add README.md

# # git commit -m "Update README with latest version"
# # git push


# #!/bin/bash

# # Check for changes
# if [[ $(git status --porcelain) ]]; then
# # Changes are present
# echo "Changes found. Committing and pushing..."

# # Add all changes
# git add .

# # Commit with a timestamp
# git commit -m "Auto commit: $(date)"

# # Push changes to the remote repository
# git push origin <your-branch-name>

# echo "Changes committed and pushed successfully."
# else
# # No changes
# echo "No changes found. Nothing to commit or push."
# fi

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -154,3 +154,6 @@ src/nbiatoolkit/.DS_Store

NBIA-Download
src/nbiatoolkit/.DS_Store
.vscode
download.ipynb
driver*.py
19 changes: 19 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
repos:
- repo: https://github.com/psf/black
rev: 22.10.0
hooks:
- id: black
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- id: check-json
- id: check-toml

- repo: https://gitlab.com/smop/pre-commit-hooks
rev: v1.0.0
hooks:
- id: check-poetry
23 changes: 9 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
# This Dockerfile will create a container that builds the nbiatoolkit package
# using the code in this repository
#
# To build the container, run the following command from the root of the
# repository:
# docker build -t nbiatoolkit .


FROM python:3.12-slim

LABEL maintainer="Jermiah Joseph jermiahjoseph98@gmail.com"
Expand All @@ -14,14 +6,17 @@ LABEL license="MIT"
LABEL usage="docker run -it --rm <image_name> NBIAToolkit --help"
LABEL org.opencontainers.image.source="github.com/jjjermiah/nbiatoolkit"

# install the dependencies
RUN pip install --upgrade pip
RUN python -m pip install nbiatoolkit
# copy current directory to /nbiatoolkit
COPY . /nbiatoolkit

# set working directory
WORKDIR /nbiatoolkit

# install nbiatoolkit
RUN pip install --no-cache-dir --upgrade pip
RUN pip install --no-cache-dir .

RUN NBIAToolkit --help

# On run, open a bash shell
CMD ["/bin/bash"]

# to run this container in terminal mode, use the following command:
# docker run -it --rm nbiatoolkit
1 change: 0 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

57 changes: 39 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@
[![PyTests](https://github.com/jjjermiah/nbia-toolkit/actions/workflows/main.yml/badge.svg)](https://github.com/jjjermiah/nbia-toolkit/actions/workflows/main.yml)
[![Documentation Status](https://readthedocs.org/projects/nbia-toolkit/badge/?version=latest)](https://nbia-toolkit.readthedocs.io/en/latest/?badge=latest)
[![codecov](https://codecov.io/gh/jjjermiah/nbia-toolkit/graph/badge.svg?token=JKREY71D0R)](https://codecov.io/gh/jjjermiah/nbia-toolkit)
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)
[![Python version](https://img.shields.io/pypi/pyversions/nbiatoolkit.svg)](https://img.shields.io/pypi/pyversions/nbiatoolkit.svg)
[![CodeFactor](https://www.codefactor.io/repository/github/jjjermiah/nbia-toolkit/badge)](https://www.codefactor.io/repository/github/jjjermiah/nbia-toolkit)


![GitHub release (latest by date)](https://img.shields.io/github/v/release/jjjermiah/nbia-toolkit)
[![PyPI version](https://badge.fury.io/py/nbiatoolkit.svg)](https://badge.fury.io/py/nbiatoolkit)
[![Downloads](https://static.pepy.tech/badge/nbiatoolkit)](https://pepy.tech/project/nbiatoolkit)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/nbiatoolkit.svg?label=pypi%20downloads)](https://pypi.org/project/nbiatoolkit/)
Expand All @@ -13,7 +17,10 @@




![GitHub milestone details](https://img.shields.io/github/milestones/progress-percent/jjjermiah/nbia-toolkit/1?style=flat-square&label=1.0.0%20Stable%20Release%20Milestone&link=https%3A%2F%2Fgithub.com%2Fjjjermiah%2Fnbia-toolkit%2Fmilestone%2F1)![GitHub milestone details](https://img.shields.io/github/milestones/progress/jjjermiah/nbia-toolkit/1?style=flat-square&label=%20&link=https%3A%2F%2Fgithub.com%2Fjjjermiah%2Fnbia-toolkit%2Fmilestone%2F1)
[![GitHub issues](https://img.shields.io/github/issues/jjjermiah/nbia-toolkit)](https://github.com/jjjermiah/nbia-toolkit/issues)
![GitHub last commit](https://img.shields.io/github/last-commit/jjjermiah/nbia-toolkit)



Expand Down Expand Up @@ -43,19 +50,43 @@ It is made available via PyPI and can be installed using pip:
pip install nbiatoolkit
```

## Python Usage
Using a context manager, you can easily access the NBIA database and query for metadata on collections, patients, studies, and series.

``` python
from nbiatoolkit import NBIAClient

with NBIAClient() as client:
# Get a list of collections
collections = client.getCollections()
print(collections)

# Get a list of patients in a collection
patients = client.getPatients(Collection="TCGA-KIRC")
print(patients)

# Get a list of studies for a patient
studies = client.getStudies(PatientID="TCGA-BP-4989")
print(studies)

# Get a list of series for a study
series = client.getSeries(StudyInstanceUID=studies[0]["StudyInstanceUID"])
print(series[0:5])
```

## CLI Usage
For quick access to the NBIA, the toolkit also provides a command line interface (CLI)
For quick access to the NBIA, the toolkit also provides a command line interface (CLI)

``` bash NBIAToolkit-Output
> NBIAToolkit --version
_ ______ _______ ______ ____ _ __
/ | / / __ )/ _/ |/_ __/___ ____ / / /__(_) /_
/ |/ / __ |/ // /| | / / / __ \/ __ \/ / //_/ / __/
/ /| / /_/ // // ___ |/ / / /_/ / /_/ / / ,< / / /_
/_/ |_/_____/___/_/ |_/_/ \____/\____/_/_/|_/_/\__/


Version: 0.29.2
_ ______ _______ ______ ____ _ __
/ | / / __ )/ _/ |/_ __/___ ____ / / /__(_) /_
/ |/ / __ |/ // /| | / / / __ \/ __ \/ / //_/ / __/
/ /| / /_/ // // ___ |/ / / /_/ / /_/ / / ,< / / /_
/_/ |_/_____/___/_/ |_/_/ \____/\____/_/_/|_/_/\__/

Version: 0.32.1

Available CLI tools:

Expand Down Expand Up @@ -85,15 +116,6 @@ getSeries [-h] [-u USERNAME] [-pw PASSWORD] [-c COLLECTION]
getNewSeries [-h] [-u USERNAME] [-pw PASSWORD] -d DATE [-o OUTPUTFILE]
[--version]

downloadSingleSeries [-h] [-u USERNAME] [-pw PASSWORD] --seriesUID
SERIESUID --downloadDir DOWNLOADDIR
[--filePattern FILEPATTERN] [--overwrite]

dicomsort [-h] [-u USERNAME] [-pw PASSWORD]
[--targetPattern TARGETPATTERN] [--truncateUID]
[--sanitizeFilename] [--overwrite] [--nParallel NPARALLEL]
sourceDir destinationDir

```


Expand All @@ -110,4 +132,3 @@ Interested in contributing? Check out the contributing guidelines. Please note t
> Users of the NBIA-toolkit are required to abide by the NBIA REST API Terms of Service and the [NBIA Data Usage Policies and Restrictions](https://www.cancerimagingarchive.net/data-usage-policies-and-restrictions/)
> The NBIA-toolkit is provided as an open-source tool based on the [NBIA REST API](https://wiki.cancerimagingarchive.net/display/Public/NBIA+Advanced+REST+API+Guide) and is provided "AS IS" without warranty of any kind.
> In no event shall the authors or contributors be liable for any claim, damages or other liability, arising from, out of or in connection with the NBIA-toolkit or the use or other dealings in the NBIA-toolkit.
2 changes: 1 addition & 1 deletion docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ help:
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
6 changes: 3 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
sys.path.insert(0, os.path.abspath("../src"))
# -- Project information -----------------------------------------------------

project = u"nbiatoolkit"
copyright = u"2023, Jermiah Joseph"
author = u"Jermiah Joseph"
project = "nbiatoolkit"
copyright = "2023, Jermiah Joseph"
author = "Jermiah Joseph"

# -- General configuration ---------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ markdowns/CHANGELOG.md
markdowns/CONTRIBUTING.md
markdowns/CONDUCT.md
autoapi/index
```
```

0 comments on commit 5c3fa28

Please sign in to comment.