Skip to content

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.

Starting a new Codespace🔗

To work through this tutorial, you will need to use Codespaces. We have set up a GitHub repository for you to use to create a Codespace suitable for the tutorial.

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 the GitHub repository in your browser, click the green Code button, ensure the Codespaces tab is active, and click the Create codespace on main button.

A screenshot of the buttons that need to be clicked

A new browser tab will open and you'll see a notification in the bottom right of the screen saying "Building codespace..."

A screenshot of the notification saying "Building codepsace..."

After a minute or two you'll see a screen that looks like this:

New Codespace screen

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:

Enhanced Tracking Protection settings

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.

Run button

You should see a new window showing a table showing the contents of the patients table:

Output from a sucessful run

If you don't see this, get in touch with the OpenSAFELY tech team via your copilot, or by emailing tech@opensafely.org.

Next: Working with data with ehrQL