Skip to content

Commit f89892d

Browse files
committed
Drop legacy diagnosis support
1 parent db5cfa3 commit f89892d

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

isic_cli/cli/types.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,27 @@
1010
from isic_cli.io.http import get_cohort, get_collection
1111

1212

13+
unsupported_diagnosis_message = (
14+
"\n\nThe 'diagnosis' search filter is no longer supported.\n"
15+
"ISIC now uses a hierarchical taxonomy with diagnosis_1-5 fields.\n"
16+
"\n"
17+
"Example conversion:\n"
18+
" Old: 'diagnosis:melanoma'\n"
19+
" New: 'diagnosis_3:\"Melanoma Invasive\"'\n"
20+
"\n"
21+
"For the complete taxonomy, refer to the ISIC Data Dictionary: https://www.isic-archive.com/data-dictionary"
22+
)
23+
24+
1325
class SearchString(click.ParamType):
1426
name = "search_string"
1527

1628
def convert(self, value, param, ctx):
1729
value = super().convert(value, param, ctx)
1830

31+
if "diagnosis:" in value:
32+
self.fail(click.style(unsupported_diagnosis_message, fg="yellow"), param, ctx)
33+
1934
r = ctx.obj.session.get("images/search/", params={"query": value, "limit": 1})
2035
if r.status_code == 400 and "message" in r.json() and "query" in r.json()["message"]:
2136
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)