Skip to content

feat: MedCheck v0.1.0 - AI-powered medical imaging analysis toolkit - #1

Merged
Liohtml merged 16 commits into
mainfrom
feat/initial-scaffold
May 21, 2026
Merged

feat: MedCheck v0.1.0 - AI-powered medical imaging analysis toolkit#1
Liohtml merged 16 commits into
mainfrom
feat/initial-scaffold

Conversation

@Liohtml

@Liohtml Liohtml commented May 21, 2026

Copy link
Copy Markdown
Owner

Summary

Complete initial implementation of MedCheck - an open-source, Docker-ready toolkit for AI-powered MRI analysis.

What's included:

Core Framework

  • PipelineContext dataclasses for data flow between steps
  • PipelineStep ABC for modular step implementation
  • WorkflowEngine with YAML-defined pipelines
  • Settings from environment variables

Data Providers

  • LocalProvider: load DICOM files from folders or ZIP archives
  • EasyRadiologyProvider: fetch from easyRadiology portals (scrypt auth + AES decryption)
  • ProviderRegistry with auto-detection

LLM System

  • Claude Opus 4.7, GPT-5.5, Gemini 3.5 Flash providers
  • Fallback router chain
  • Structured JSON output parsing

Pipeline Steps

  • IngestStep: load DICOM data via provider system
  • PreprocessStep: normalize volumes, detect anatomy and planes
  • MLAnalysisStep: ResNet18 feature extraction + anomaly scoring
  • VisionAnalysisStep: LLM vision analysis with structured medical prompts
  • ReportStep: PDF/HTML/JSON report generation

CLI & Web UI

  • Typer CLI: medcheck analyze, medcheck serve, medcheck download-models
  • FastAPI Web UI: 3-step wizard with dark theme

Infrastructure

  • Multi-stage Dockerfile (lite ~500MB, full ~10GB)
  • GitHub Actions CI (lint, type-check, security, test matrix 3x3)
  • CodeQL security scanning + Dependabot
  • Pre-commit hooks (ruff, codespell)
  • 65 unit tests, all passing
  • Medical prompts (knee, shoulder, spine)
  • Full documentation (quickstart, providers, workflows, models)

Community

  • Professional README with badges
  • CONTRIBUTING.md, CODE_OF_CONDUCT.md, SECURITY.md
  • Issue templates (bug report, feature request)
  • PR template, CODEOWNERS

Test plan

  • 65 unit tests pass (uv run pytest)
  • Ruff lint clean (uv run ruff check)
  • All pre-commit hooks pass
  • Manual: docker build --target lite .
  • Manual: medcheck analyze --source ./test-dicoms --report json

Credits

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Full medical-imaging analysis app: CLI, web UI, configurable workflows, multi-format reporting (JSON/PDF/HTML)
    • Multi-LLM support (Claude, OpenAI, Gemini, local) and provider routing
    • Flexible data sources (local files, portal integration) and ML/vision analysis steps
  • Documentation

    • Comprehensive README, quickstart, models/providers/workflows docs, contributing, security, and changelog
  • Infrastructure

    • Docker images, docker-compose, CI (GitHub Actions), pre-commit, license and templates
  • Tests

    • Extensive unit/integration test suite added

Review Change Stack

Liohtml and others added 15 commits May 21, 2026 12:01
…cture

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…issue templates)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Implements StepRegistry (register/get/list_steps) and WorkflowEngine
(run/run_from_yaml) with rich console status output; adds default,
quick, and vision_only workflow YAML definitions. Also sets
--basetemp in pytest addopts to work around Windows temp-dir
permission issue with pytest-asyncio strict mode.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… and fallback router

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…istry with auto-detect

Implements TDD Task 10: DataProvider abstract base class, LocalProvider that reads DICOM dirs/ZIPs via pydicom, and ProviderRegistry with register/get/detect/list_providers. All 8 new provider unit tests pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Implements IngestStep that uses ProviderRegistry (LocalProvider + EasyRadiologyProvider) to fetch DICOM series and populate patient/study metadata from the first slice. Adds source, provider_name, and credentials fields to PipelineContext.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Implements Task 17: ReportStep dispatches to generate_json_report,
generate_pdf_report (reportlab), or generate_html_report based on
context.report_format, writes the output file, and sets context.report_path.
Adds report_format, report_language, output_dir fields to PipelineContext.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…uctured prompts

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Multi-stage Dockerfile (lite ~500MB, full ~10GB)
- docker-compose.yml for development
- Medical prompts: system, knee, shoulder, spine, JSON schema
- Documentation: quickstart, providers, workflows, models

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented May 21, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 562a5ff9-9a00-4136-b00b-11684e20db1c

📥 Commits

Reviewing files that changed from the base of the PR and between 05b399c and d0bc9d8.

📒 Files selected for processing (10)
  • src/medcheck/core/context.py
  • src/medcheck/core/workflow.py
  • src/medcheck/llm/base.py
  • src/medcheck/llm/claude.py
  • src/medcheck/llm/gemini.py
  • src/medcheck/llm/openai_provider.py
  • src/medcheck/main.py
  • src/medcheck/pipeline/ml_analysis.py
  • src/medcheck/pipeline/report.py
  • src/medcheck/providers/local.py

📝 Walkthrough

Walkthrough

This PR adds a full MedCheck project scaffold: configuration and datatypes, data/LLM provider implementations and router, preprocessing/ML/vision/report pipeline steps, Typer CLI, FastAPI web UI, prompts and JSON schema, workflows, docs, CI/dev tooling, and comprehensive unit tests.

Changes

MedCheck Core Implementation

Layer / File(s) Summary
Devops, CI, packaging, and project metadata
.dockerignore, .env.example, .github/CODEOWNERS, .github/ISSUE_TEMPLATE/*, .github/dependabot.yml, .github/pull_request_template.md, .github/workflows/ci.yml, .github/workflows/codeql.yml, .gitignore, .pre-commit-config.yaml, .python-version, Dockerfile, docker-compose.yml, pyproject.toml, LICENSE, CHANGELOG.md, README.md, CONTRIBUTING.md, CODE_OF_CONDUCT.md, SECURITY.md
Added Docker/CI/workflow configs, packaging metadata, project docs and community files, and developer tooling configs.
Package init & configuration
src/medcheck/__init__.py, src/medcheck/core/config.py, src/medcheck/core/context.py
Package metadata and Settings dataclass; typed pipeline context and nested dataclasses for patient/study/series/clinical data.
Step and workflow execution framework
src/medcheck/core/step.py, src/medcheck/core/workflow.py
PipelineStep ABC; StepRegistry and WorkflowEngine with sequential execution and YAML workflow loading.
Providers: abstractions and implementations
src/medcheck/providers/base.py, src/medcheck/providers/registry.py, src/medcheck/providers/local.py, src/medcheck/providers/easyradiology.py
DataProvider interface; ProviderRegistry; LocalProvider for filesystem/ZIP DICOM discovery; EasyRadiologyProvider with access-code parsing, scrypt/AES decryption, and ZIP retrieval.
LLM providers and router
src/medcheck/llm/base.py, src/medcheck/llm/claude.py, src/medcheck/llm/openai_provider.py, src/medcheck/llm/gemini.py, src/medcheck/llm/router.py
AnnotatedImage/AnalysisResult types; LLM JSON parsing helpers; Claude/OpenAI/Gemini implementations; LLMRouter with fallback ordering.
Ingest step
src/medcheck/pipeline/ingest.py
Registers providers, auto-detects or uses provided provider, fetches DICOM series, populates PipelineContext patient/study fields.
Preprocess step
src/medcheck/pipeline/preprocess.py
Detect anatomy/plane from descriptions; sort slices; extract pixels with fallback; build normalized 3D volumes into context.
ML analysis step
src/medcheck/pipeline/ml_analysis.py
ResNet18-based (or statistical fallback) feature extraction, anomaly scoring, signal-intensity analysis, and MLAnalysisStep to populate anomaly/top-slices/signal stats.
Vision analysis step
src/medcheck/pipeline/vision_analysis.py
Builds JSON-only prompts (with anatomy hints and optional clinical context), encodes selected slices to PNG bytes, and sends to chosen LLM provider to populate structured findings.
Report generation
src/medcheck/pipeline/report.py
Generates JSON (string/file), PDF (reportlab), and HTML reports; ReportStep writes file and updates context.report_path.
Prompts and schema
src/medcheck/prompts/system.txt, src/medcheck/prompts/anatomy/*.txt, src/medcheck/prompts/report_schema.json
System prompt requiring JSON output, anatomy templates (knee/shoulder/spine), and Draft-07 report JSON schema.
CLI (Typer)
src/medcheck/main.py
Typer app with analyze (builds context, runs workflow/steps), serve (starts FastAPI app via uvicorn), and download_models stub.
Web app and UI
src/medcheck/web/app.py, src/medcheck/web/templates/index.html
FastAPI app factory, /health and / routes, index.html wizard with file upload/URL, clinical form, options, and HTMX wiring (placeholder analyze endpoint).
Tests and fixtures
tests/conftest.py, tests/unit/**/*
pytest fixtures and wide unit test coverage for config/context/steps/providers/LLM router/pipeline/reporting/CLI/web endpoints.
Workflows and docs
workflows/*.yml, docs/*
YAML workflow definitions for full/quick/vision-only pipelines and documentation: quickstart, workflows reference, models, providers.

Estimated code review effort: 🎯 4 (Complex) | ⏱️ ~45 minutes

"🐇 I hopped through code to plant a seed,
New prompts, providers, and pipelines indeed.
From DICOM piles to JSON reports bright,
MedCheck now readies the clinical night."

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/initial-scaffold

…sing, validation

Critical:
- C1: Escape HTML in report generation (XSS prevention)
- C2: Validate ZIP paths before extraction (Zip Slip prevention)
- C3: Wire up full pipeline in CLI analyze command
- C4: Pass step_configs to pipeline steps via context
- C5: Check validate() return value in WorkflowEngine

Important:
- I1: Safe API key access in LLM providers
- I2: Deduplicate _parse_response to base module
- I3: Fix JSON extraction with brace-depth tracking
- I5: Replace deprecated datetime.utcnow()
- I8: Cache ResNet18 model singleton

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant