-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ehrQL placeholders to research template
- Loading branch information
Showing
3 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Note: If you are using ehrQL to define your study population you need to: | ||
# (1) uncomment the ehrQL action in the project.yaml file (lines 14-18), | ||
# (2) delete the cohort-extractor action from the project.yaml file (lines 8-12), and | ||
# (3) delete the study_definition.py file. | ||
|
||
from ehrql import Dataset | ||
from ehrql.tables.beta.tpp import patients, practice_registrations | ||
|
||
dataset = Dataset() | ||
|
||
index_date = "2020-03-31" | ||
|
||
has_registration = practice_registrations.for_patient_on( | ||
index_date | ||
).exists_for_patient() | ||
|
||
dataset.age = patients.age_on(index_date) | ||
|
||
dataset.define_population(has_registration & (dataset.age > 17)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters