Tuesday 2 March 2010

UK Government ONS: NeSS Data Exchange (NDE)

Task 2: Fill in the Wards and Councils for the next Election (2010) into a Contact database - by each contact's postcode.

I've chosen to look at NeSS Data Exchange (NDE), a free web service with which you can run queries against the Neighbourhood Statistics from ONS.

With this service you can run queries from websites, Excel spreadsheets, databases, Ajax, Flex, Java, .NET applications... and there's a lot of statistics to discover. NDE2 can use both SOAP and REST (not strictly RESTful) protocols without authentication.

Example datasets:
  • "What are the child areas of Havant local authority?"
  • Search for Wards, Unitary Authorities by Postcode or AreaId
  • Get "Indexes of Deprivation" and filter by Unitary Authority
  • and various other indicators, statistics from local councils and UK government offices.
NDE2 no longer requires registration...

I found a good technical guide in PDF format. There are two service endpoints that you can visit and play with to discover what kind of information is available:

From the technical guide it appears that the datasets are split into Hierarchies and Level Types. For my purposes I need Level Types 13 (Electoral Ward) and 14 (Local Authority). I do not need to worry about Hierarchies... Out of interest tho .. running the Disco/GetHierarchies? command from the above Discovery endpoint returns:
2 NeSS Geography Hierarchy
15 2006 Health Hierarchy
4 2003 Administrative Hierarchy
8 2003 Health Hierarchy
11 2004 Administrative Hierarchy
16 2005 Administrative Hierarchy
18 2007 Administrative Hierarchy
3 1998 Administrative Hierarchy
7 2003 Electoral Hierarchy
12 New Deal for Communities (Best fit)
17 2006 Administrative Hierarchy
9 2003 Parish Hierarchy
14 Provisional Parliamentary Constituencies 2007
10 2003 Education Hierarchy
Disco/GetLevelTypes? returns (some removed):
164 COM Community
10 CTRY Country
180 EA Education Area
9 EW England and Wales
21 GAZ Gazetteer
8 GB Great Britain
11 GOR Government Office Region
19 HA Health Authority
13 LA Local Authority
141 LSOA Lower Layer Super Output Area
140 MSOA Middle Layer Super Output Area
201 NDC New Deal for Community
17 NP National Park
16 P Parish
20 PCO Primary Care Organisation
81 SHA Strategic Health Authority
144 SPR Scottish Parliamentary Region
153 USOA Upper Layer Super Output Area
14 WARD Ward
27 WPC Westminster Parliamentary Constituency (currently as they were in 2005)
Running Disco/SearchSByAByPostcode with a postcode and level type 13 or 14 returns the local authority (and ward). I.e.,
Returns: (Level Type) 13 (Hierarchy) 2 (AreaId) 276743 (Local Authority) City of London
Returns: (Level Type) 13 (Hierarchy) 2 (AreaId) 276743 (Local Authority) City of London
(Level Type) 14 (Hierarchy) 17 (AreaId) 6094725 (Ward) Aldersgate
I am able to run the response through ds.ReadXml ...
ds.ReadXml("http://neighbourhood.statistics.gov.uk/NDE2/Disco/SearchSByAByPostcode?LevelTypeId=14&Postcode=EC2Y8BP");
More than one table is created... Only one table has data and it is called Area... The number of rows depends on the LevelTypeId and LevelTypeId can be used as a row index to find the required data. (I discovered that Scottish Wards can't be found this way, only the Scottish Unitary Authorities (using LevelTypeId=13)... for that one needs to approach the equivalent Scottish Neighbourhood Statistics. That will have to be done at another stage.

Put that on a loop and now I have populated my contact database with the relevant Wards and Local Authorities...

There's plenty more to play with at the NeSS Data Exchange...

I'll follow this post with some useful links to postcode searches and Elections and government services etc...



No comments:

Post a Comment