MedModels Logo

A Rust-Powered Python Framework for Modern Healthcare Research

MedModels provides a standardized, reliable, and efficient framework for handling, processing, and analyzing claims data and electronic health records (EHR).

Why MedModels?

Analyzing real-world evidence, especially patient data, is a complex task demanding accuracy and reproducibility. Currently, research teams often re-implement the same statistical methods and data processing pipelines, leading to inefficient codebases and technical debt.

MedRecord Data Structure

A graph-based representation that organizes medical data using nodes and edges to capture complex interactions and dependencies.

  • Efficient querying and data retrieval
  • Dynamic management of nodes and edges
  • Support for multiple data sources

Standardized Workflows

Streamlines common tasks in real-world evidence analyses, reducing the need for custom code.

  • Consistent analysis pipelines
  • Reproducible research methods
  • Reduced technical debt

Rust-Powered Performance

Built on a Rust backend for optimal performance and efficient handling of large-scale medical data.

  • High-performance computing
  • Memory-efficient data handling
  • Familiar Python interface

Additional Key Features

Treatment Effect Analysis

Comprehensive tools for estimating treatment effects from observational data with statistical rigor.

Effortless Creation

Create MedRecord from Pandas DataFrames, Polars DataFrames, or standard Python data structures.

Interoperability

Supports collaboration and data sharing through a unified data structure and analysis framework.

Quick Start Example

See how MedModels simplifies healthcare data analysis with an intuitive Python interface powered by Rust.

example.py
import pandas as pd
import medmodels as mm

# Patients DataFrame (Nodes)
patients = pd.DataFrame(
    [
        ["Patient 01", 72, "M", "USA"],
        ["Patient 02", 74, "M", "USA"],
        ["Patient 03", 64, "F", "GER"],
    ],
    columns=["ID", "Age", "Sex", "Loc"],
)

# Medications DataFrame (Nodes)
medications = pd.DataFrame(
    [["Med 01", "Insulin"], ["Med 02", "Warfarin"]], columns=["ID", "Name"]
)

# Patients-Medication Relation (Edges)
patient_medication = pd.DataFrame(
    [
        ["Patient 02", "Med 01", pd.Timestamp("20200607")],
        ["Patient 02", "Med 02", pd.Timestamp("20180202")],
        ["Patient 03", "Med 02", pd.Timestamp("20190302")],
    ],
    columns=["Pat_ID", "Med_ID", "Date"],
)

# Create a MedRecord object using the builder pattern
record = (
    mm.MedRecord.builder()
        .add_nodes((patients, "ID"), group="Patients")
        .add_nodes((medications, "ID"), group="Medications")
        .add_edges((patient_medication, "Pat_ID", "Med_ID"))
        .add_group("US-Patients", nodes=["Patient 01", "Patient 02"])
        .build()
)

# Print an combined overview of the nodes and edges in the MedRecord
print(record)

# Accessing all available nodes
print(record.nodes)
# Output: ['Patient 03', 'Med 01', 'Med 02', 'Patient 01', 'Patient 02']

# Accessing a certain node and its attributes
print(record.node["Patient 01"])
# Output: {'Age': 72, 'Loc': 'USA', 'Sex': 'M'}

# Getting all available groups
print(record.groups)
# Output: ['Medications', 'Patients', 'US-Patients']

This example shows how to create a MedRecord object, add nodes and edges, and perform basic operations.

Who It's For

MedModels is designed for a wide range of users working with real-world data and electronic health records.

(Pharmaco-)Epidemiologists

Analyze real-world evidence with standardized methods and reproducible workflows.

Real-World Data Analysts

Process and analyze large-scale healthcare datasets efficiently and reliably.

Health Economists

Evaluate healthcare interventions and outcomes with robust statistical methods.

Clinicians

Extract meaningful insights from patient data to inform clinical decision-making.

Data Scientists

Leverage high-performance computing for complex healthcare data analysis.

Software Developers

Build healthcare applications with a reliable and efficient data processing framework.

Installation

Get started with MedModels in minutes. Our framework is available on PyPI.

Terminal
pip install medmodels

Supported Python Versions

  • Python 3.10
  • Python 3.11
  • Python 3.12
  • Python 3.13
MedModels Logo

Ready to Transform Your Healthcare Research?

Start using MedModels today to standardize your healthcare data analysis workflows and improve reproducibility.