Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Update client to follow Orthanc 12.5 (API version 26) #71

Merged
merged 4 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ Note that recent PyOrthanc versions will likely support older Orthanc version.

| PyOrthanc version | Generated from |
|-------------------|-----------------------------------------------|
| \>= 1.18.0 | Orthanc API 1.12.4 with Python Plugin 4.2 |
| \>= 1.19.0 | Orthanc API 1.12.5 with Python Plugin 4.2 |
| 1.18.0 | Orthanc API 1.12.4 with Python Plugin 4.2 |
| 1.17.0 | Orthanc API 1.12.3 with Python Plugin 4.2 |
| 1.13.2 to 1.16.1 | Orthanc API 1.12.1 with Python Plugin 4.1 |
| 1.13.0, 1.13.1 | Orthanc API 1.12.1 with Python Plugin 4.0 |
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ services:
depends_on:
- orthanc2
orthanc2:
image: orthancteam/orthanc:24.5.1
image: orthancteam/orthanc:24.12.0
test:
build:
context: .
Expand Down
188 changes: 123 additions & 65 deletions pyorthanc/async_client.py

Large diffs are not rendered by default.

188 changes: 123 additions & 65 deletions pyorthanc/client.py

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pyorthanc"
version = "1.18.0"
version = "1.19.0"
description = "Orthanc REST API python wrapper with additional utilities"
authors = [
"Gabriel Couture <[email protected]>",
Expand Down
53 changes: 53 additions & 0 deletions tests/client/test_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
def test_system(client):
result = client.get_system()

assert 'Version' in result
assert 'ApiVersion' in result
assert 'DicomAet' in result
assert 'DicomPort' in result
assert 'MainDicomTags' in result
assert 'Capabilities' in result


def test_changes(client):
result = client.get_changes()

assert 'Changes' in result
assert 'Done' in result
assert 'Last' in result

result = client.get_changes(params={'type': 'StableStudy'}) # Example of type to filter on

assert 'Changes' in result
assert 'Done' in result
assert 'Last' in result


def test_find(client_with_data_and_labels):
result = client_with_data_and_labels.post_tools_find(json={
'Level': 'Patient',
'Query': {'PatientID': '*'}
})
assert result == ['e34c28ce-981b0e5c-2a481559-cf0d5fbe-053335f8']

result = client_with_data_and_labels.post_tools_find(json={
'Level': 'Patient',
'Labels': ['UNKNOWN_LABEL'],
'Query': {'PatientID': '*'}
})
assert result == []


def test_count_resources(client_with_data_and_labels):
result = client_with_data_and_labels.post_tools_count_resources(json={
'Level': 'Patient',
'Query': {'PatientID': '*'}
})
assert result['Count'] == 1

result = client_with_data_and_labels.post_tools_count_resources(json={
'Level': 'Patient',
'Labels': ['UNKNOWN_LABEL'],
'Query': {'PatientID': '*'}
})
assert result['Count'] == 0
2 changes: 1 addition & 1 deletion tests/orthanc/orthanc-for-test.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM orthancteam/orthanc:24.5.1
FROM orthancteam/orthanc:24.12.0

RUN pip install httpx pydicom --break-system-packages

Expand Down
2 changes: 1 addition & 1 deletion tests/orthanc/pytest.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ RUN python -m pip install poetry

# Installing project dependecies
COPY ../../pyproject.toml .
RUN poetry install --extras "all"
RUN poetry install --extras "all" --no-root

COPY ../.. /app

Expand Down
Loading