Skip to main content

ehrQL's measures framework has disclosure control enabled by default

27 November 2023

ehrQL’s measures framework is used to calculate quotients (i.e. a numerator divided by a denominator) and to see how these vary over time and when broken down by different groupings.

Previously, numerators and denominators were not subject to disclosure control: a user had to apply disclosure control by writing their own downstream action. Now, ehrQL’s measures framework has disclosure control enabled by default. First, values less than or equal to seven are replaced with zero (suppressed); then, values are rounded to the nearest five.

When the built-in disclosure control method is unhelpful, such as when an alternative method is required or when unsuppressed/unrounded values are needed by a downstream action, the configure_disclosure_control method allows a user to disable disclosure control. For example:

measures = create_measures()

measures.configure_disclosure_control(enabled=False)

measures.define_measure(...)

For more information about disclosure control in OpenSAFELY, please see the “Updated disclosure control guidance” page.

As always, if you need help with ehrQL, then please ask for help on the #ehrql-support Slack channel. (If you’re unsure how to join, then please ask your co-pilot.)