/pafconvert

A tool for converting the CSV Postcode Address File from Royal Mail into a fairly flat Microsoft SQL Server Database.

Primary LanguageTSQLMIT LicenseMIT

PAFConvert

PAFConvert is a tool that converts the CSV Postcode Address File (PAF) available from Royal Mail's Address Management Unit into a fairly flat Microsoft SQL Server database.

It creates an addresses table containing the majority of the data from the PAF, with lookups to a localities and thoroughfares table.

The expected schema for a Microsoft SQL Server database to which this data could be imported is provided, including relevant indexes, views and stored procedures for address and postcode search.

The tool is written in .NET 5 and is therefore cross-platform. CSVHelper is used to import data quickly from CSV. SQLite is used to do the conversion internally.


Using the tool

You may need to compile the application.

  1. Ensure you have the .NET 5.0 console runtime installed.
  2. Configure the database connection strings in appsettings.json.
    Note that the default StagingDB value of Data Source=:memory: creates an ephemeral in-memory database for the conversion. This takes about 3GB of RAM but is quickest.
  3. Place the CSV PAF.csv file in the application directory.
  4. Run the tool: dotnet PAFConvert.dll.

Licensing

The tool is provided with no warranty of fitness for purpose and is released under the MIT Licence.