Open Jongmassey opened 4 months ago
Following further discussion in another thread the issue appears to be an invalid example rather than a bug in ehrQL.
In the example test script, the patients
data for the first patient is defined correctly as a dict:
test_data = {
# Expected in population with matching medication
1: {
"patients": {"date_of_birth": date(1950, 1, 1)},
"medications": [
{
# First matching medication
"date": date(2010, 1, 1),
"dmd_code": "39113311000001107",
},
...
But the second and third patients are defined as a list of dicts:
2: {
"patients": [{"date_of_birth": date(1950, 1, 1)}],
"medications": [],
...
Which is causing the error, because the script expects a one-row-per-patient table to be defined as a dict.
We should therefore:
@milanwiedemann reported a problem with
assure
in this Slack threadI can replicate this problem. Using the example
dataset_definition.py
andtest_dataset_definition.py
from How to test your dataset definition in the ehrql docs, I get the following error output from theassure
commandwhen starting from a fresh repo based on the research-template.