Skip to content

Add M4Client capabilities and download endpoints#46

Merged
hannesill merged 5 commits into
mainfrom
codex/m4client-downloads
May 30, 2026
Merged

Add M4Client capabilities and download endpoints#46
hannesill merged 5 commits into
mainfrom
codex/m4client-downloads

Conversation

@hannesill

Copy link
Copy Markdown
Owner

Summary

  • expose the capabilities manifest through M4Client, the public Python API, CLI, and MCP tool/resource
  • add m4 download DATASET on top of the branch's existing PhysioNet downloader, including credential-file support, manual blocked guidance, NDJSON events, and stable JSON errors
  • add doctor/setup-agent/quickstart helpers plus custom dataset metadata and docs for agent and local download workflows

Behavioral notes

  • credentialed direct downloads now require --physionet-credentials-file; without it, m4 download returns blocked guidance and a resumable quoted wget command
  • m4 capabilities --json works even when no active dataset is configured
  • doctor only fails DuckDB setup for the active dataset, not every uninitialized registered dataset

Verification

  • uv run ruff check on touched Python files
  • uv run pytest tests/test_capabilities_download_setup.py tests/test_client.py tests/test_mcp_server.py tests/test_data_io.py tests/test_services_init.py
  • uv run pytest
  • manual endpoint checks for m4 capabilities --json, m4 doctor --json, m4 setup-agent --dataset mimic-iv-ed --backend duckdb --format json, m4 download mimic-iv-ed --json, and MCP capabilities tool/resource via fastmcp.Client

hannesill added 5 commits May 29, 2026 20:56
Introduce M4Client and an explicit execution context for Python, CLI, and MCP data access. Route tool telemetry, backend selection, BigQuery billing project, and DuckDB path handling through context while preserving existing adapter output shapes and direct backend compatibility.

CLI schema, describe-table, and query no longer use temporary runtime environment overrides for dataset or backend selection. Public module functions continue to preserve notebook-facing dataset configuration behavior.
Add NDJSON init progress reporting, credentialed PhysioNet download support, and richer status setup metadata so wrappers can drive dataset setup without parsing human output.

Credentialed datasets now return raw_files_missing when local artifacts are absent and --download was not requested. Bump M4 to 0.5.0 and document the credential-file flow; no migration is required beyond callers handling the new failure code.
Expose the capabilities manifest through M4Client, the public Python API, CLI, and MCP while adding doctor/setup-agent helpers for agent workflows.

Add the standalone download command on top of the existing PhysioNet downloader, including credential-file support, resumable manual guidance, NDJSON events, and stable JSON errors.

Behavioral note: credentialed direct downloads require an explicit credentials file; without one the command returns blocked guidance. Verified with ruff, focused regression tests, full pytest, and manual CLI/MCP endpoint checks.
Compute the wget cut-dirs value from the PhysioNet listing URL and reuse the generated command in init guidance so manual downloads land in the raw layout expected by validation and initialization.

Update credentialed download documentation and add structural capability-contract tests without introducing golden snapshots. Manual guidance now emits --cut-dirs=3 -nH for current built-in PhysioNet datasets; no schema version or migration change is required.
Make the init guidance assertion tolerant of Rich line wrapping in CI while still verifying that the generated command targets the expected raw files layout.

This is a test-only fix; it has no behavioral, migration, or schema implications.
@hannesill
hannesill merged commit 4d0aebe into main May 30, 2026
6 checks passed
@hannesill
hannesill deleted the codex/m4client-downloads branch May 30, 2026 12:03
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