mimic-table-relationships

Clarify MIMIC-IV identifier hierarchies and join patterns for hospital and ICU tables.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Understand MIMIC-IV table relationships, join patterns, and identifier hierarchy to ensure correct data linkage and avoid duplicates.

Core Features & Use Cases

  • Clarifies identifier hierarchy: subject_id -> hadm_id -> stay_id and core table relationships across hospital and ICU modules.
  • Guides correct join patterns to prevent duplicates and enable time-bounded analyses.
  • Use case: debugging complex queries that cross admissions and ICU stays, ensuring accurate cohort definitions.

Quick Start

Ask the AI to map a patient’s subject_id through hadm_id to stay_id to locate ICU events and link hospital and ICU data.

Frequently Asked Questions about mimic-table-relationships

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

FAQPage Schema
How do I join MIMIC-IV hospital and ICU tables without creating duplicate records?

Joining MIMIC-IV tables without duplicates requires mapping the subject_id, hadm_id, and stay_id identifier hierarchy and applying time-bounded query patterns across hospital and ICU modules.

What is the correct identifier hierarchy for linking MIMIC-IV patient data?

The correct MIMIC-IV identifier hierarchy flows from subject_id to hadm_id, and then to stay_id, linking patients across hospital admissions and ICU stays for accurate cohort definitions and event tracking.

How do I map a subject_id through hadm_id to stay_id to locate ICU events?

Map a patient's subject_id through their hadm_id admissions to the specific stay_id, linking hospital and ICU data to accurately locate ICU events and build reliable time-bounded queries.

Why does my SQL query produce duplicates when crossing MIMIC-IV admissions and ICU stays?

MIMIC-IV SQL queries produce duplicates when crossing admissions and ICU stays due to incorrect table joins, requiring strict adherence to the stay_id hierarchy and time-bounded query constraints to prevent erroneous merges.

Can I use this Skill for clinical research cohort definitions using MIMIC-IV?

Yes, you can use this for clinical research cohort definitions using MIMIC-IV, as it clarifies core table relationships and identifier hierarchies to ensure reliable integration and accurate data linkage.