Downloads & Data

Download tools and source code; access data sources and services

ods2rdf.jar

42 KB

Download Now

Licensed under the Apache License, Version 2.0.

codes.csv

24 KB

Download Now

codesets.zip

657 B

Download Now

ods2rdf.zip

4,809 KB

Download Now

Licensed under the Apache License, Version 2.0.

ods2rdf tool

By Connecting for Health | 2013

ods2rdf is a tool to convert the CSV text files published by the NHS Organisation Data Service (ODS) into RDF/XML files. These files contain reference information; such as name, address and telephone number,  about health and social care organisations in England. They also contain reference information for all general medical practitioners and consultants in England.

You can download these CSV text files from here. Caveat – as of the 1st April 2013 ODS will become part of the new Health and Social Care Information Centre, therefore the location of these text files may change.

To use ods2rdf you need to first download it to a suitable folder on your computer. It is packaged as a java jar file, so you will need a version of the Java Runtime Enviroment (JRE) installed and configured on your computer to be able to run ods2rdf.

To run ods2rdf, open a command prompt and type:

java -jar ods2rdf.jar [-r uri_prefix] [-o output_file] data_set_type input_file

The argument data_set_type specifies the type of data the input file is expected to contain. Valid argument values are:

  • org – organisations
  • site – organisation sites
  • mixed – organisations and/or organisation sites
  • hospice – hospices
  • pcm – GP Practice membership of CCG
  • con – consultants
  • gp – general medical practitioners
  • code – codes

The argument input_file is the name of the CSV input file to process. The input file can either be in the folder ods2rdf is being run from or can be in another folder, in which case a full path name can be given for the input file. The file name should include the file type extension, normally .csv.

ods2rdf will read and parse the contents of the input file based on the specified data set type and write the resultant RDF/XML data into an output file with the same name as the input file but with a file type extension of .rdf. The location of the output file will be the same as the location of the input file. If the output file already exists it will be overwritten.

If ods2rdf encounters an error it will display a message to the command line (stdout) and terminate. It may also display warning messages to the command line (stdout) if it cannot recognise an organisation or organisation site type. These records will still be converted to RDF but will have their organisation or organisation site type set to UNKNOWN.

An example of running ods2rdf is:

java -jar ods2rdf.jar org eauth.csv

This will produce an RDF output file called eauth.rdf.

If you want to explicitly specify the name of the output file, you can by setting the optional output_file argument. You can set this to just a file name or a full path name.

An example of running ods2rdf with an explicit output file name is:

java -jar ods2rdf -o testoutput.rdf site edispensary.csv

By default ods2rdf will use https://data.developer.nhs.uk as the namespace prefix on all URIs it mints. You can override this by setting the optional argument uri_prefix to a different namespace prefix. Note this should not end in a /.

An example of running ods2rdf with a specific URI prefix is:

java -jar ods2rdf.jar -r http://data.somewhere.com con econcur.csv

ods2rdf when converting some of the information to RDF uses URIs to represent codes. These URIs are minted from the codes defined in the CSV text file codes.csv which is specific to ods2rdf and not ODS. The zip file codesets.zip contains codesets.rdf which has the URIs for the code sets used.

The following script can be used to generate RDF/XML for most of the CSV files you can download from ODS (note you will probably have to change the names of files with interim in their name to reflect the most recently published version):

java -jar ods2rdf.jar org eauth.csv
java -jar ods2rdf.jar org interimeauth_v2.csv
java -jar ods2rdf.jar org interimccg_v6.csv
java -jar ods2rdf.jar org interimCSU_v4.csv
java -jar ods2rdf.jar org ect.csv
java -jar ods2rdf.jar org educate.csv
java -jar ods2rdf.jar org etr.csv
java -jar ods2rdf.jar org espha.csv
java -jar ods2rdf.jar org ephp.csv
java -jar ods2rdf.jar org epharmacyhq.csv
java -jar ods2rdf.jar org epctcur.csv
java -jar ods2rdf.jar org ensa.csv
java -jar ods2rdf.jar org egdpprac.csv
java -jar ods2rdf.jar org epraccur.csv
java -jar ods2rdf.jar org enonnhs.csv
java -jar ods2rdf.jar org eplab.csv
java -jar ods2rdf.jar site ets.csv
java -jar ods2rdf.jar site eprison.csv
java -jar ods2rdf.jar site ephpsite.csv
java -jar ods2rdf.jar site epctsite.csv
java -jar ods2rdf.jar site ectsite.csv
java -jar ods2rdf.jar site ebranchs.csv
java -jar ods2rdf.jar site edispensary.csv
java -jar ods2rdf.jar site interimccgsite.csv
java -jar ods2rdf.jar con econcur.csv
java -jar ods2rdf.jar con edconcur.csv
java -jar ods2rdf.jar gp egpcur.csv
java -jar ods2rdf.jar hospice ehospice.csv
java -jar ods2rdf.jar pcm interimpcmem_v4.csv
java -jar ods2rdf.jar mixed eother.csv
java -jar ods2rdf.jar code codes.csv

The ods2rdf source code is also available as a Zip file.

To download and use the source code:

  • Download the zip file to a suitable folder on your computer.
  • Unzip the file contents – this will create a folder called ods2rdf.
  • If you are using Eclipse IDE add the project into your current workspace by importing it.
  • If you are using another IDE you will need to manually add in the java classes to your project.