m4-api

Access clinical datasets from Python and execute SQL queries to return DataFrames.

40|17|Updated Oct 27, 2025
One-click install
npx skills add https://github.com/hannesill/m4 --skill m4-api
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: m4-api
Source: https://github.com/hannesill/m4/tree/main/src/m4/skills/system/m4-api
Command: npx skills add https://github.com/hannesill/m4 --skill m4-api

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

The M4 Python API lets developers access clinical datasets from code, enabling reproducible analyses without manual SQL scripting. It mirrors MCP tooling but returns native Python objects like DataFrames and dicts, supporting multi-step workflows and programmatic data exploration.

Core Features & Use Cases

  • Programmatic dataset access and configuration via set_dataset
  • Schema discovery and table introspection via get_schema and get_table_info
  • Execution of SQL queries with execute_query and direct DataFrame results
  • Ideal for iterative analyses, data validation, and integration into Python pipelines

Quick Start

Set a dataset, inspect the schema, and run SQL queries through the Python API to obtain results.

Frequently Asked Questions about m4-api

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I query clinical datasets programmatically using Python and SQL?

To query clinical datasets programmatically, use the M4 Python API to set a dataset, inspect schemas, and execute SQL queries that return native pandas DataFrames for iterative analysis.

How do I discover table schemas in MIMIC-IV before running SQL queries?

Discover MIMIC-IV table schemas by applying the get_schema and get_table_info functions to introspect dataset structures and retrieve table metadata before executing queries.

Can I run multi-step data analyses on clinical datasets and get pandas DataFrames directly?

Yes, you can run multi-step data analyses on clinical datasets and receive direct pandas DataFrames by chaining dataset configuration, schema discovery, and SQL execution functions.

What is the best way to integrate clinical dataset exploration into a Python pipeline without manual SQL scripts?

The best way to integrate clinical dataset exploration into a Python pipeline is using the M4 API to programmatically manage datasets and retrieve query results as native Python objects.

Does the M4 Python API require specific database dependencies to access clinical datasets?

No, the M4 Python API operates without external dependencies, allowing you to configure datasets, inspect schemas, and execute SQL queries directly within your Python code execution environment.