Skip to content

Minimal emisv2 backend#2735

Draft
rebkwok wants to merge 1 commit intomainfrom
wip-emisv2
Draft

Minimal emisv2 backend#2735
rebkwok wants to merge 1 commit intomainfrom
wip-emisv2

Conversation

@rebkwok
Copy link
Copy Markdown
Contributor

@rebkwok rebkwok commented Apr 1, 2026

The absolute minimum needed to create an EMIS V2 backend that can be used to run the smoketest dataset definition against the EMIS test database.

To test the connection:

ehrql test-connection --backend emisv2 --url trino://<username>:<token>@explorerplus.stagingemisinsights.co.uk:443/hive/explorer_open_safely

To run the smoketest dataset definition:

ehrql generate-dataset tests/acceptance/external_studies/test-age-distribution/analysis/dataset_definition.py --backend emisv2 --query-engine trino --dsn trino://<username>:<token>@explorerplus.stagingemisinsights.co.uk:443/hive/explorer_open_safely

We don't have permission to create tables in the test db, hence the change to the Trino query engine; we should assume we will have that permission eventually, so that's just a workaround to get it working.

The patient table in the test db also has no date_of_birth values (it's null for every patient), so if you want to see it return anything from the smoketest dataset definition, you'll need to modify the population definition there.

# We currently don't have permission to create tables in the EMIS
# staging db.
if self.backend.display_name == "EMISV2":
return query.alias()
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: you need this (atm) in order to try running ehrql against the staging db locally. We don't want to put it into the actual code because we expect to to be able to create tables, so we want to run tests using the create-tables code. (We might need some modification in order to create them in another schema.)

@alarthast
Copy link
Copy Markdown
Contributor

Moved the codebase changes to #2746; I did not repeat the instructions for local connection there (but I verified that they work for me too).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants