Helper functions for converting data to the NHS CML schema format.
Project description
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.processing— DataFrame transformation functions
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
Codespaces
If you're using GitHub Codespaces, the container will set itself up automatically — just wait a few minutes for it to finish. Once it's ready, activate the Poetry environment in the terminal:
eval $(poetry env activate)
Local
poetry install
poetry run pytest
Acknowledgements
Some code written by Claude (Anthropic).
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
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 cml_conversion_helpers-0.4.0.tar.gz.
File metadata
- Download URL: cml_conversion_helpers-0.4.0.tar.gz
- Upload date:
- Size: 9.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1e8cba94a915ab19ff91efbb5deadb09cfc64dd381194abf130b20409e4d79e0
|
|
| MD5 |
afc5d60d2fa2094d905035d77a16c33c
|
|
| BLAKE2b-256 |
0b40bd039fd35027b3675ca3205c0f8b1585a8807b942fbca6e97a75c923c066
|
File details
Details for the file cml_conversion_helpers-0.4.0-py3-none-any.whl.
File metadata
- Download URL: cml_conversion_helpers-0.4.0-py3-none-any.whl
- Upload date:
- Size: 12.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b6ce8bfca1c7370e8efac718c41b59b1e56f37a18d8ef00519b97a7797bcda9
|
|
| MD5 |
72148cdc48dc7450ad42793fec55a70f
|
|
| BLAKE2b-256 |
95a443aa65819fef589290989c637c28f3808bd6ff10222e35529d3841956828
|