Skip to main content

Data quality and characterization metrics for Cumulus

Project description

Data Metrics

A Cumulus-based implementation of the qualifier metrics.

Implemented Metrics

The following qualifier metrics are implemented (per May 2025 qualifer definitions).

* These are US Core profile-based metrics, and the following profiles are not yet implemented:

  • Implantable Device (due to the difficulty in identify implantable records)
  • The various Vital Signs sub-profiles like Blood Pressure (just haven't gotten around to them yet)

Installing

pip install cumulus-library-data-metrics

Running the Metrics

These metrics are designed as a Cumulus Library study and are run using the cumulus-library command.

Local Ndjson

First, you'll want to organize your ndjson into the following file tree format:

root/
  condition/
    my-conditions.ndjson
  medicationrequest/
    1.ndjson
    2.ndjson
  patient/
    Patient.ndjson

(This is the same format that Cumulus ETL writes out when using --output-format=ndjson.)

Here's a sample command to run against that pile of ndjson data:

cumulus-library build \
  --db-type duckdb \
  --database output-tables.db \
  --load-ndjson-dir path/to/ndjson/root \
  --target data_metrics

And then you can load output-tables.db in a DuckDB session and see the results. Or read below to export the counts tables.

Athena

Here's a sample command to run against your Cumulus data in Athena:

cumulus-library build \
  --database your-glue-database \
  --workgroup your-athena-workgroup \
  --profile your-aws-credentials-profile \
  --target data_metrics

And then you can see the resulting tables in Athena. Or read below to export the counts tables.

Exporting Counts

For the metrics that have exportable counts (the characterization metrics mostly), you can easily export those using Cumulus Library, by replacing build in the above commands with export ./output-folder. Like so:

cumulus-library export \
  ./output-folder \
  --db-type duckdb \
  --database output-tables.db \
  --target data_metrics

Aggregate counts

This study generates CUBE output by default. If it's easier to work with simple aggregate counts of every value combination (that is, without the partial value combinations that CUBE() generates), run the build step with --option output-mode:aggregate.

That is, run it like:

cumulus-library build --option output-mode:aggregate ...

Bucket sizes

To help preserve privacy, this study ignores any count results of less than ten.

For example, if there are only two male patients that died at age 55, that combination of male & 55 will be dropped from the c_pt_deceased_count table.

This makes it easier to share the count results with other institutions. But if that's not a concern and you want the fine-grained details, you can run the build step with --option min-bucket-size:0 to turn this feature off. Or use another value to change the bucket threshold (the default value is 10).

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

cumulus_library_data_metrics-8.1.0.tar.gz (74.1 kB view details)

Uploaded Source

Built Distribution

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

cumulus_library_data_metrics-8.1.0-py3-none-any.whl (87.5 kB view details)

Uploaded Python 3

File details

Details for the file cumulus_library_data_metrics-8.1.0.tar.gz.

File metadata

File hashes

Hashes for cumulus_library_data_metrics-8.1.0.tar.gz
Algorithm Hash digest
SHA256 210205ffb1ba5b76b94a430a49b985705a7b545a42b4243dc72b79eba7fb696c
MD5 4ed58af29c94b0c6fc71b353f256a0a8
BLAKE2b-256 86077b26893d6e436e91d7137e7825c1690cc157ca95523811c6bde960f318c6

See more details on using hashes here.

Provenance

The following attestation bundles were made for cumulus_library_data_metrics-8.1.0.tar.gz:

Publisher: pypi.yaml on smart-on-fhir/cumulus-library-data-metrics

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cumulus_library_data_metrics-8.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for cumulus_library_data_metrics-8.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b0a33a36dae7b12fdb0161a3ddc5566d51b7b2f11a0d524f0f6abf3a4754fcca
MD5 caddcf7f6fe07de90a65edd2229fb5a1
BLAKE2b-256 4f07a30a97c299d35749c70460f3bde37dd237519287f8a6bd3dd1d12b3982b3

See more details on using hashes here.

Provenance

The following attestation bundles were made for cumulus_library_data_metrics-8.1.0-py3-none-any.whl:

Publisher: pypi.yaml on smart-on-fhir/cumulus-library-data-metrics

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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