Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the measures framework integrate better with the rest of ehrQL #2313

Open
evansd opened this issue Dec 11, 2024 · 0 comments
Open

Make the measures framework integrate better with the rest of ehrQL #2313

evansd opened this issue Dec 11, 2024 · 0 comments

Comments

@evansd
Copy link
Contributor

evansd commented Dec 11, 2024

Various features we have added to ehrQL only work with dataset definitions and not with measure definitions. For example:

  • the sandbox command;
  • the show() function (and associated debug command and VSCode extension)
  • the assure command
  • the dump-dataset-sql command;
  • the create-dummy-tables command;

It's also hard to share logic between dataset definitions and measures because the measures logic will be parameterised over INTERVAL and there's currently no way of saying "in the context of this dataset INTERVAL should be (x, y)".

I think the workaround that's generally developed here is to write functions with take an interval parameter and return some ehrQL and then you can either feed that the INTERVAL placeholder to use it in measures or a fixed pair of dates to use it in a dataset definition. That's not great though.

Here's an early Slack thread describing the problem:
https://bennettoxford.slack.com/archives/C03FB777L1M/p1689603912839629

And here's a more recent thread describing problems and workarounds when attempting to test measure logic:
https://bennettoxford.slack.com/archives/C02HJTL065A/p1730805066648479


I'd like to come up with a principled approach to solving these, rather than just hacking our way through them one by one. For instance, it may be that we can abstract away the difference between dataset definitions and measures definitions into "Python file which describes some data you want to extract" and then make sure that all our commands accept either sort and do the right thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant