Skip to content

Commit

Permalink
Merge pull request opensafely#111 from opensafely/tweak-dataset-defin…
Browse files Browse the repository at this point in the history
…ition

Tweak dataset definition
  • Loading branch information
StevenMaude authored Nov 30, 2023
2 parents 18f2133 + c84e02a commit ff3ffc0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions analysis/dataset_definition.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
from ehrql import Dataset
from ehrql import create_dataset
from ehrql.tables.beta.tpp import patients, practice_registrations

dataset = Dataset()
dataset = create_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.define_population(has_registration & (dataset.age > 17))
dataset.sex = patients.sex

0 comments on commit ff3ffc0

Please sign in to comment.