Generate a schema.org compliant JSON file of Registered Community Amateur Sports Clubs in the UK.
This JSON is based on the 13 October 2023 file.
HMRC publish a list of all registered CASCs in the UK. This is an ODS file that is updated infrequently. This project aims to convert that file into a JSON file that is schema.org compliant.
ABBOTS LANGLEY BOWLING CLUB ,12 GREENWAYS,ABBOTS LANGLEY,,,WD5 0EU
{
"@context": "https://schema.org",
"@type": "SportsOrganization",
"name": "ABBOTS LANGLEY BOWLING CLUB",
"address": {
"@type": "PostalAddress",
"streetAddress": "12 Greenways",
"addressLocality": "Abbots Langley",
"addressRegion": "Hertfordshire",
"postalCode": "WD5 0EU",
"addressCountry": {
"@type": "Country",
"name": "GB"
}
}
}The ODS file is converted to a CSV file using LibreOffice. The CSV file is then converted to a JSON file using a TypeScript script.
- If the
Postcodecolumn has content, use that to populate theaddressCountryandpostalCodefields. - If there's no
addressRegionthen theaddressLocalityis used to look up the county in thecounties.jsonfile. - If
addressRegionis still empty, then a lookup is made tohttps://api.postcodes.io/postcodes/to populate it from anadmin_countyresponse. - The column immediately before
addressRegionis used foraddressLocality. - All address fields are title cased.
bun convert.ts