Skip to content

Commit

Permalink
Merge branch 'main' into milanmlft/imaging-api-readme
Browse files Browse the repository at this point in the history
  • Loading branch information
milanmlft authored Jan 29, 2024
2 parents 4819df7 + 23b0917 commit 819d943
Show file tree
Hide file tree
Showing 15 changed files with 51 additions and 101 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -e pixl_core
pip install -r pixl_dcmd/src/requirements.txt
pip install -e pixl_dcmd[test]
- name: Run tests
working-directory: pixl_dcmd
Expand Down
7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,7 @@ See each service's README for instructions for individual developing and testing
For Python development we use [ruff](https://docs.astral.sh/ruff/) alongside [pytest](https://www.pytest.org/).
There is support (sometimes through plugins) for these tools in most IDEs & editors.

Before raising a PR, **run the full test suite** from the _PIXL_ directory with

```bash
bin/run-all-tests.sh
```

Before raising a PR, make sure to **run all tests** for each PIXL module
and not just the component you have been working on as this will help us catch unintentional regressions without spending GH actions minutes :-)

We run [pre-commit](https://pre-commit.com/) as part of the GitHub Actions CI. To install and run it locally, do:
Expand Down
30 changes: 0 additions & 30 deletions bin/run-all-tests.sh

This file was deleted.

5 changes: 1 addition & 4 deletions docker/orthanc-anon/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,5 @@ COPY ./orthanc/orthanc-anon/plugin/tag-operations.yaml /etc/orthanc/tag-operatio
COPY ./pixl_core/ ./pixl_core
RUN pip3 install --no-cache-dir ./pixl_core

COPY ./pixl_dcmd/src/requirements.txt .
RUN pip3 install --no-cache-dir -r requirements.txt

COPY ./pixl_dcmd/src ./pixl_dcmd
COPY ./pixl_dcmd/ ./pixl_dcmd
RUN pip3 install --no-cache-dir ./pixl_dcmd
10 changes: 1 addition & 9 deletions pixl_dcmd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,7 @@ and persisting it in the PIXL postgres database.
Install the Python dependencies with

```bash
pip install -e ../../pixl_core/ .
```

```bash
pip install -r requirements.txt
```

```bash
pip install -e .
pip install -e ../pixl_core/ .[test,dev]
```

## Test
Expand Down
2 changes: 1 addition & 1 deletion pixl_dcmd/bin/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ BIN_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
PACKAGE_DIR="${BIN_DIR%/*}"
cd "$PACKAGE_DIR"

pytest src/pixl_dcmd/tests
pytest tests
42 changes: 42 additions & 0 deletions pixl_dcmd/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[project]
name = "pixl_dcmd"
version = "0.0.2"
authors = [
{ name="PIXL authors" },
]
description = "DICOM header anonymisation functions"
readme = "README.md"
requires-python = "~=3.9"
classifiers = [
"Programming Language :: Python :: 3"
]
dependencies = [
"arrow==1.2.3",
"pydicom==2.4.4",
"pydicom-data",
"logger==1.4",
"pyyaml==6.0",
"requests==2.31.0",
"python-decouple==3.6",
"types-requests~=2.28",
]

[project.optional-dependencies]
test = [
"pytest==7.4.2",
]
dev = [
"mypy",
"pre-commit",
"ruff"
]

[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"

[tool.ruff]
extend = "./ruff.toml"

[tool.ruff.extend-per-file-ignores]
"./tests/**" = ["D100"]
11 changes: 0 additions & 11 deletions pixl_dcmd/src/requirements.txt

This file was deleted.

35 changes: 0 additions & 35 deletions pixl_dcmd/src/setup.py

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
def tag_scheme() -> dict:
"""Read the tag scheme from orthanc raw."""
tag_file = (
pathlib.Path(__file__).parents[4]
pathlib.Path(__file__).parents[2]
/ "orthanc/orthanc-anon/plugin/tag-operations.yaml"
)
return yaml.safe_load(tag_file.read_text())
Expand All @@ -57,7 +57,7 @@ def test_image_already_exported_throws(rows_in_session, tag_scheme):
WHEN the dicom tag scheme is applied
THEN an exception will be thrown as
"""
exported_dicom = pathlib.Path(__file__).parents[4] / "test/resources/Dicom1.dcm"
exported_dicom = pathlib.Path(__file__).parents[2] / "test/resources/Dicom1.dcm"
input_dataset = pydicom.dcmread(exported_dicom)

with pytest.raises(sqlalchemy.exc.NoResultFound):
Expand All @@ -71,7 +71,7 @@ def test_pseudo_identifier_processing(rows_in_session, tag_scheme):
THEN the patient identifier tag should be the mrn and accession hashed
and the pipeline db row should now have the fake hash
"""
exported_dicom = pathlib.Path(__file__).parents[4] / "test/resources/Dicom2.dcm"
exported_dicom = pathlib.Path(__file__).parents[2] / "test/resources/Dicom2.dcm"
input_dataset = pydicom.dcmread(exported_dicom)

accession_number = "AA12345605"
Expand Down
2 changes: 1 addition & 1 deletion pixl_pacs/src/pixl_pacs/_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ async def process_message(message: Message) -> None:

@dataclass
class ImagingStudy:
"""Dataclass for EHR unique to a patient and xray study"""
"""Dataclass for DICOM study unique to a patient and imaging study"""

message: Message

Expand Down

0 comments on commit 819d943

Please sign in to comment.