Personal Exposure Health Registry
Project description
compehndly (Python)
Architecture (Polars-First)
This package now follows a two-layer execution model for derived variables:
compehndly.polars.kernels
- Polars-native series kernels for external
map_batchesusage. - Contract:
kernel(*series: pl.Series, **params) -> pl.Series
compehndly.polars.adapters
- Frame adapters that apply kernels to:
polars.DataFrame(eager kernel path)polars.LazyFrame(expression path)
Public Entry Points
External integrations (already have a lazy orchestrator like apply_map):
from compehndly import get_map_fn
map_fn = get_map_fn("summation", all_required=True)
For config/YAML path-based loading, use stable wrappers in compehndly.entrypoints:
map_fn: compehndly.entrypoints.summation
# or
map_fn: compehndly.entrypoints.normalize_specific_gravity
Direct usage (you want this package to add a derived column):
from compehndly import with_derived_column
out = with_derived_column(
frame=df_or_lf,
function_name="summation",
input_columns=["a", "b"],
output_column="sum_col",
all_required=True,
)
# For non-commutative functions use a named mapping
out = with_derived_column(
frame=df_or_lf,
function_name="normalize_specific_gravity",
input_columns={"measured": "measurement_col", "sg_measured": "sg_col"},
output_column="normalized",
sg_ref=1.024,
)
Discover available functions:
from compehndly import list_functions
print(list_functions())
Direct series/expression application:
from compehndly import apply
out_series = apply("summation", df["a"], df["b"], all_required=False)
out_expr = apply("summation", pl.col("a"), pl.col("b"), all_required=False)
# Named data kwargs are supported
out_named = apply(
"normalize_specific_gravity",
measured=df["measured"],
sg_measured=df["sg_measured"],
sg_ref=1.024,
)
Current Scope
The pattern is applied to:
derived_variables.summationderived_variables.correctionderived_variables.imputation
Cross-Language Conformance
Shared test vectors live in:
shared/conformance/derived_variables_cases.json
Python and R should both execute this same file to verify parity. The Python runner is in:
python/tests/test_conformance_shared_vectors.py
Contributor Workflow (Two Steps)
Add one module in compehndly.derived_variables and do only:
- Implement one kernel:
def my_kernel(*series: pl.Series, scalar_a: float, ...) -> pl.Series
- Implement one expression builder:
def my_expr(*exprs: pl.Expr, scalar_a: float, ...) -> pl.Expr
Then expose one of:
FUNCTION_SPEC = DerivedFunctionSpec(
name="my_function",
kernel=my_kernel,
expr_builder=my_expr,
)
FUNCTION_SPECS = [
DerivedFunctionSpec(...),
DerivedFunctionSpec(...),
]
compehndly.api auto-discovers FUNCTION_SPEC / FUNCTION_SPECS, so there
is no central registry file to edit.
No per-function adapter wrappers are required.
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 compehndly-0.0.1a2.tar.gz.
File metadata
- Download URL: compehndly-0.0.1a2.tar.gz
- Upload date:
- Size: 9.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c4d378e6432751004d60e20869e947d4deca41594e98eefb4e0aeccef102e48
|
|
| MD5 |
bf81563251f984ffd52bbb2af13762e5
|
|
| BLAKE2b-256 |
47a72c1ce4f2a9e180359b2344602b1ef83192d4d3316cafbc76b8f3221a0253
|
Provenance
The following attestation bundles were made for compehndly-0.0.1a2.tar.gz:
Publisher:
publish.yml on eu-parc/compehndly
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
compehndly-0.0.1a2.tar.gz -
Subject digest:
3c4d378e6432751004d60e20869e947d4deca41594e98eefb4e0aeccef102e48 - Sigstore transparency entry: 1262563158
- Sigstore integration time:
-
Permalink:
eu-parc/compehndly@d0297643f21bddb73df6da5d41eea65bb9882346 -
Branch / Tag:
refs/tags/v0.0.1a2 - Owner: https://github.com/eu-parc
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d0297643f21bddb73df6da5d41eea65bb9882346 -
Trigger Event:
release
-
Statement type:
File details
Details for the file compehndly-0.0.1a2-py3-none-any.whl.
File metadata
- Download URL: compehndly-0.0.1a2-py3-none-any.whl
- Upload date:
- Size: 12.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
027dd5af61ca5f78ff34cc22068c9e0309464dfc05be32e39b49066ecb68fbb5
|
|
| MD5 |
d16e165fb246fbe7ef76432a9bac39f9
|
|
| BLAKE2b-256 |
3f4738aa01d628f26b434cf5f4fbe12fc85584a65a2d187ade3fce907f16512b
|
Provenance
The following attestation bundles were made for compehndly-0.0.1a2-py3-none-any.whl:
Publisher:
publish.yml on eu-parc/compehndly
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
compehndly-0.0.1a2-py3-none-any.whl -
Subject digest:
027dd5af61ca5f78ff34cc22068c9e0309464dfc05be32e39b49066ecb68fbb5 - Sigstore transparency entry: 1262563174
- Sigstore integration time:
-
Permalink:
eu-parc/compehndly@d0297643f21bddb73df6da5d41eea65bb9882346 -
Branch / Tag:
refs/tags/v0.0.1a2 - Owner: https://github.com/eu-parc
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d0297643f21bddb73df6da5d41eea65bb9882346 -
Trigger Event:
release
-
Statement type: