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.
You may need to compile the application.
- Ensure you have the .NET 5.0 console runtime installed.
- Configure the database connection strings in appsettings.json.
Note that the defaultStagingDB
value ofData Source=:memory:
creates an ephemeral in-memory database for the conversion. This takes about 3GB of RAM but is quickest. - Place the
CSV PAF.csv
file in the application directory. - Run the tool:
dotnet PAFConvert.dll
.
The tool is provided with no warranty of fitness for purpose and is released under the MIT Licence.