medmodels

MedModels is a high-speed RWE framework to apply the latest methods from scientific research to medical data.

https://github.com/limebit/medmodels

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.5%) to scientific vocabulary

Keywords

artificial-intelligence machine-learning medicine pharmacy science-research
Last synced: 6 months ago · JSON representation

Repository

MedModels is a high-speed RWE framework to apply the latest methods from scientific research to medical data.

Basic Info
  • Host: GitHub
  • Owner: limebit
  • License: bsd-3-clause
  • Language: Python
  • Default Branch: main
  • Homepage: https://www.medmodels.de
  • Size: 2.1 MB
Statistics
  • Stars: 10
  • Watchers: 2
  • Forks: 0
  • Open Issues: 54
  • Releases: 9
Topics
artificial-intelligence machine-learning medicine pharmacy science-research
Created over 2 years ago · Last pushed 7 months ago
Metadata Files
Readme License Code of conduct Codeowners Zenodo

README.md

MedModels Logo


Python Versions MedModels License Tests Coverage percentage PyPI Version Code Style

MedModels: A Rust-Powered Python Framework for Modern Healthcare Research

Motivation

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, faulty implementations and technical debt.

MedModels addresses these challenges by providing a standardized, reliable, and efficient framework for handling, processing, and analyzing electronic health records (EHR) and claims data.

Target Audience:

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

  • (Pharmaco-)Epidemiologists
  • Real-World Data Analysts
  • Health Economists
  • Clinicians
  • Data Scientists
  • Software Developers

Key Features

  • Rust-Based Data Class: Facilitates the efficient transformation of patient data into adaptable and scalable network graph structures.
  • High-Performance Computing: Handles large datasets in memory while maintaining fast processing speeds due to the underlying Rust implementation.
  • Standardized Workflows: Streamlines common tasks in real-world evidence analysis, reducing the need for custom code.
  • Interoperability: Supports collaboration and data sharing through a unified data structure and analysis framework.

Key Components

  • MedRecord Data Structure:

    • Graph-Based Representation: Organizes medical data using nodes (e.g., patients, medications, diagnoses) and edges (e.g., date, dosage, duration) to capture complex interactions and dependencies.
    • Efficient Querying: Enables efficient querying and retrieval of information from the graph structure, supporting various analytical tasks.
    • Dynamic Management: Provides methods to add, remove, and modify nodes and edges, as well as their associated attributes, allowing for flexible data manipulation.
    • Effortless Creation: Easily create a MedRecord from various data sources:
    • Pandas DataFrames: Seamlessly convert your existing Pandas DataFrames into a MedRecord.
    • Polars DataFrames: Alternatively, use Polars DataFrames as input for efficient data handling.
    • Standard Python Structures: Create a MedRecord directly from standard Python data structures like dictionaries and lists, offering flexibility for different data formats.
    • Grouping and Filtering: Allows grouping of nodes and edges for simplified management and targeted analysis of specific subsets of data.
    • High-Performance Backend: Built on a Rust backend for optimal performance and efficient handling of large-scale medical datasets.
  • Treatment Effect Analysis:

    • Estimating Treatment Effects: Provides a range of methods for estimating treatment effects from observational data, including:
    • Continuous Outcomes: Analyze treatment effects on continuous outcomes.
    • Binary Outcomes: Estimate odds ratios, risk ratios, and other metrics for binary outcomes.
    • Time-to-Event Outcomes: Perform survival analysis and estimate hazard ratios for time-to-event outcomes.
    • Effect Size Metrics: Calculate standardized effect size metrics like Cohen's d and Hedges' g.
    • Matching:
    • (High Dimensional) Propensity Score Matching: Reduce confounding bias by matching treated and untreated individuals based on their propensity scores.
    • Nearest Neighbor Matching: Match individuals based on similarity in their observed characteristics.

Getting Started

Installation:

MedModels can be installed from PyPI using the pip command:

bash pip install medmodels

Quick Start:

Here's a quick start guide showing an example of how to use MedModels to create a MedRecord object, add nodes and edges, and perform basic operations.

```python 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)

patientmedication = pd.DataFrame( [ ["Patient 02", "Med 01", pd.Timestamp("20200607")], ["Patient 02", "Med 02", pd.Timestamp("20180202")], ["Patient 03", "Med 02", pd.Timestamp("20190302")], ], columns=["PatID", "Med_ID", "Date"], )

Create a MedRecord object using the builder pattern

record = ( mm.MedRecord.builder() .addnodes((patients, "ID"), group="Patients") .addnodes((medications, "ID"), group="Medications") .addedges((patientmedication, "PatID", "MedID")) .add_group("US-Patients", nodes=["Patient 01", "Patient 02"]) .build() )

Print an combined overview of the nodes and edges in the MedRecord

print(record)

You can also print only nodes and edges respectively

print(record.overviewnodes()) print(record.overviewedges())

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']

Getting the nodes that are within a certain group

print(record.nodesingroup("Medications"))

Output: ['Med 02', 'Med 01']

Save the MedRecord to a file in RON format

record.to_ron("record.ron")

Load the MedRecord from the RON file

newrecord = mm.MedRecord.fromron("record.ron") ```

Owner

  • Name: Limebit
  • Login: limebit
  • Kind: organization
  • Email: info@limebit.de
  • Location: Berlin

Committers

Last synced: about 2 years ago

All Time
  • Total Commits: 21
  • Total Committers: 5
  • Avg Commits per committer: 4.2
  • Development Distribution Score (DDS): 0.381
Past Year
  • Commits: 21
  • Committers: 5
  • Avg Commits per committer: 4.2
  • Development Distribution Score (DDS): 0.381
Top Committers
Name Email Commits
Nicolas Siegl 1****l 13
Jakob Kraus m****l@j****e 5
Anastasiia Tiurina 1****a 1
Jakob Kraus 5****f 1
Martin Iniguez 6****z 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 227
  • Total pull requests: 255
  • Average time to close issues: about 1 month
  • Average time to close pull requests: 8 days
  • Total issue authors: 7
  • Total pull request authors: 7
  • Average comments per issue: 0.24
  • Average comments per pull request: 0.56
  • Merged pull requests: 214
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 125
  • Pull requests: 188
  • Average time to close issues: about 1 month
  • Average time to close pull requests: 8 days
  • Issue authors: 6
  • Pull request authors: 6
  • Average comments per issue: 0.14
  • Average comments per pull request: 0.72
  • Merged pull requests: 151
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • JabobKrauskopf (186)
  • MarIniOnz (32)
  • LauraBoenchenLB (9)
  • FloLimebit (6)
  • philippgrosser (3)
  • clstaudt (1)
  • philippkochlimebit (1)
Pull Request Authors
  • JabobKrauskopf (216)
  • MarIniOnz (90)
  • LauraBoenchenLB (18)
  • FloLimebit (16)
  • philippgrosser (2)
  • Copilot (1)
  • tiurina (1)
  • OFranke (1)
Top Labels
Issue Labels
python (112) rust (73) p-high (54) refactor (50) feat (46) p-medium (46) epic-task (32) p-low (30) docs (20) fix (19) p-critical (18) chore (13) p-backlog (12) epic (10) ci (8) test (7) build (6) needs triage (5) documentation (2)
Pull Request Labels
feat (2)

Packages

  • Total packages: 4
  • Total downloads:
    • cargo 19,322 total
    • pypi 2,041 last-month
  • Total dependent packages: 0
    (may contain duplicates)
  • Total dependent repositories: 0
    (may contain duplicates)
  • Total versions: 37
  • Total maintainers: 7
pypi.org: medmodels

Limebit Medmodels Package

  • Versions: 10
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 2,041 Last month
Rankings
Dependent packages count: 7.5%
Average: 38.7%
Dependent repos count: 69.8%
Last synced: 6 months ago
crates.io: medmodels-utils

Limebit MedModels Crate

  • Versions: 9
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 6,547 Total
Rankings
Dependent repos count: 27.5%
Dependent packages count: 36.5%
Average: 53.6%
Downloads: 96.6%
Last synced: 6 months ago
crates.io: medmodels-core

Limebit MedModels Crate

  • Versions: 9
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 6,492 Total
Rankings
Dependent repos count: 27.5%
Dependent packages count: 36.5%
Average: 53.6%
Downloads: 96.6%
Last synced: 6 months ago
crates.io: medmodels

Limebit MedModels Crate

  • Versions: 9
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 6,283 Total
Rankings
Dependent repos count: 27.5%
Dependent packages count: 36.5%
Average: 53.6%
Downloads: 96.6%
Last synced: 6 months ago