Skip to main content

Serialisation utilities for OMOP CDM cohorts and CQI builder

Project description

OA Cohorts – Reporting & Cohort Execution Engine

This package provides the core machinery for defining, executing, and inspecting cohort-based reports over OMOP-style clinical data. It’s designed to support building real-world evidence reports from composable clinical rules, measures, cohorts, and indicators, with both programmatic APIs and lightweight HTML rendering for debugging and exploration.

The framework implemented here supports configuration-driven clinical quality indicators over OMOP-harmonised data, with explicit support for disease and treatment episodes, temporality, and combinatorial logic. Measures can be defined in terms of diagnoses, treatments, procedures, observations, measurements, and demographics, and composed into clinically interpretable cohorts and indicators.

This enables the same indicator definitions to support bulk benchmarking, trend analysis over time, and patient-level drill-down, without rewriting query logic for each use case. In practice, this provides a bridge between formal indicator specifications and the operational reality of multidisciplinary care.

At a high level, the system lets you:

  • Define query rules (exact, hierarchical, scalar thresholds, phenotypes, etc.)
  • Combine rules into subqueries
  • Build measures from subqueries (including composite measures with AND/OR/EXCEPT logic)
  • Group measures into dash cohorts and cohort definitions
  • Define indicators (numerator/denominator pairs)
  • Assemble everything into a report
  • Execute the report against a database session and materialise results as in-memory member sets
  • Inspect SQL, executability, and structure via HTML renderers (handy in notebooks)

This is intentionally object-centric: once a report is executed, all downstream payloads (cohort pivots, indicator pivots, demographics, etc.) are assembled from the object graph rather than re-querying the database.

What’s here (roughly)

  • Report / ReportCohortMap: Top-level report definition, linking cohorts and indicators.
  • DashCohort / DashCohortDef: User-facing cohort groupings backed by executable measures.
  • Measure / MeasureSQLCompiler / MeasureExecutor: The core executable units. Measures compile to SQL, execute against a session, and materialise member sets with dating and episode context.
  • Indicator: Numerator/denominator semantics over measures, with temporal constraints.
  • QueryRule (+ subclasses): The rule DSL: exact matches, hierarchies, exclusions, scalar thresholds, phenotypes, substring matches, etc.
  • HTMLRenderable mixins: Lightweight visualisation of structure, SQL previews, and executability for debugging and exploration.

Execution model

report.execute(session)
report.assert_executed()

rows = report.members              # all cohort members
indicators = report.indicators     # now have numerator_members / denominator_members

Status

This is a working internal engine under active development. APIs may shift.

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

oa_cohorts-0.2.7.tar.gz (29.5 kB view details)

Uploaded Source

Built Distribution

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

oa_cohorts-0.2.7-py3-none-any.whl (41.6 kB view details)

Uploaded Python 3

File details

Details for the file oa_cohorts-0.2.7.tar.gz.

File metadata

  • Download URL: oa_cohorts-0.2.7.tar.gz
  • Upload date:
  • Size: 29.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for oa_cohorts-0.2.7.tar.gz
Algorithm Hash digest
SHA256 030b6440191a99cd4ddc2ad221c1bf701cab8195ef28cfdd1d8e372a214a33cd
MD5 6f9c5b25991cf69ccdc356a182d28257
BLAKE2b-256 367a24cbd30124fc21bc103e0aec17d9195b6c14d93f5f5247d0725ac1df3c0d

See more details on using hashes here.

Provenance

The following attestation bundles were made for oa_cohorts-0.2.7.tar.gz:

Publisher: pypi.yml on AustralianCancerDataNetwork/oa_cohort

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

File details

Details for the file oa_cohorts-0.2.7-py3-none-any.whl.

File metadata

  • Download URL: oa_cohorts-0.2.7-py3-none-any.whl
  • Upload date:
  • Size: 41.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for oa_cohorts-0.2.7-py3-none-any.whl
Algorithm Hash digest
SHA256 5d0ff71495cee5efa4f75b5b71cd1790641b9deab3397cfda6c9961b1f33cc51
MD5 3ca7fa0b37914c1161f8f1fc784e69b3
BLAKE2b-256 1c8d08a5c9ee5d50689356c65d77e105de5943e37d08752ad3ba9266d51a4766

See more details on using hashes here.

Provenance

The following attestation bundles were made for oa_cohorts-0.2.7-py3-none-any.whl:

Publisher: pypi.yml on AustralianCancerDataNetwork/oa_cohort

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