Summary
_build_feature_extractor() constructs models.resnet18(weights=IMAGENET1K_V1), which downloads weights from download.pytorch.org on first use. The surrounding fallback only catches ImportError ("PyTorch not installed"), so in an air-gapped/offline environment — the exact deployment the README's "on-device, nothing leaves your machine" pitch targets — the download raises URLError/RuntimeError and crashes the whole ml_analysis step instead of falling back to statistical features. The documented pre-fetch command is a stub.
Category
Robustness / Privacy-promise consistency
Severity
Medium
Location
- File:
src/medcheck/pipeline/ml_analysis.py line 33 (weight download), line 107 (except ImportError: only)
- File:
src/medcheck/main.py lines 292–296 (download_models prints "Model download coming in next release")
Details
model = models.resnet18(weights=models.ResNet18_Weights.IMAGENET1K_V1) # network I/O on first run
...
except ImportError:
# Fallback: simple statistical features when PyTorch not installed
Two separate problems:
- An undocumented outbound network call in the "local, on-device" analysis path.
- The fallback never triggers for download failures, only for a missing torch install.
Suggested Fix
- Broaden the fallback to catch download/OS errors (e.g.
except (ImportError, OSError, RuntimeError)) and log which fallback path was taken.
- Implement
medcheck download-models to pre-cache the weights for offline use.
- Document the one-time weight download in README/docs (it currently contradicts "nothing leaves your machine" messaging — no PHI leaves, but the claim of fully-offline operation is wrong on first run).
Effort Estimate
1 h (fallback + docs); download-models implementation separate
Automated finding from repo health check (2026-07-10)
Summary
_build_feature_extractor()constructsmodels.resnet18(weights=IMAGENET1K_V1), which downloads weights fromdownload.pytorch.orgon first use. The surrounding fallback only catchesImportError("PyTorch not installed"), so in an air-gapped/offline environment — the exact deployment the README's "on-device, nothing leaves your machine" pitch targets — the download raisesURLError/RuntimeErrorand crashes the wholeml_analysisstep instead of falling back to statistical features. The documented pre-fetch command is a stub.Category
Robustness / Privacy-promise consistency
Severity
Medium
Location
src/medcheck/pipeline/ml_analysis.pyline 33 (weight download), line 107 (except ImportError:only)src/medcheck/main.pylines 292–296 (download_modelsprints "Model download coming in next release")Details
Two separate problems:
Suggested Fix
except (ImportError, OSError, RuntimeError)) and log which fallback path was taken.medcheck download-modelsto pre-cache the weights for offline use.Effort Estimate
1 h (fallback + docs); download-models implementation separate
Automated finding from repo health check (2026-07-10)