Skip to content

Commit e72e5b2

Browse files
authored
Merge pull request #95 from ImageMarkup/remove-diagnosis-support
Drop legacy diagnosis support
2 parents db5cfa3 + 8b9490e commit e72e5b2

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

isic_cli/cli/types.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,27 @@
99

1010
from isic_cli.io.http import get_cohort, get_collection
1111

12+
unsupported_diagnosis_message = (
13+
"\n\nThe 'diagnosis' search filter is no longer supported.\n"
14+
"ISIC now uses a hierarchical taxonomy with diagnosis_1-5 fields.\n"
15+
"\n"
16+
"Example conversion:\n"
17+
" Old: 'diagnosis:melanoma'\n"
18+
" New: 'diagnosis_2:\"Malignant melanocytic proliferations (Melanoma)\"'\n"
19+
"\n"
20+
"For the complete taxonomy, refer to the ISIC Data Dictionary: https://www.isic-archive.com/data-dictionary"
21+
)
22+
1223

1324
class SearchString(click.ParamType):
1425
name = "search_string"
1526

1627
def convert(self, value, param, ctx):
1728
value = super().convert(value, param, ctx)
1829

30+
if "diagnosis:" in value:
31+
self.fail(click.style(unsupported_diagnosis_message, fg="yellow"), param, ctx)
32+
1933
r = ctx.obj.session.get("images/search/", params={"query": value, "limit": 1})
2034
if r.status_code == 400 and "message" in r.json() and "query" in r.json()["message"]:
2135
self.fail(f'Invalid search query string "{value}"', param, ctx)

tests/test_cli_image.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,10 @@ def test_image_download_cleanup(cli_run, outdir):
7373
assert partial_file.exists()
7474
cleanup_partially_downloaded_files(Path(outdir))
7575
assert not partial_file.exists()
76+
77+
78+
@pytest.mark.usefixtures("_isolated_filesystem", "_mock_images")
79+
def test_image_download_legacy_diagnosis_unsupported(cli_run, outdir):
80+
result = cli_run(["image", "download", outdir, "--search", "diagnosis:melanoma"])
81+
assert result.exit_code == 2
82+
assert "no longer supported" in result.output

0 commit comments

Comments
 (0)