Skip to main content

Improved autocomplete for ehrQL

07 January 2025

We have made significant improvements to the autocomplete behaviour when writing ehrQL in VSCode, both locally and in online codespace environments. Previously autocomplete only worked on the first level for each table, so e.g. VSCode would know that the patients table had a column called date_of_birth, but it didn’t know that it was a column of dates. Now it does, so you can see all the date methods like is_after(date) and is_before(date), and the properties like day, month and year:

Autocomplete dropdown for a patient’s date of birth

A larger example is:

Animated gif showing autocomplete for a larger example

Every method and property in the above has autocomplete e.g. where, clinical_events.date, is_on_or_after, numeric_value, and maximum_for_patient(). Also, VSCode knows that the resulting variable highest_recent_hba1c is a numeric column and so provides relevant autocomplete such as as_int() in case you wanted to convert a patient’s recent hba1c to an integer.