A Polars plugin for easily scheduling recurring events with constraints.
Project description
Polars Scheduler
A Polars plugin for easily scheduling recurring events with constraints.
Installation
pip install polars-scheduler[polars]
On older CPUs run:
pip install polars-scheduler[polars-lts-cpu]
Usage
The plugin adds a scheduler namespace to Polars DataFrames with methods for registering events and
constraints:
import polars as pl
import polars_scheduler
# Create a new empty schedule
schedule = pl.DataFrame().scheduler.new()
# Add simple meal and medication schedule
schedule = schedule.scheduler.add(
event="breakfast",
category="meal",
unit="serving",
frequency="1x daily",
)
...
The idea is that you have a DataFrame with a schedule of the day so far perhaps (in this case I don't as it's still a proof-of-concept) and then you have the recurring events expressed as a schedule with constraints.
This schedule of constraints would get built up (as in this example, see examples/nutrition.py)
and then you would validate or schedule ahead.
┌──────────────┬────────────┬─────────┬────────┬─────────┬───────────┬──────────────┬──────────────┐
│ Event ┆ Category ┆ Unit ┆ Amount ┆ Divisor ┆ Frequency ┆ Constraints ┆ Note │
│ --- ┆ --- ┆ --- ┆ --- ┆ --- ┆ --- ┆ --- ┆ --- │
│ str ┆ str ┆ str ┆ f64 ┆ i64 ┆ str ┆ list[str] ┆ str │
╞══════════════╪════════════╪═════════╪════════╪═════════╪═══════════╪══════════════╪══════════════╡
│ breakfast ┆ meal ┆ serving ┆ null ┆ null ┆ 1x daily ┆ [] ┆ null │
│ lunch ┆ meal ┆ serving ┆ null ┆ null ┆ 1x daily ┆ [] ┆ null │
│ dinner ┆ meal ┆ serving ┆ null ┆ null ┆ 1x daily ┆ [] ┆ null │
│ vitamin ┆ supplement ┆ pill ┆ null ┆ null ┆ 1x daily ┆ ["with ┆ null │
│ ┆ ┆ ┆ ┆ ┆ ┆ breakfast"] ┆ │
│ antibiotic ┆ medication ┆ pill ┆ null ┆ null ┆ 2x daily ┆ ["≥1h after ┆ null │
│ ┆ ┆ ┆ ┆ ┆ ┆ meal"] ┆ │
│ probiotic ┆ supplement ┆ capsule ┆ null ┆ null ┆ 1x daily ┆ ["≥2h after ┆ null │
│ ┆ ┆ ┆ ┆ ┆ ┆ antibiotic"] ┆ │
│ protein ┆ supplement ┆ gram ┆ 30.0 ┆ null ┆ 1x daily ┆ ["≤30m after ┆ mix with │
│ shake ┆ ┆ ┆ ┆ ┆ ┆ gym OR with ┆ 300ml water │
│ ┆ ┆ ┆ ┆ ┆ ┆ breakfast"] ┆ │
│ ginger ┆ supplement ┆ shot ┆ null ┆ null ┆ 1x daily ┆ ["before ┆ null │
│ ┆ ┆ ┆ ┆ ┆ ┆ breakfast"] ┆ │
│ gym ┆ exercise ┆ session ┆ null ┆ null ┆ 3x weekly ┆ [] ┆ null │
└──────────────┴────────────┴─────────┴────────┴─────────┴───────────┴──────────────┴──────────────┘
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 polars_scheduler-0.1.1.tar.gz.
File metadata
- Download URL: polars_scheduler-0.1.1.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.22.3 CPython/3.10.6 Linux/5.15.0-125-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
541b10f869276a3fba27fd22895af3780274fe58d4ead3770e934c7f24a2b029
|
|
| MD5 |
42ee572df96181a6e8eb208604b47ffd
|
|
| BLAKE2b-256 |
4959bb30bf9804a1ef77937950e6e7eed8acc5ea080eb3076b154bc116a59527
|
File details
Details for the file polars_scheduler-0.1.1-py3-none-any.whl.
File metadata
- Download URL: polars_scheduler-0.1.1-py3-none-any.whl
- Upload date:
- Size: 3.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.22.3 CPython/3.10.6 Linux/5.15.0-125-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aadd806aba4b6d4a31a6daa231f3e44b05faf736366881fd4a8c6f9ac634d624
|
|
| MD5 |
f673255807dea627605dd00c25769e34
|
|
| BLAKE2b-256 |
fb4c986f1f502406371a72ea2f105a3c12fbc4f996da8df36fcc4a987ffcf590
|