Skip to content

StatsWales Help

Introduction

StatsWales is the Welsh Government’s free-to-use online repository for detailed statistical data for Wales. StatsWales allows users to view and manipulate datasets on-screen, including the ability to produce charts. Data can be downloaded in a variety of formats and can be saved and shared. The system covers nearly 1,000 datasets, including key information on Wales’ population, economy, government spending and performance as well as the environment, education, transport and health.

Locating Data

There are 2 ways to find data:

1 Browsing the catalogue

Tables and charts are organised into statistical themes and are found by browsing through the catalogue structure on the left-hand side of the page. Tables and charts appear in the window on the right-hand side under the ‘Reports’ heading. Click the title of the report to view it.

Locating Data

2 Searching

If you are not sure where to find the data you need then there is a search facility at the top of the webpage. Enter your search term and click the magnifying glass icon. A list of reports and other documents relating to your search will appear. Click on the title of the report to view the data.

Organising Data

Once you’ve clicked on a report, you’ll be presented with a table of data organised in a predetermined way, this is normally just a high level view of a larger data set which you can explore through a few different methods:

Organising Data

Selecting data

The drop-down boxes within the body of the table allow you to choose which items will appear in your table. The drop-down box displays an expandable list of the available data items which can be ticked or un-ticked.

Selecting data

Tip: The size of the drop-down box can be changed by dragging the bottom right-hand corner.

Expand & Collapse

Any items appearing in the tables with either a ‘+’ or ‘-‘ sign can be expanded or collapsed respectively. This allows you to explore the underlying data of individual data items. If you wish to expand or collapse all the items in the table then click the text next to the ‘+’ or ‘-‘ sign using the right mouse button. This brings up another menu that allows you to expand or collapse all the items at once.

Expand & Collapse

Drag & Drop

The elements of the table can be dragged and dropped either to the left or to the top of the table to create the view of the data that you need. Drag the elements within the table until 2 small arrows appear and then drop them in the appropriate place in the table. To remove an element from the table, drag the element into the filter bar directly above the table.

Tip: Look for the 2 small arrows before dropping

Drag & Drop

Nesting elements together

A table can have a number of elements nested together either on the left hand side or at the top of the table. Drag the element and drop it next to the element that is already within the body of the table and the elements will be displayed alongside each other. In order to view the data once elements have been nested, it is sometimes necessary to expand the items within the table using the techniques described above.

Filter bar

The filter bar is located directly above the table and can contain a number of elements. Only one item for each element is selectable and the data in the table will change once selected. These elements can be used to derive the data within the table or they can be dragged into the body of the table. Similarly, elements that you don’t want to show within the body of the table can be dragged up into the filter bar.

Filter bar

Some elements display left and right arrows which allow you to change items easily.

Filter bar

Tip: When dragging and dropping elements to and from the filter bar, make sure you drag the elements just below the drop down boxes.

Sorting data

The data within the table can be organised by sorting on the item labels or data values. Triangles appear on each level of the elements of the table allowing you to sort the data.

If you click on the triangles on the row or column descriptions then the data within the tables will be sorted by the items labels.

Sorting data

You can also right-click the elements and a menu appears that also allows the table to be sorted using the item labels.

Sorting data

If you click the triangles on the column headers then the data within the table will be sorted in either ascending or descending order within any subtotals that may be displayed.

Sorting data

Data Toolbar

The data toolbar appears automatically above each table.

Data Toolbar

Revert

Returns you to the original view of the data before any changes were made.

Link

Creates a temporary hyperlink to the current view of the data that is shown on-screen. This link can be added to your bookmarks/favourites so you can return to it at any time or it can be shared with others. If you wish to create a more permanent view of the data then you can register your details on the website and save your reports to your own private area using the ‘Save as’ button which is described later.

Tip: Temporary hyperlinks can be shared but private views cannot.

Link

Export

The viewable data can be downloaded into a number of other formats such as comma-separated values, Microsoft Excel, PDF and SDMX. The data can be exported including the title of the report and associated metadata by ticking the appropriate check boxes.

Export

Print

The current view of the data will be shown in a separate, printable tab within the web browser. Sometimes your web browser will prompt you to allow pop-ups in order to see the printable tab.

Full Screen mode

Makes the most of your screen size and resolution by removing banners and utilising the whole width of your screen.

Once you have registered to use the site and you have logged in, you are able to save your views in your own private area including your own description of the view.

Charting Toolbar

Charting Toolbar

Show/Hide Chart

Display a chart of the data that is currently displayed. The chart will appear above the table of data within the web page. If a chart is already displayed, it can be removed by clicking the icon again.

Palette

Changes the colours used in the chart between blue and multicoloured palettes.

Chart Type

Select from a range of 10 different chart types to suit your needs.

Chart Type

Tip: The best charts are created by keeping the table simple.

Orientation

Sometimes the chart might not appear as you’d intended. The ‘orientation’ button will simply swap the axes of the chart and display an alternative chart.

Point Labels

Displays the actual data values at the relevant points within the chart.

Hide/Show Legend

Adds or removes the legend from the body of the chart.

Legend X

Legend X

Moves the legend to 5 set positions on the chart from left to right. The legend can be placed outside the chart to the left or right or at 3 locations within the chart itself.

Legend Y

Moves the legend to 5 set positions on the chart from top to bottom. The legend can be placed outside the chart from top to bottom or at 3 locations within the chart itself.

Metadata

Each data set will have any metadata associated with it listed at the bottom of the page. Tabs are used to locate different types of information such as the unique reference of the data set, the publishing date of any new data and contact details should you require any further information.

Metadata

Personalisation

Personalisation

Once you have registered to use the site using the ‘Register’ button and logged in, you are presented with some additional options.

‘My Account’ allows you change your personal details such as username and email.

‘My views’ displays the views that you have saved in your own private area.

‘My subscriptions’ allows you to subscribe to a particular dataset alert. You will be notified by email when the relevant data set is updated. In order to subscribe to a data set, click on the envelope icon on the top right-hand corner of a page where links to reports appear.

Personalisation

StatsWales OData Guidance

Introduction

The StatsWales OData web service1 extends the access to data held within StatsWales. The service allows the most up to date raw data2 to be used directly inside compatible client applications, spreadsheets, or by developers within their own apps/websites.
The web service has ‘table’ endpoints3, through which the StatsWales data can be accessed directly in English, Welsh and both languages. These include the datasets, the catalogue, StatsWales metadata, as well as some tables which allow cross cutting analysis of dataset dimensions and dimension items4.
There are also API5 metadata endpoints (which should not be confused with the StatsWales metadata). These provide information, such as what tables are available, and the data types used. This makes it easier for machines to read the API. You do not normally need to worry too much about this side of things unless you are developing custom applications which may rely on this information.
These instructions are not designed to be a comprehensive guide, but they should provide enough information/sign-posting for those with a medium ICT capability to make use of the service. We’ve also included some notes on re-use considerations and licencing.

API Endpoints Explained

Endpoints or URLs (links) for the OData API are generally structured as follows:

http://open.statswales.gov.wales / {language parameter [optional]} / {service endpoint} / {table endpoint} $ {query parameters}

http://agored.statscymru.llyw.cymru / {language parameter [optional]} / {service endpoint} / {table endpoint} $ {query parameters}

Language parameters

Language parameters are used to specify whether the information is returned in English, Welsh or both languages.

Parameter Description
en-gb Returns the English columns - these are postfixed ‘_ENG’.
cy-gb Returns the Welsh columns - these are postfixed ‘_WEL’.
multilingual Returns both languages

In order to return information in both languages the ‘multilingual’ parameter must be specified.

Example: http://agored.statscymru.llyw.cymru/multilingual/discover/catalogue returns both the English and Welsh data stored against the catalogue.

If you choose not to include a language parameter the parameter is automatically added to match the domain name.

Please be aware that the domain takes precedence over the language parameter.

Example: http://agored.statscymru.llyw.cymru/en-gb/discover/catalogue would return information in Welsh rather than English.

Service Endpoints

The StatsWales OData web service has two main service endpoints:
Discover: http://open.statswales.gov.wales/discover
Dataset: http://open.statswales.gov.wales/dataset
These service endpoints return information (the API metadata) for the table endpoints whereas the table endpoints provide the actual StatsWales data. Specifying the URL/link to a service endpoint is usually sufficient for client applications to navigate the tables contained.

Example: http://open.statswales.gov.wales/discover will return a metadata listing of the tables available below this service endpoint, one of which is the catalogue table. Whereas http://open.statswales.gov.wales/discover/catalogue will return the actual catalogue data table.

Other Endpoints

Other service endpoints include:

  1. Usage. The following will return a list of the requests made to the OData endpoints for the current month and the previous month (as specified) respectively.
    http://open.statswales.gov.wales/statistics/usage
    http://open.statswales.gov.wales/statistics/usage?monthAndYear=052016
  2. Catalogue. The following will return a DCAT6 compliant listing of the StatsWales contents in both XML and JSON respectively.
    https://statswales.gov.wales/Home/DatasetCatalogue
    https://statswales.gov.wales/Home/DatasetCatalogueJSON;

Table Endpoints

There are several hundred table endpoints which sit beneath the service endpoints. We’ll use access to a dataset as an example. Firstly, the datasets available can be seen by using the ‘dataset’ service endpoint. To return a listing all of the data tables available use the following URL: http://open.statswales.gov.wales/dataset

To access a dataset the ‘table endpoint’ needs to be added to the URL.

Example: http://open.statswales.gov.wales/dataset/wimd0022 returns the data table ‘wimd0022’ which contains employment related benefits indicator data.

If you don’t need the whole data table a subset of the data can be obtained through the inclusion of ‘query parameters’ at the end of the URL.

Example: http://open.statswales.gov.wales/en-gb/dataset/wimd0022?$filter=Area_Code%20eq%20%27W01001434%27%20and%20Year_Code%20eq%202014 returns the 2014 employment related benefits indicator data from data table ‘wimd0022’ for LSOA W01001434.

Accessing Dataset URLs/Links

For ease of reference the dataset specific URLs are available under the ‘Open Data’ tab in the Metadata section at the bottom of each dataset view as shown.

Accessing Dataset URLs/Links

Clicking the language button at the top of the page will show links to the equivalent Welsh data.

Accessing Dataset URLs/Links

Where possible, these URLs/links are preserved even when there has been an update to the datasets such as when statistical releases are updated.

Please be aware that if you click on the URLs/links (or the examples on this page) you may find that some browsers are set to download the data returned as a text file rather than display the raw text data directly.

Accessing StatsWales Metadata

The metadata for all StatsWales datasets is stored in single table. To return the metadata for an individual dataset query parameters need to be added to the URL.

Accessing the StatsWales Catalogue

Similarly the StatsWales catalogue is also stored in single table. To return the catalogue view information for an individual dataset query parameters need to be added to the URL.

Example: http://open.statswales.gov.wales/en-gb/discover/catalogue?$filter=Dataset%20eq%20%27wimd0022%27 returns the catalogue for data table ‘wimd0022’ and what views are available against this dataset.

Cross dataset querying

Four tables within the discover endpoint are provided to allow cross querying of data under the ‘discover’ endpoint.

The following tables are provided (in order of hierarchy):

  • dimensiontypes – a unique list of dimension types e.g. geographic unit, time period. The semantic type field allows identification of equivalent dimensions (such as ‘Area’ and ‘Local Authority’) which consist of the same list of dimension items.
  • dimensionitems – this table provides a unique list of items associated with each dimension.
  • datasetdimensions – this table provides a unique list of dimensions within each dataset. This table repeats dimensions if they appear in more than one dataset.
  • datasetdimensionitems – this table provides a list of all dimensions and dimension items within every dataset. This table repeats both dimensions and dimension items where they appear in more than dataset.
Description Examples
Dimension type Type of dimension Geographic unit, Time period, Age band
Dimensions Categories of dimension types Specific geographic unit: Local Authority, Local Health Board, LSOAs etc.
Dimension items Values associated with dimensions Particular Local Authority: Isle of Anglesey, Gwynedd, Conwy etc.

Re-use Considerations

The innovative use of our data is encouraged and welcomed. As a re-user of our data you might find the following useful:

  • All statistics made available on StatsWales follow the standards defined by the UK Statistics Authority, an independent body operating at arm’s length from government as a non-ministerial department. All data classed as Official Statistics are produced according to the principles of the Code of Practice for Official Statistics. Statistics that have been assessed as compliant with the code and approved by the UK Statistics Authority will also be designated as National Statistics.
  • It is important when re-using data that you understand the data you plan to use. This not only relates to understanding the format and structure of the data but the limitations of the data itself. To help identify whether data is fit for the purpose for which you plan to use it we’ve documented limitations, where they exist, in the metadata (whether at a dataset, dimension or dimension item level). Therefore please refer to the relevant metadata prior to re-using our data.
  • All data on StatsWales may be used and re-used (not including logos) free of charge in any format or medium, under the terms of the Open Government License (OGL). However in doing so you must acknowledge the sources of information and, where possible, provide a link to the license: http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/
  • Whilst re-use of our data within interactive apps, websites, reports etc. is encouraged the use of our logo is restricted and may not be used by other individuals or organisations without formal permission from us. To seek permission to use our logo please e-mail: brandingqueries@wales.gsi.gov.uk
  • This is a Beta service and the API has limited service bandwidth. Please be mindful of this when designing apps. Appropriate caching should be considered noting that Welsh Government makes daily changes to the catalogue and metadata, monthly and yearly statistical release cycles.
  • We are of course interested to know who is using our data, how they plan to use it and any issues encountered. So if you have any questions or feedback please get in touch: http://gov.wales/statistics-and-research/about/contacts-statistics/?lang=en

Data Model

A summary of the fields returned by each table is explained below.

Scope Field / Column Heading Description
All tables Timestamp The date/time the row entry was updated
ETag Reserved
PartitionKey Reserved field (used to scale the table storage but often corresponds to the Dataset ID)
RowKey Reserved field (used with PartitionKey to specify the unique entry row)
Dataset
This table holds the data value and the corresponding combination of dimension item values
Data Every table has this value present which contains the un-rounded decimal measure.
{dimension}_ItemName_ENG* The name of the item relevant to dimension.
*ENG is English, WEL is Welsh, multilingual tables would include both columns
{dimension}_CODE The corresponding unique code for this particular item value
{dimension}_SortOrder The item sort order
{dimension}_Hierarchy The item hierarchy which will point to a corresponding code
Metadata
A metadata for dataset datasets in a single table
Tag_ENG* Field name
Description_ENG* The metadata field value
TagType_ENG* Table tab (used to conveniently group the metadata fields)
Dataset The dataset ID this piece of metadata belongs to
Catalogue
The table which corresponds to the StatsWales catalogue
FolderPath Relative URI of the catalogue position
ViewName_ENG* Name of the report
HierarchyPath_ENG* The catalogue hierarchy structure (breadcrumb)
DatasetURI_ENG* Direct location of the associated dataset OData endpoint (where it exists)
Dataset Dataset ID used within the report
Dimension Types
Unique list of dimension types and their definitions
SemanticKey A unique value (constructed from the type and sub type) which is used to match equivalent dimensions across datasets (e.g. "Geography\Local Authority")
ExternalURI_ENG* Link to an authoritative external description where defined
SubType Dimension subtype (e.g. "Local Authority")
SubTypeDesc_ENG* A human readable description of the sub-type
Type The main dimension type (e.g. "Geography")
TypeDesc_ENG* A human readable description of the type
Dimension Items
Unique list of dimension values
Code A code associated with the dimension item
Description_ENG* The label that the item is given (e.g. Cardiff)
AltCode1
AltCode2
AltCode3
Any alternative codes used for the item
Hierarchy
SemanticKey The unique key of the dimension this item belongs to (where applicable)
Dataset Dimensions
Unique list of dimensions used for each dataset
DimensionName_ENG* The name of the dimension as given within the dataset
Notes_ENG* A dimension note (metadata) for the dimension within the dataset where defined
ExternalURI_ENG* Link to an authoritative external description for the dimension
DimensionURI_ENG* OData query which provides the data for the specific dimension and dataset
SemanticKey A unique key for the dimension type (where defined)
Dataset Dataset id that this dimension belongs to
DatasetDescription_ENG* The dataset title
DatasetURI_ENG* Direct location of the OData endpoint for the dataset
Dataset Dimension Items Description_ENG The name of the dimension item
Code A code associated with the item
AltCode1
AltCode2
AltCode3
Any alternative codes used for this dimension item
SortOrder Sort order for the item (using Code within the same PartitionKey)
Hierarchy Points to the parent of this dimension item (using Code within the same PartitionKey)
DimensionName_ENG The name of the dimension as defined within the dataset
Notes_ENG Not needed?
SemanticKey A unique key for the dimension type (where defined)
Dataset The dataset that this dimension and item belongs to
*English columns would be swapped out for the Welsh columns from the Welsh endpoint.


1A web-service is machine readable (and sometimes programmable) interface which may be referred to as an API. StatsWales implements REST web services compatible with version 2/3 of the OData standard (see www.Odata.org and https://en.wikipedia.org/wiki/Web_service for more information).

2Raw data has all the formatting removed, but is arranged to provide some structure to the text (e.g. CSV [comma separated variable] is the simplest raw data format). Raw data may be supplemented by additional syntax, which makes it easier for machines to read, but harder for humans. In our implementation, the API metadata responses are returned as XML and StatsWales table data as JSON. See http://www.w3schools.com/json/ for more information on these notations.

3Endpoints are the starting URLs (web addresses or links). These have additional parameters (a syntax of words, slashes, question marks, etc.) added to them which tells the service what information to return.

4The compound queries that could be carried out include questions such as “tell me what datasets in StatsWales are available by local authorities”, “what datasets are available for Cardiff in 2012”, “What datasets show the split between male and female”.

5By definition the API metadata conforms to the OData standard and is only available in English.

6DCAT is a data vocabulary (or syntax) designed to facilitate interoperability (compatibility) between data catalogs published on the Web – see http://www.w3.org/TR/vocab-dcat/ for more information.