|
a |
|
b/tests/generative/example.py |
|
|
1 |
# A tiny example of a generative test case defined in a standalone file so that we can |
|
|
2 |
# check that the `test_query_model_example_file` function works correctly |
|
|
3 |
from ehrql.query_model.nodes import ( |
|
|
4 |
AggregateByPatient, |
|
|
5 |
Column, |
|
|
6 |
Dataset, |
|
|
7 |
SelectColumn, |
|
|
8 |
SelectPatientTable, |
|
|
9 |
TableSchema, |
|
|
10 |
) |
|
|
11 |
|
|
|
12 |
|
|
|
13 |
p0 = SelectPatientTable( |
|
|
14 |
"p0", |
|
|
15 |
TableSchema( |
|
|
16 |
i1=Column(int), |
|
|
17 |
), |
|
|
18 |
) |
|
|
19 |
|
|
|
20 |
dataset = Dataset( |
|
|
21 |
population=AggregateByPatient.Exists(p0), |
|
|
22 |
variables={"v": SelectColumn(p0, "i1")}, |
|
|
23 |
events={}, |
|
|
24 |
measures=None, |
|
|
25 |
) |
|
|
26 |
data = [] |