Skip to main content

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

cml_conversion_helpers-0.3.0.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cml_conversion_helpers-0.3.0-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

Details for the file cml_conversion_helpers-0.3.0.tar.gz.

File metadata

  • Download URL: cml_conversion_helpers-0.3.0.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.4 CPython/3.12.3 Linux/6.6.87.2-microsoft-standard-WSL2

File hashes

Hashes for cml_conversion_helpers-0.3.0.tar.gz
Algorithm Hash digest
SHA256 60d8432b3e0d7e43592c92bc7daaf349ea8878a7d11a35e601b4d4329b982db7
MD5 531a3a77ce36c7f1a74269b6a8436b2b
BLAKE2b-256 f9b33edc08df5fb29fdf6bca2c10d8d7cc5d5d31805d694edee5f1198a3f49fd

See more details on using hashes here.

File details

Details for the file cml_conversion_helpers-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: cml_conversion_helpers-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 11.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.4 CPython/3.12.3 Linux/6.6.87.2-microsoft-standard-WSL2

File hashes

Hashes for cml_conversion_helpers-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e081652e7795e18b1ea009fb52ef13700d289d30a2f3555ab9de7609a6f260c5
MD5 aed1338891f9bc4c4c2adf0e3d5e5a3e
BLAKE2b-256 fe586146e86789dc6cf0b164aff3f9ac3e7c0a40fe8f1704618f568c8d672651

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page