|
a |
|
b/docs/reference/upgrading-ehrql-from-v0-to-v1.md |
|
|
1 |
ehrQL v1 was released on Friday 8th December 2023. |
|
|
2 |
|
|
|
3 |
It contains a small number of breaking changes from v0. |
|
|
4 |
|
|
|
5 |
## Upgrading from v0 |
|
|
6 |
|
|
|
7 |
* In `project.yaml`, replace either `ehrql:v0` or `databuilder:v0` with `ehrql:v1` |
|
|
8 |
* From the command line, run `opensafely pull ehrql` |
|
|
9 |
|
|
|
10 |
## Breaking changes |
|
|
11 |
|
|
|
12 |
### Removal of `databuilder` imports |
|
|
13 |
|
|
|
14 |
Some projects have been using ehrQL from when the project was called "Databuilder". |
|
|
15 |
|
|
|
16 |
Update lines in your dataset definition that use `databuilder` imports to `ehrql`. |
|
|
17 |
For example, change: |
|
|
18 |
|
|
|
19 |
```python |
|
|
20 |
from databuilder import create_dataset |
|
|
21 |
``` |
|
|
22 |
|
|
|
23 |
to: |
|
|
24 |
|
|
|
25 |
```python |
|
|
26 |
from ehrql import create_dataset |
|
|
27 |
``` |
|
|
28 |
|
|
|
29 |
|
|
|
30 |
### Movement of tables out of the "beta" namespace |
|
|
31 |
|
|
|
32 |
Tables have been moved out of the "beta" namespace. |
|
|
33 |
|
|
|
34 |
Update lines in your dataset definition that import tables from the beta namespace. |
|
|
35 |
For example, change: |
|
|
36 |
|
|
|
37 |
```python |
|
|
38 |
from ehrql.tables.beta.core import patients |
|
|
39 |
``` |
|
|
40 |
|
|
|
41 |
to: |
|
|
42 |
|
|
|
43 |
```python |
|
|
44 |
from ehrql.tables.core import patients |
|
|
45 |
``` |
|
|
46 |
|
|
|
47 |
### Change to default size of dummy dataset |
|
|
48 |
|
|
|
49 |
By default, a dummy dataset will now contain data for 10 patients. |
|
|
50 |
This means when you generate a dummy dataset from the console, |
|
|
51 |
you get a tractable amount of output. |
|
|
52 |
|
|
|
53 |
This can be changed per dataset with: |
|
|
54 |
|
|
|
55 |
```python |
|
|
56 |
dataset.configure_dummy_data(population_size=1000) |
|
|
57 |
``` |
|
|
58 |
|
|
|
59 |
### Renaming of language features |
|
|
60 |
|
|
|
61 |
For consistency, a few small language features have been renamed. |
|
|
62 |
|
|
|
63 |
* `if_null_then` has been renamed to `when_null_then`. |
|
|
64 |
* The `default` argument to `case()` has been renamed to `otherwise`. |
|
|
65 |
* `Dataset.configure_dummy_dataset` has been renamed to `Dataset.configure_dummy_data`. |
|
|
66 |
|
|
|
67 |
|
|
|
68 |
### Deprecation of `tpp.hospital_admissions` table |
|
|
69 |
|
|
|
70 |
The `tpp.hospital_admissions` table duplicated the `tpp.apcs` table. |
|
|
71 |
Additionally, its `.primary_diagnoses` field should have been called `.primary_diagnosis`. |
|
|
72 |
|
|
|
73 |
Update lines in your dataset definition that use `tpp.hospital_admissions` to use `tpp.apcs` |
|
|
74 |
For example, change: |
|
|
75 |
|
|
|
76 |
```python |
|
|
77 |
from ehrql.tables.beta.core import hospital_admissions |
|
|
78 |
``` |
|
|
79 |
|
|
|
80 |
to: |
|
|
81 |
|
|
|
82 |
```python |
|
|
83 |
from ehrql.tables.core import apcs |
|
|
84 |
``` |
|
|
85 |
|
|
|
86 |
|
|
|
87 |
### Change to behaviour when household information is missing |
|
|
88 |
|
|
|
89 |
When querying `tpp.household_memberships_2020`, |
|
|
90 |
`None` is now returned instead of zero if information for a household is missing. |
|
|
91 |
|
|
|
92 |
|
|
|
93 |
## Getting help |
|
|
94 |
|
|
|
95 |
If you are stuck or unsure how to upgrade, ask your co-pilot or seek help in Slack. |