The Insights Real-time Information Service (IRIS) is a near real-time, free, publicly available push service for accessing Insights Solution data.
IRIS is based on the Advanced Message Queuing Protocol (AMQP) open-source standard and you will need a message client to access the data.
This repo contains a collection of example clients along with notes on how to write you own client.
Currently we have clients written in Python, Node.js and C#/.NET.
All clients will require you to enter your client credentials:
- queue name
- client ID
- client secret
You can request credentials on the Insights Solution.
To get started with an example client, clone this repo then follow the steps below
- Ensure you have installed Python (version 3.9 or above)
- Run
cd python
to navigate to thepython
directory - Run the following to activate a virtual environment and install the dependencies
python -m venv .venv
./.venv/Scripts/activate
pip install -r requirements.txt
- Copy the
settings.template.json
file and rename it tosettings.json
- Enter your client credentials into the
settings.json
file
{
"ClientId": "",
"QueueName": "",
"ServiceBusNamespace": "elexon-iris",
"Secret": "",
"RelativeFileDownloadDirectory": "./data"
}
- Run
python client.py
N.B. If you leave ClientId
and Secret
blank when running the client, it will open a browser window with a login page.
This may be useful during initial setup and testing but is not recommended for production use.
- Ensure you have installed Node.js (version 16.0.0 or above)
- Run
cd nodeJs
to navigate to thenodeJs
directory - Run
npm i
to install the dependencies - Copy the
.env.template
file and rename it to.env
- Enter your client credentials into the
.env
file
CLIENT_ID=
QUEUE_NAME=
SERVICE_BUS_NAMESPACE=elexon-iris
SECRET=
RELATIVE_FILE_DOWNLOAD_DIRECTORY=./data
- Run
npm run client
N.B. If you leave CLIENT_ID
and SECRET
blank when running the client, it will open a browser window with a login page.
This may be useful during initial setup and testing but is not recommended for production use.
- Ensure you have installed the .NET SDK (version 6 or above)
- Run
cd dotnet/IrisClient
to navigate to thedotnet/IrisClient
directory - Copy the
appsettings.template.json
file and rename it toappsettings.json
- Enter your client credentials into the
appsettings.json
file
{
"ClientId": "",
"QueueName": "",
"ServiceBusNamespace": "elexon-iris",
"Secret": "",
"RelativeFileDownloadDirectory": "./data"
}
- Run
dotnet build
to build the project - Run
dotnet run
N.B. If you leave ClientId
and Secret
blank when running the client, it will open a browser window with a login page.
This may be useful during initial setup and testing but is not recommended for production use.
Messages are stored in robust server-side queues, so it's not a problem if your connection is broken for a short while, but please note messages have a time-to-live value of 3 days. If you do not connect to IRIS for 3 days or more, some messages may have expired and no longer be available. In this case, it is possible to fill any data gaps using the APIs, given that they share the same output format.
When you receive a message it will be removed from the queue and won't be available again via IRIS. If you need to recover any data, you can use the API instead.
You don't need to write the messages to disk. All of our example clients do, but you might consider directly integrating your messages into existing messaging services or processing them immediately in memory instead.
It is only possible to have one connection per queue. If you need multiple connections you can either share the message content from your client or consider setting up a separate IRIS queue.
The message subject of each message is the dataset name (e.g. BOALF
).
IRIS and the Insight Solution APIs make available the same data, in the same output format, which enables you to use the API documentation as a reference when using IRIS.
This interchangeability allows you to decide which data source works best for you or to use a combination of both.
Azure provides SDKs for building clients. These are not strictly required, but they are definitely the easiest way to handle the authentication layer around AMQP.
Alongside your client credentials you will also need a TenantId
to connect your own client to IRIS. This value is 1a235385-5d29-40e1-96fd-bc5ec2706361
.
We suggest looking at the example clients to get an understanding of how a client should work. Roughly each client is made up of:
- main client file to pull together all the business logic
- service bus helper to handle the AMQP authentication layer
- settings file to store client credentials. It's important that this file is not checked into source control
- settings template file to help other developers understand which credentials are required. This file can be safely checked in to source control
- message processor to handle incoming IRIS messages
- error message processor to gracefully handle any errors
- date format helper to abstract away date string formatting logic (optional)
We're continuously making more data available through IRIS and further reducing latency. Help us improve the service by sharing your feedback to insightssupport@elexon.co.uk.
We also welcome contributions and suggestions directly to this repository. Please see our contributing guidelines for more information.