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

Adding READMEs to all directories #584

Open
wants to merge 45 commits into
base: sk/joss-publication
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
76e35fc
Tweak logging for anonymisation (#528)
stefpiatek Nov 27, 2024
93dc6ba
update main read me
skeating Nov 27, 2024
83cc35a
Remove private DICOM tag for PIXL project name (#527)
p-j-smith Nov 27, 2024
3678f3c
511 - anonymisation for spectroscopy data (#513)
mxochicale Dec 11, 2024
d0f809b
Fix timeout issues when querying instances of a local study in Orthan…
p-j-smith Dec 11, 2024
87edbea
Renovate: ubuntu to v24 (#568)
renovate[bot] Dec 11, 2024
30bbd3b
Renovate: dependency pytest-asyncio to v0.24.0 (#556)
renovate[bot] Dec 11, 2024
b4d5888
Renovate: dependency aiohttp to v3.10.11 [SECURITY] (#533)
renovate[bot] Dec 11, 2024
2abbcfb
Renovate: dependency psycopg2-binary to v2.9.10 (#539)
renovate[bot] Dec 11, 2024
0ebd195
Renovate: dependency jsonpickle to v3.4.2 (#552)
renovate[bot] Dec 11, 2024
0d2f3a9
Renovate: dependency pytest-cov to v6 (#565)
renovate[bot] Dec 11, 2024
6d560f4
Update dependencies (#570)
p-j-smith Dec 11, 2024
f656090
Renovate: dependency dicom-anonymizer to v1.0.13.post1 (#536)
renovate[bot] Dec 12, 2024
9dbb114
Group all non-major updates into a single PR (#569)
p-j-smith Dec 12, 2024
cf96120
Add configuration for IoN Neuro DB project - prognosis ai (#525)
stefpiatek Dec 12, 2024
019032f
Renames file to prevent pytest conflict (#573)
tomaroberts Dec 12, 2024
8ed7655
Renovate: actions/checkout to 11bd719 (#575)
renovate[bot] Dec 16, 2024
83c1140
Renovate: docker/setup-buildx-action to c47758b (#577)
renovate[bot] Dec 16, 2024
f1c63fb
Renovate: actions/setup-python to 0b93645 (#576)
renovate[bot] Dec 16, 2024
6435ebb
Renovate: postgres:16-bookworm Docker digest to 5620f24 (#578)
renovate[bot] Dec 16, 2024
f55891c
Ensure we validate against correct `SPOClassUID` in `pixl_dcmd` tests…
p-j-smith Dec 19, 2024
9fe48f6
Improve anon logging and anonymise all matching studies at once (#582)
stefpiatek Dec 19, 2024
1d62bf7
Start documenting design choices (#574)
stefpiatek Dec 23, 2024
edbf6dc
update main read me (#529)
skeating Dec 24, 2024
235ca58
Merge branch 'sk/joss-1' into sk/joss-pub
skeating Dec 24, 2024
8d7faf6
Merge remote-tracking branch 'origin/sk/joss-publication' into sk/jos…
skeating Dec 24, 2024
65c7b5f
made read mes consistent
skeating Dec 24, 2024
3dcc4fb
Made the read mes more consistent
skeating Dec 24, 2024
a48ec93
made read mes more consistent
skeating Dec 27, 2024
208e74c
Log study info in anonymisation (#587)
stefpiatek Jan 2, 2025
7c777c9
making readmes consistent
skeating Jan 3, 2025
4109db4
making readmes consistent
skeating Jan 3, 2025
08b4ca5
making readmes consistent
skeating Jan 3, 2025
474894e
making readmes consistent
skeating Jan 6, 2025
807f84b
Refactor Python and Orthanc Dockerfiles (#583)
jeremyestein Jan 6, 2025
ecd5abf
Strip whitespace and remove empty identifiers (#586)
stefpiatek Jan 7, 2025
b0360ea
Making readmes more consistent
skeating Jan 7, 2025
ae4df7a
Add default anonymisation config for radiotherapy data (#521)
p-j-smith Jan 8, 2025
b3921b6
always try to create the output folder on the ftps server and catch t…
p-j-smith Jan 9, 2025
2babe4d
Making readmes consistent
skeating Jan 10, 2025
6bf6989
Merge remote-tracking branch 'origin/main' into sk/joss-pub
skeating Jan 10, 2025
415761f
Making readmes consistent
skeating Jan 10, 2025
57f13b9
Making readmes consistent
skeating Jan 10, 2025
e00eeae
Making readmes consistent
skeating Jan 10, 2025
35c34b2
Making readmes consistent
skeating Jan 10, 2025
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
1 change: 0 additions & 1 deletion .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ ORTHANC_ANON_URL=http://orthanc-anon:8042
ORTHANC_ANON_USERNAME=
ORTHANC_ANON_PASSWORD=
ORTHANC_ANON_AE_TITLE=
ORTHANC_ANON_HTTP_TIMEOUT=60
ORTHANC_AUTOROUTE_ANON_TO_ENDPOINT=false
ENABLE_DICOM_WEB=true
STUDY_TIME_OFFSET=
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ concurrency:

jobs:
lint:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4

- name: Run pre-commit
uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
Expand All @@ -46,18 +46,18 @@ jobs:
docker compose config --quiet

test:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
timeout-minutes: 30
strategy:
fail-fast: false # run all tests if even if one fails
matrix:
package_dir: [pixl_core, hasher, pixl_dcmd, cli, pixl_export, pixl_imaging, pytest-pixl]

steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4

- name: Init Python
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5
with:
python-version: "3.11"
cache: "pip"
Expand All @@ -78,21 +78,21 @@ jobs:
AZURE_KEY_VAULT_SECRET_NAME: test

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
uses: codecov/codecov-action@7f8b4b4bde536c465e797be725718b88c5d95e0e # v5.1.1
with:
directory: ${{ matrix.package_dir }}
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

system-test:
if: ${{ ! github.event.pull_request.draft || contains(github.event.pull_request.title, '[force-system-test]') }}
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
timeout-minutes: 30
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3
- name: Init Python
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5
with:
python-version: "3.11"
cache: "pip"
Expand Down Expand Up @@ -179,7 +179,7 @@ jobs:


- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
uses: codecov/codecov-action@7f8b4b4bde536c465e797be725718b88c5d95e0e # v5.1.1
with:
directory: test
env:
Expand Down
34 changes: 32 additions & 2 deletions .renovaterc.json5
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,36 @@
$schema: "https://docs.renovatebot.com/renovate-schema.json",
extends: [
"github>UCL-ARC/.github//renovate/default-config.json",
"schedule:monthly",
":assignAndReview(team:arc-dev)",
"group:allNonMajor"
],
}
customDatasources: {
dicomSpec: {
defaultRegistryUrlTemplate: "https://dicom.nema.org/medical/dicom",
format: "html",
},
},
customManagers: [
{
customType: "regex",
description: "Update DICOM Spec edition used for validation",
fileMatch: [
"orthanc/orthanc-anon/plugin/download_dicom_spec.py",
"pixl_dcmd/src/pixl_dcmd/main.py",
],
matchStrings: [
'edition\\s?=\\s?"(?<currentValue>.*?)"\n',
'.*\\(edition\\s?=\\s?"(?<currentValue>.*?)"\\)\n',
],
depNameTemplate: "dicomSpec",
datasourceTemplate: "custom.dicomSpec",
},
],
packageRules: [
{
matchDatasources: ["custom.dicomSpec"],
extractVersion: "/medical/dicom/(?<version>\\d{4}[a-z])/",
versioning: "loose",
}
]
}
20 changes: 19 additions & 1 deletion bin/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
## 'PIXL/bin' Directory Contents

### Subdirectories
<details>
<summary>
<h3> Subdirectories with links to the relevant README </h3>

</summary>

[linters](./linters/README.md)

</details>

<details>
<summary>
<h3> Files </h3>

</summary>

| **User docs** |
| :--- |
README.md

</details>

14 changes: 12 additions & 2 deletions bin/linters/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
A directory that contains the files used for linting.

## 'PIXL/bin/linters' Directory Contents

### Files
<details>
<summary>
<h3> Files </h3>

</summary>

| **Code** | **User docs** |
| :--- | :--- |
| check_headers_exist.sh | README.md |

check_headers_exist.sh
</details>

22 changes: 18 additions & 4 deletions cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,29 @@ pytest -vs tests/test_docker_commands.py #e.g., for particular tests

## 'PIXL/cli' Directory Contents

### Subdirectories
<details>
<summary>
<h3> Subdirectories with links to the relevant README </h3>

</summary>

[src](./src/README.md)

[tests](./tests/README.md)

### Files
</details>

<details>
<summary>
<h3> Files </h3>

</summary>

| **Configuration** | **User docs** |
| :--- | :--- |
| pyproject.toml | README.md |

</details>

pyproject.toml

README.md

2 changes: 1 addition & 1 deletion cli/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ classifiers = ["Programming Language :: Python :: 3"]
dependencies = [
"core==0.2.0rc0",
"click==8.1.7",
"tqdm==4.66.4",
"tqdm==4.67.1",
]

[project.optional-dependencies]
Expand Down
22 changes: 21 additions & 1 deletion cli/src/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
This directory contains the source files for the PIXL commands line interface.

## 'PIXL/cli/src' Directory Contents

### Subdirectories
<details>
<summary>
<h3> Subdirectories with links to the relevant README </h3>

</summary>

[pixl_cli](./pixl_cli/README.md)

</details>

<details>
<summary>
<h3> Files </h3>

</summary>

| **User docs** |
| :--- |
README.md

</details>

28 changes: 16 additions & 12 deletions cli/src/pixl_cli/README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
## 'PIXL/cli/src/pixl_cli' Directory Contents

### Files

main.py
This directory contains the files necessary to create a command line instance of PIXL.

_config.py

_database.py
## 'PIXL/cli/src/pixl_cli' Directory Contents

_docker_commands.py
<details>
<summary>
<h3> Files </h3>

_io.py
</summary>

_message_processing.py
| **Code** | **User docs** |
| :--- | :--- |
| main.py | README.md |
| _config.py | |
| _database.py | |
| _docker_commands.py | |
| _io.py | |
| _message_processing.py | |
| __init__.py | |

__init__.py
</details>

8 changes: 4 additions & 4 deletions cli/src/pixl_cli/_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ def _filter_existing_images(
) -> pd.DataFrame:
# DataFrame indices must batch when using df.isin (or df.index.isin)
# So we re-index the DataFrames to match on the columns we want to compare
messages_df_reindexed = messages_df.set_index(["accession_number", "mrn", "study_date"])
images_df_reindexed = images_df.set_index(["accession_number", "mrn", "study_date"])
messages_df_reindexed = messages_df.set_index(["accession_number", "mrn", "study_uid"])
images_df_reindexed = images_df.set_index(["accession_number", "mrn", "study_uid"])
keep_indices = ~messages_df_reindexed.index.isin(images_df_reindexed.index)
return messages_df[keep_indices]

Expand All @@ -101,7 +101,7 @@ def _filter_exported_messages(
) -> pd.DataFrame:
merged = messages_df.merge(
images_df,
on=["accession_number", "mrn", "study_date"],
on=["accession_number", "mrn", "study_uid"],
how="left",
validate="one_to_one",
suffixes=(None, None),
Expand Down Expand Up @@ -131,7 +131,7 @@ def all_images_for_project(project_slug: str) -> pd.DataFrame:
PixlSession = sessionmaker(engine)

query = (
select(Image.accession_number, Image.study_date, Image.mrn, Image.exported_at)
select(Image.accession_number, Image.study_uid, Image.mrn, Image.exported_at)
.join(Extract)
.where(Extract.slug == project_slug)
)
Expand Down
21 changes: 13 additions & 8 deletions cli/src/pixl_cli/_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,25 @@ def read_patient_info(resources_path: Path) -> pd.DataFrame:
messages_df = _load_csv(resources_path)
else:
messages_df = _load_parquet(resources_path)
# Tidy up dataframe in case of whitespace or no way to identify images
unique_columns = ["project_name", "mrn", "accession_number", "study_uid"]
filtered_df = messages_df.dropna(subset=["accession_number", "study_uid"], how="all")
for column in unique_columns:
filtered_df[column] = filtered_df[column].str.strip()
filtered_df = filtered_df[
~(filtered_df["accession_number"].eq("") & filtered_df["study_uid"].eq(""))
]

messages_df = messages_df.sort_values(by=["project_name", "study_date"])
messages_df = messages_df.drop_duplicates(
subset=["project_name", "mrn", "accession_number", "study_date"]
)
filtered_df = filtered_df.sort_values(by=["project_name", "study_date"])
filtered_df = filtered_df.drop_duplicates(subset=unique_columns)

if len(messages_df) == 0:
if len(filtered_df) == 0:
msg = f"Failed to find any messages in {resources_path}"
raise ValueError(msg)

logger.info("Created {} messages from {}", len(messages_df), resources_path)
logger.info("Created {} messages from {}", len(filtered_df), resources_path)

return messages_df
return filtered_df


def _load_csv(filepath: Path) -> pd.DataFrame:
Expand Down Expand Up @@ -168,7 +174,6 @@ class DF_COLUMNS(StrEnum): # noqa: N801
"participant_id": "pseudo_patient_id",
}


MAP_PARQUET_TO_MESSAGE_KEYS = {
"PrimaryMrn": "mrn",
"AccessionNumber": "accession_number",
Expand Down
38 changes: 21 additions & 17 deletions cli/tests/README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,33 @@
# PIXL cli tests

Remove the db container and associated data
This directory contains the code for the tests of the PIXL command line interface.



In order to remove the db container and associated data after the tests have been run use the following command:

```bash
docker container rm pixl-test-db -v -f
```

## 'PIXL/cli/tests' Directory Contents

### Files

conftest.py

README.md

test_check_env.py

test_database.py

test_docker_commands.py

test_io.py
<details>
<summary>
<h3> Files </h3>

test_messages_from_files.py
</summary>

test_message_processing.py
| **Code** | **User docs** |
| :--- | :--- |
| conftest.py | README.md |
| test_check_env.py | |
| test_database.py | |
| test_docker_commands.py | |
| test_io.py | |
| test_messages_from_files.py | |
| test_message_processing.py | |
| test_populate.py | |

test_populate.py
</details>

File renamed without changes.
Loading