In question 10, we are asked to create a boolean patient series identifying patients without moderate or severe frailty in whom the last IFCC-HbA1c is 58 mmol/mol or less. The stated answer is:
questions[10].expected = (
has_moderate_or_severe_frailty.is_null()
& latest_hba1c_measurement.is_not_null()
& (latest_hba1c_measurement <= 58)
)
which I believe treats 'has_moderate_or_severe_frailty' as a date series, but it's actually a Boolean where some values are false, and some are true. We want to include patients where values == FALSE or missing, not just missing. I believe what we actually want is the following:
questions[10].expected = (
~has_moderate_or_severe_frailty
& latest_hba1c_measurement.is_not_null()
& (latest_hba1c_measurement <= 58)
)
or, possibly (if there are possible null values, which I am not confident there should be given how the earlier series is defined):
questions[10].expected = (
(~has_moderate_or_severe_frailty | has_moderate_or_severe_frailty.is_null())
& latest_hba1c_measurement.is_not_null()
& (latest_hba1c_measurement <= 58)
)
This could be my error as I have been using ehrql for a grand total of one (1) hour, but I wanted to raise it. At the moment the logic of has_moderate_or_severe_frailty.is_null() evaluates to all FALSE, because has_moderate_or_severe_frailty is never NULL (always true or false) - which means zero patients are included in the final population.
In question 10, we are asked to create a boolean patient series identifying patients without moderate or severe frailty in whom the last IFCC-HbA1c is 58 mmol/mol or less. The stated answer is:
which I believe treats 'has_moderate_or_severe_frailty' as a date series, but it's actually a Boolean where some values are false, and some are true. We want to include patients where values == FALSE or missing, not just missing. I believe what we actually want is the following:
or, possibly (if there are possible null values, which I am not confident there should be given how the earlier series is defined):
This could be my error as I have been using ehrql for a grand total of one (1) hour, but I wanted to raise it. At the moment the logic of has_moderate_or_severe_frailty.is_null() evaluates to all FALSE, because has_moderate_or_severe_frailty is never NULL (always true or false) - which means zero patients are included in the final population.