cml-conversion-helpers
Helper functions for converting tidy-format datasets into the NHS CML schema (metric and dimension tables).
What this library does
CML expects data in two tables:
- Metric table — one row per data point, with fields such as
metric_id,metric_value,location_id,reporting_period_start_datetime, etc. - Dimensions table — one row per data point, one column per dimension (e.g. age group, ethnicity), linked to the metric table via
dimension_cohort_id.
This library takes a tidy-format source dataset (where dimensions are stored as rows, not columns) and provides utilities to transform it into those two tables.
Installation
pip install cml-conversion-helpers
Modules
cml_conversion_helpers.spark_functions.processing— Spark DataFrame transformation functionscml_conversion_helpers.spark_functions.dimension_cohorts— Spark dimension table helperscml_conversion_helpers.pandas_functions.processing— pandas DataFrame transformation functionscml_conversion_helpers.pandas_functions.dimension_cohorts— pandas dimension table helpers
Documentation
- Getting Started — installation, concepts, and input data requirements
- Usage Guide — config-driven, scripting, or hybrid approaches with full examples
- API Reference — full function reference grouped by module
Development
Before you build and publish, make sure you:
- Update the README.md if new instructions are needed
- Update the CHANGELOG.md (paste the git diff since the last version into your favourite bot and ask it to make you a changelog entry)
- Bump the version number (use SemVer) in pyproject.toml
When you are ready:
python -m venv venv
source venv/bin/activate # if on Linux or...
source venv/Scripts/activate # if on Windows
pip install build twine
python -m build
python -m twine upload dist/* # for PyPi or...
python -m twine upload --repository-url https://test.pypi.org/legacy/ dist/* # for Test PyPi
You'll be prompted for your API token, paste it in and press enter.
Acknowledgements
Some code written by Claude (Anthropic).
Metadata
Release files for cml-conversion-helpers 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cml_conversion_helpers-0.5.0.tar.gz | 10.3 kB | Without provenance | Details for cml_conversion_helpers-0.5.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cml_conversion_helpers-0.5.0-py3-none-any.whl | Python 3 | none | any | Details for cml_conversion_helpers-0.5.0-py3-none-any.whl |
Total release size: 23.2 kB
Release files / cml_conversion_helpers-0.5.0.tar.gz
| Download URL | cml_conversion_helpers-0.5.0.tar.gz |
|---|---|
| Size | 10.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
de033cc199b99ab16ba725b28de3c56bca88a9402e1e01a2598ab04dd1c60ad9
|
|
BLAKE2b-256 checksum How to use checksums |
8360eda46a69bbf4e54c14e6654e08fc15f7ab5e8646b298f5e81b278f79a440
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / cml_conversion_helpers-0.5.0-py3-none-any.whl
| Download URL | cml_conversion_helpers-0.5.0-py3-none-any.whl |
|---|---|
| Size | 12.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
483d2068bae3217aa4cacd23a32cb43568b022948b7dfddc17de802bf52586ad
|
|
BLAKE2b-256 checksum How to use checksums |
aa8bc7362a38a9e7fe13f5e009fdb62976bf6915031cedbc837bd1db0c1c2870
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Security for cml-conversion-helpers 0.5.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.