Setting up
In this section, you will set up everything you need to complete the tutorial.
Prerequisites🔗
You should have a GitHub personal account. See the "Signing up for a new GitHub account" page in the GitHub docs.
Cloning the template repository🔗
To start, clone the tutorial repository into your own GitHub account by clicking the following link: https://github.com/opensafely/ehrql-tutorial/generate.
Leave the "Include all branches" option unchecked, and, using the Owner drop-down menu, select your GitHub account as the owner.
Enter ehrql-tutorial
as the name for your repository, and "The OpenSAFELY ehrQL tutorial" as the description of your repository.
Choose "Public" as the repository visibility. Finally, click Create repository from template.
The new GitHub repository will take a moment to initialise, as it is running some setup in background. Wait about 1 minute, then reload the page.
Starting a new Codespace🔗
To work through this tutorial, you will need to use Codespaces.
What's a Codespace?
A Codespace is cloud-hosted environment where you can write and run code.
For more information, see our blog post: Research-ready computers in the cloud.
To launch a new Codespace, go to your new ehrql-tutorial
repository in your browser, click the green Code button, ensure the Codespaces tab is active, and click the Create codespace on main button.
A new browser tab will open and you'll see a notification in the bottom right of the screen saying "Building codespace..."
After a minute or two you'll see a screen that looks like this:
Firefox users may have to disable Enhanced Tracking Protection
If you see a message that says "Oh no, it looks like you are offline!" and you use Firefox, you will need to disable Enhanced Tracking Protection, which can be done via the shield icon to the left of the address bar:
You can dismiss any notifications, and close the terminal tab by clicking on the cross icon halfway up the screen on the right hand side.
To make sure everything's working correctly, open dataset_definition.py
by clicking on it in the Explorer tab on the left hand side, and then click the Run button.
You should see a new window showing a table showing the contents of the patients
table:
If you don't see this, get in touch with the OpenSAFELY tech team via your copilot, or by emailing tech@opensafely.org.