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

Feature request: add earliest_event_after() / latest_event_before() methods for DateEventSeries #2368

Open
evansd opened this issue Jan 21, 2025 · 1 comment
Labels
ergonomics Making ehrQL easier to use and read without adding substantial new features

Comments

@evansd
Copy link
Contributor

evansd commented Jan 21, 2025

I don't think we necessarily want to implement exactly this, but it's worth recording this kind of thing.

Original proposal was to be able to replace code like this:

dereg_date = (
    practice_registrations
    .where(practice_registrations.end_date.is_not_null())
    .where(practice_registrations.end_date.is_on_or_after(snapshot_date))
    .sort_by(practice_registrations.end_date)
    .first_for_patient()
    .end_date
)

With code like this:

dereg_date =  practice_registrations.end_date.earliest_event_after(snapshot_date)

But lots of useful discussion and other ideas in the Slack thread:
https://bennettoxford.slack.com/archives/C069YDR4NCA/p1737469592861429

@evansd evansd added the ergonomics Making ehrQL easier to use and read without adding substantial new features label Jan 21, 2025
@evansd
Copy link
Contributor Author

evansd commented Jan 21, 2025

Some related ideas also being kicked around in this Slack thread:
https://bennettoxford.slack.com/archives/C069YDR4NCA/p1732130446018819

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ergonomics Making ehrQL easier to use and read without adding substantial new features
Projects
None yet
Development

No branches or pull requests

1 participant