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.4.0.tar.gz (9.2 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.4.0-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

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

Hashes for cml_conversion_helpers-0.4.0.tar.gz
Algorithm Hash digest
SHA256 1e8cba94a915ab19ff91efbb5deadb09cfc64dd381194abf130b20409e4d79e0
MD5 afc5d60d2fa2094d905035d77a16c33c
BLAKE2b-256 0b40bd039fd35027b3675ca3205c0f8b1585a8807b942fbca6e97a75c923c066

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cml_conversion_helpers-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2b6ce8bfca1c7370e8efac718c41b59b1e56f37a18d8ef00519b97a7797bcda9
MD5 72148cdc48dc7450ad42793fec55a70f
BLAKE2b-256 95a443aa65819fef589290989c637c28f3808bd6ff10222e35529d3841956828

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