The dataset for this can be downloaded from here.
This repository contains the code to clean the CSV data and convert it into a JSON format (optimized for MongoDB) conforming to the following schema:
interface PostOffice {
state: string;
district: string;
offices: string[];
}This is useful for applications where we need to auto-fill the area, district, and state based on the pincode entered by the user. This can be used in e-commerce websites, address forms, etc.
-
Clone the repository.
git clone https://github.com/ELT-Global/indian-post-offices.git
-
Download the dataset.
Download the dataset from here. If not found, you will have to search for it in data.gov.in
-
Run the script.
python converter.py <path-to-csv-file> <path-to-output-file>
This will generate a JSON output file in the same directory.