Skip to main content

Medial EarlySign Python

Project description

Medial EarlySign Python Library

Pepy Total Downloads PyPI - License GitHub contributors GitHub commit activity

GitHub Repo GitHub Repo stars

A note on our journey: Medial EarlySign was a company that developed a proprietary platform for machine learning on electronic medical records. Following the company's liquidation, the decision was made to release the core software as an open-source project to allow the community to benefit from and build upon this technology. Please feel free to reach me out in any case of an issue. I'm voluntarily holding this, so please be patients.

Our platform is designed to transform complex, semi-structured Electronic Medical Records (EMR) into machine-learning-ready data and reproducible model pipelines. The framework is optimized for the unique challenges of sparse, time-series EMR data, delivering low memory usage and high-speed processing at scale.

It was conceived as a TensorFlow for machine learning on medical data.

All software is now open-sourced under the MIT license. Some of the models developed by Medial EarlySign that are currently in production are available exclusively through our partners.

The framework was battle-tested in production across multiple healthcare sites and was a key component of an award-winning submission to the CMS AI Health Outcomes Challenge.

Why Use This Platform?

  • High-Performance Processing: Engineered for large-scale, sparse EMR time-series data where general-purpose libraries like pandas fall short.
  • Reusable Pipelines: Save valuable engineering time by providing shareable, tested pipelines and methods.
  • Built-in Safeguards: Mitigate common pitfalls like data leakage and time-series-specific overfitting.
  • Production-Ready: Designed for easy deployment using Docker or minimal distroless Linux images.
  • State of The Art Algorithms Developed state of the art algorithms for EMR use cases, explainablity and fairness and more.

Core Components

The platform is built on three key pillars:

  • MedRepository: A compact, efficient data repository and API for storing and accessing EMR signals. Querying categorical signals like perscriptions and diagnosis in an easy and efficient API.
  • MedModel: An end-to-end machine learning pipeline that takes data from MedRepository or JSON EMR inputs to produce predictions and explainability outputs. It supports both training and inference.
  • Medial Tools: A suite of utilities for training, evaluation, and workflow management, including bootstrap analysis, fairness checks, and explainability. MedPython is the Python alternative to replace all those tools.

From Raw Data to Insight in Four Simple Steps

Our platform streamlines the development and deployment of clinical predictive models, transforming raw patient data into actionable insights. For live predictions (inference), you can use raw JSON data directly, bypassing the need for an optimized data store.

This structured approach ensures that data is processed efficiently, models are built systematically, and the results are both accurate and interpretable.

The Workflow

1. Start with Raw Patient Data

Begin with your data in a simple JSON format.

{
  "patient_id": "1",
  "data": {
    "signals": [
      {
        "code": "Hemoglobin",
        "unit": "g/dL",
        "data": [
          { "timestamp": [20240806], "value": ["14.1"] },
          { "timestamp": [20250806], "value": ["14.5"] }
        ]
      },
      {
        "code": "Diagnosis",
        "data": [
          { "timestamp": [20240701], "value": ["ICD10_CODE:J20"] },
          ...
        ]
      },
      ...
    ]
  }
}

Load it into our Optimized Store or use it "as is" in deployment.

2. Define Your Label

For each patient, and for any chosen prediction date (after which no future information is provided to the model), specify what the outcome label should be for training or testing

3. Define Your ML Pipeline

Configure your entire machine learning workflow from preprocessing and feature engineering to the final model using a single JSON configuration file. This approach ensures your experiments are reproducible and easy to version.

4. Get Explainable Predictions

Train your model using the Python SDK and generate predictions with clear, interpretable explanations. Example output.

This is an illustration of the final output in a visual format (Our infrastructure returns the data to create this):

For more details, refer to the Tutorials.

Setup

You can quickly install the package using pip:

pip install medpython

Install and compile from github source code:

python -m pip install -v "medpython @ git+https://github.com/Medial-EarlySign/medpython.git/#subdirectory=Internal/MedPyExport/generate_binding"

System Requirements

Platform Support for MedPython

Platform x86_64 (Intel/AMD) aarch64 (ARM / Apple Silicon)
Linux (glibc) ✅ Pre-built (Py 3.10-3.14) ✅ Pre-built (Py 3.12)
Linux (Alpine/musl) 🛠️ Compile Required 🛠️ Compile Required
Windows ✅ Pre-built (Py 3.10-3.13) 🛠️ Compile Required
macOS ✅ Pre-built (Py 3.10-3.13) 🛠️ Compile Required

Note: For any Compile Required or either not listed as Pre-built. Compliation is required. Compilation in Alpine was also tested, but pre-builds are not provided.

  • Supported Systems: This linux pre-built version is available for modern Linux distributions (specifically manylinux2014 equivalents, such as CentOS >= 7 or Ubuntu >= 13.04).

Compilation for Other Systems More information in Installation

Release Notes

Please refer to Release Notes

Usage

import med
from AlgoMarker import AlgoMarker
from ETL_Infra import prepare_final_signals, prepare_dicts, finish_prepare_load, create_train_signal

More information on usage:

Getting Started

  • Build a new model: Follow the step-by-step Tutorials to build a model from scratch.
  • Use an existing model: Browse the collection of Models.

Community and Contributions

This is an open-source project, and we welcome contributions from the community.

  • Report issues or ask questions: Please use our Github Discussions.
  • Contribute to the code: Check out our repositories:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

medpython-1.1.0.tar.gz (28.5 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

medpython-1.1.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (13.8 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64

medpython-1.1.0-cp313-cp313-win_amd64.whl (10.4 MB view details)

Uploaded CPython 3.13Windows x86-64

medpython-1.1.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (13.8 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

medpython-1.1.0-cp313-cp313-macosx_15_0_x86_64.whl (8.0 MB view details)

Uploaded CPython 3.13macOS 15.0+ x86-64

medpython-1.1.0-cp312-cp312-win_amd64.whl (10.3 MB view details)

Uploaded CPython 3.12Windows x86-64

medpython-1.1.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (13.8 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

medpython-1.1.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl (13.1 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

medpython-1.1.0-cp312-cp312-macosx_15_0_x86_64.whl (8.0 MB view details)

Uploaded CPython 3.12macOS 15.0+ x86-64

medpython-1.1.0-cp311-cp311-win_amd64.whl (10.4 MB view details)

Uploaded CPython 3.11Windows x86-64

medpython-1.1.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (13.7 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

medpython-1.1.0-cp311-cp311-macosx_15_0_x86_64.whl (8.0 MB view details)

Uploaded CPython 3.11macOS 15.0+ x86-64

medpython-1.1.0-cp310-cp310-win_amd64.whl (10.4 MB view details)

Uploaded CPython 3.10Windows x86-64

medpython-1.1.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (13.7 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

medpython-1.1.0-cp310-cp310-macosx_15_0_x86_64.whl (8.0 MB view details)

Uploaded CPython 3.10macOS 15.0+ x86-64

File details

Details for the file medpython-1.1.0.tar.gz.

File metadata

  • Download URL: medpython-1.1.0.tar.gz
  • Upload date:
  • Size: 28.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for medpython-1.1.0.tar.gz
Algorithm Hash digest
SHA256 19b2a4e1c68104d3bf4d5001249f9e69566c886c1d57ef0d1c7ac15f7de53165
MD5 a48f48a55fab2c2a9c55c9090724982e
BLAKE2b-256 78b6dc444cedd13af821afaaa4e65abea69e55b798c78a2c3398e6204e967b83

See more details on using hashes here.

Provenance

The following attestation bundles were made for medpython-1.1.0.tar.gz:

Publisher: build_py.yaml on Medial-EarlySign/MR_Scripts

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file medpython-1.1.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for medpython-1.1.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 aef873913064283c1d4d6eb04011c628c28e70053a514c11c9e8f442a364d05e
MD5 cd6a9f5309d6452f3be19da3e51e222c
BLAKE2b-256 e463dadeed132be3d90d48ddd055df6e745a3a0761a78c7635f15bc72ed8a470

See more details on using hashes here.

Provenance

The following attestation bundles were made for medpython-1.1.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl:

Publisher: build_py.yaml on Medial-EarlySign/MR_Scripts

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file medpython-1.1.0-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: medpython-1.1.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 10.4 MB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for medpython-1.1.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 5e03851ace452f46bcd0b0085df8613fc4d8f115feb16c73033f8a791d1194fd
MD5 f56068537f55ccabf205164ce4e25bab
BLAKE2b-256 d6649df8e88b6de6355becda0313bbf022b8f9fe4a9ee4e7530b675bf43cf1d4

See more details on using hashes here.

Provenance

The following attestation bundles were made for medpython-1.1.0-cp313-cp313-win_amd64.whl:

Publisher: build_py_windows.yaml on Medial-EarlySign/MR_Scripts

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file medpython-1.1.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for medpython-1.1.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 ecb38a47cda7e90ba8e352523a8ad1d89cc0189c3a16fdc89395592791c907d0
MD5 077dd7342bb0cb1ed4483ad69ae6ead2
BLAKE2b-256 41932f65296d2ff7591853924eeb47b4d8aec701c8d67ad5e6081740f01cdc92

See more details on using hashes here.

Provenance

The following attestation bundles were made for medpython-1.1.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl:

Publisher: build_py.yaml on Medial-EarlySign/MR_Scripts

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file medpython-1.1.0-cp313-cp313-macosx_15_0_x86_64.whl.

File metadata

File hashes

Hashes for medpython-1.1.0-cp313-cp313-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 aa55d77e167178e316c997eefb9cd2eed67b21abdb604f933ecbafea778a0f23
MD5 447a22f6e9b851c0677d19234ac88a47
BLAKE2b-256 a1d060f546dd66c06063100a4985df5488d1656ecd839aaacafa93e342ab764f

See more details on using hashes here.

Provenance

The following attestation bundles were made for medpython-1.1.0-cp313-cp313-macosx_15_0_x86_64.whl:

Publisher: build_py_mac.yaml on Medial-EarlySign/MR_Scripts

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file medpython-1.1.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: medpython-1.1.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 10.3 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for medpython-1.1.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 e17611b66a5ab33c9099eccd106409167a40eb35d27776927802ae90e30765af
MD5 91d6377bc31b362ab03f7ce7544156d2
BLAKE2b-256 9b7ae909ae7951fa1f47c37d9dac1d3dbd13acd6f7fc0d1c86af8332c789bde8

See more details on using hashes here.

Provenance

The following attestation bundles were made for medpython-1.1.0-cp312-cp312-win_amd64.whl:

Publisher: build_py_windows.yaml on Medial-EarlySign/MR_Scripts

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file medpython-1.1.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for medpython-1.1.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 9f806252154e559db367fde90377ca8bc2059a83edea3531f7cb03d268fc5f31
MD5 ceedc1ebbbae30489cd2831ff76a9c4e
BLAKE2b-256 a70c4c970f443c647d3dfac6d632542f8faf25a13b9329555c8be98dc9d66fd8

See more details on using hashes here.

Provenance

The following attestation bundles were made for medpython-1.1.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl:

Publisher: build_py.yaml on Medial-EarlySign/MR_Scripts

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file medpython-1.1.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl.

File metadata

File hashes

Hashes for medpython-1.1.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 f0519de260901095d2a0f1c7ebb4be51c839d106d27b29fecca1c7d216c046f4
MD5 3eba37909d02743a140342faf9a8ac84
BLAKE2b-256 51058ecb9638cdb79f0efb1d6d32280ac3ad30f50e436fb58be87ffd6e395820

See more details on using hashes here.

Provenance

The following attestation bundles were made for medpython-1.1.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl:

Publisher: build_py_arm.yaml on Medial-EarlySign/MR_Scripts

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file medpython-1.1.0-cp312-cp312-macosx_15_0_x86_64.whl.

File metadata

File hashes

Hashes for medpython-1.1.0-cp312-cp312-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 968e41dddc93bb70f6453a4cd57aeef242e17872d7ae648fda3fc662015baa8b
MD5 eec59379ebfe1c8ac53f382a746469a1
BLAKE2b-256 62eae816d5e8d930fd0d1d8aa44b3fc0a017fa79df56e1d72837d9daa2003abc

See more details on using hashes here.

Provenance

The following attestation bundles were made for medpython-1.1.0-cp312-cp312-macosx_15_0_x86_64.whl:

Publisher: build_py_mac.yaml on Medial-EarlySign/MR_Scripts

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file medpython-1.1.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: medpython-1.1.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 10.4 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for medpython-1.1.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 dbcf4952efb85b41f9b4c7db1bd70a3b40b1cd63d78ff50cfbc12dd88689f3f7
MD5 3b17f8a89cf88ac1d50abf8c67af509d
BLAKE2b-256 09a4dc2c66d41b176919f62179129085470e55e956c3666b4455a90c7043e745

See more details on using hashes here.

Provenance

The following attestation bundles were made for medpython-1.1.0-cp311-cp311-win_amd64.whl:

Publisher: build_py_windows.yaml on Medial-EarlySign/MR_Scripts

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file medpython-1.1.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for medpython-1.1.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 73d8a0b673c1336a2ea420d92176ebc26b0260bfb9a1b94aea8c89472795902e
MD5 2de0e3eae0905bfa57783efd2fb3f0e2
BLAKE2b-256 4310c8613f9697bab652e91a80d444bca5ef6f8946f007102df001e5da88b484

See more details on using hashes here.

Provenance

The following attestation bundles were made for medpython-1.1.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl:

Publisher: build_py.yaml on Medial-EarlySign/MR_Scripts

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file medpython-1.1.0-cp311-cp311-macosx_15_0_x86_64.whl.

File metadata

File hashes

Hashes for medpython-1.1.0-cp311-cp311-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 27177c7ebfcc704c0f592f0f5d3ee9fbe2cc32787980ec42c21ebd339756c6cc
MD5 6627d90f3c61575d85b9aed77f023daf
BLAKE2b-256 ee5e0dc5fc527d67520ccd2b58461bc8fe0cdc8d46f9c9baf863ed79890c6dab

See more details on using hashes here.

Provenance

The following attestation bundles were made for medpython-1.1.0-cp311-cp311-macosx_15_0_x86_64.whl:

Publisher: build_py_mac.yaml on Medial-EarlySign/MR_Scripts

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file medpython-1.1.0-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: medpython-1.1.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 10.4 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for medpython-1.1.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 ad1d6bfd3f3433bb92c5cda3b76c9d2cabcd7ab5b4335ea0745acfa63d2b2402
MD5 f2efc394f8fa490b9067f5fed3580cab
BLAKE2b-256 557c13110d5760203276e5ab7db03b10d8fcfd3d44944d42ea55d25dd0451a2a

See more details on using hashes here.

Provenance

The following attestation bundles were made for medpython-1.1.0-cp310-cp310-win_amd64.whl:

Publisher: build_py_windows.yaml on Medial-EarlySign/MR_Scripts

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file medpython-1.1.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for medpython-1.1.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 0656faaf2ca6e4e6bdee3c9f036bde0ae3c303b1c6cbdeac259727c4c3cde92e
MD5 15802386c7e9ec63a5829d7b25a4809d
BLAKE2b-256 e5b9c55b6aa7282270d077bbf4011a6144a04d317d827299a76821a55ab22e52

See more details on using hashes here.

Provenance

The following attestation bundles were made for medpython-1.1.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl:

Publisher: build_py.yaml on Medial-EarlySign/MR_Scripts

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file medpython-1.1.0-cp310-cp310-macosx_15_0_x86_64.whl.

File metadata

File hashes

Hashes for medpython-1.1.0-cp310-cp310-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 67402e8d34dd4a058731f27c694a3ebb25264a8a10018491bbcfa9d5309b7815
MD5 2289e9c06ccc862107ab45ace3f85e3f
BLAKE2b-256 5ee392d96bda304c6d4d5bf2977476d72f03320a37b9f4c08304a8c0ca254800

See more details on using hashes here.

Provenance

The following attestation bundles were made for medpython-1.1.0-cp310-cp310-macosx_15_0_x86_64.whl:

Publisher: build_py_mac.yaml on Medial-EarlySign/MR_Scripts

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page