-
I've noticed some strange behaviour using the Here's what I want to do:
But it returns the following error: File "/app/cohortextractor/expressions.py", line 155, in insert_implicit_comparisons Note that if I conditioned on However, if I select the population like this instead (and then create a
Or, if I keep the original method for selecting the population, but define the variables that I'm minimising outside the
So it's straightforward to work around with either of the above solutions, but I thought I'd ask in case there was an obvious explanation that I'm missing! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
FWIW I recall encountering a similarish problem a while ago -- something like:
and it didn't like that It's not clear whether this is happening in your case as I can't see the full study definition -- can you link to it? (here or offline). Either way, it's some unexpected behaviour related to temporary variables. But not sure whether it's a bug in your script, or a bug in cohort extractor itself. |
Beta Was this translation helpful? Give feedback.
-
Hi @elsie-h, thanks for the very thorough issue description. It's definitely a bug with cohortextractor and not an issue with your code. I was in the process of writing up a ticket for this and explaining that we probably wouldn't be able to look at this for a while when I realised there was actually a quick fix for it! I've created a PR but it will need to get reviewed and merged and then you'll need to run It should be live by the end of the day though. |
Beta Was this translation helpful? Give feedback.
Hi @elsie-h, thanks for the very thorough issue description. It's definitely a bug with cohortextractor and not an issue with your code. I was in the process of writing up a ticket for this and explaining that we probably wouldn't be able to look at this for a while when I realised there was actually a quick fix for it!
I've created a PR but it will need to get reviewed and merged and then you'll need to run
opensafely pull cohortextractor
before you can use the new version of the code:opensafely-core/cohort-extractor#651
It should be live by the end of the day though.