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.2.0.tar.gz (5.1 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.2.0-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cml_conversion_helpers-0.2.0.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.11.15 Linux/6.8.0-1044-azure

File hashes

Hashes for cml_conversion_helpers-0.2.0.tar.gz
Algorithm Hash digest
SHA256 9629c3e5c6507afed7d246579b5c857d1cc25744e613c98d43c84e75f768bddd
MD5 122660ea44f0d915ae650645c0af4ef7
BLAKE2b-256 1d478fb0c8086f87430ba10e7c02d49d0cb9de48ef0ac0a773c6b95e9c991073

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cml_conversion_helpers-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d7fbc2401e7cb8c226fd55d7b225535f6f917aa3fa9e113c778fbf3002f25677
MD5 8c2c674774ecdda8bf8c454dcf0c65fa
BLAKE2b-256 707a739a4a4d1e06fa178ab12d682ca289770d1d1817c48fbed9c2f2680a4e61

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