Toolkit and interactive widget for querying time-series healthcare data
Reason this release was yanked:
Temporary upload
Project description
TempoQL: Standardized Temporal Queries for ML in Healthcare
Quickstart
You may first want to create a conda environment to install packages in. Use a Python version between 3.10 and 3.14 for compatibility with TempoQL's dependencies. Clone the repo, cd into it and run pip install ..
We have had issues in the past running the JupyterLab widget with virtualenv - therefore we recommend using conda.
In demo.ipynb, we show how to use the query language using MIMIC-IV in OMOP format. You can run that notebook to explore how TempoQL enables simple, readable and precise queries on EHR data. We recommend installing JupyterLab (pip install jupyterlab), then running a JupyterLab instance (jupyter lab) in this repo directory, and opening and running demo.ipynb.
Example Usage
You will need a dataset and a dataset specification to start using TempoQL. Then, you can import TempoQL and use it in your Python code like this:
from tempo_ql import QueryEngine, GenericDataset, formats
db_specification = formats.omop() # also available: mimiciv(), eicu()
dataset = GenericDataset(sql_connection_string, db_specification)
query_engine = QueryEngine(dataset)
# see demo.ipynb for further options, such as configuring a variable store
query_engine.list_data_elements(scope="Measurement") # returns a dataframe of Measurement concepts
query_engine.query("{Temperature Celsius; scope = Measurement}") # retrieves temperature measurements
You can access the interactive query authoring environment like so:
query_engine.interactive(file_path=..., api_key=...)
Both file_path and api_key are optional. file_path allows you to read and
write queries from a local JSON file, enabling you to persist the queries that you
create in the interactive session. api_key can be a Gemini API key allowing you
to use LLMs to author, update, explain, and debug queries.
Dev Notes
Running the dev server: Make sure you have NodeJS version 20 or later. cd into the client directory, run npm install, then npm run dev. Then in your call to QueryEngine.interactive, set dev=True. Now when you change the frontend source code, the widget will automatically update.
If the Vite dev server stops working after you make some changes (it may show a JavaScript error like 'failed to load model'), check that any imports of TypeScript types are prefixed with the word type.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tempo_ql-0.1.1.tar.gz.
File metadata
- Download URL: tempo_ql-0.1.1.tar.gz
- Upload date:
- Size: 3.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c1c8f4cc69bf721015ca837b4e20a422a514bb5394b33ba169510bce0777debf
|
|
| MD5 |
6dc745cf6ddcdba6ab21e7dd71c02d73
|
|
| BLAKE2b-256 |
7a0628aa1c19c10c8a469526e56fec06e28ec6c9259c6c2f812ef93e59c9b290
|
File details
Details for the file tempo_ql-0.1.1-py3-none-any.whl.
File metadata
- Download URL: tempo_ql-0.1.1-py3-none-any.whl
- Upload date:
- Size: 185.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ba7f2ffd23082b46ce1ba7db1117bfb38c1b6c58041cc398fb8ebceec5e839ed
|
|
| MD5 |
b0448bf0e7dd7f1e81d9e8cafe32f227
|
|
| BLAKE2b-256 |
93f643eafb2e230955c1846be6f419e59ad442e80f636f52c6d8dbd7a8a9bb05
|