Skip to content

priyanks25coder/Xpressathon-AddressNormalization

Repository files navigation

Xpressathon-Address-Normalization

Team ID: CodeWarriors | Team Members: Priyank Shah , Pranjal Goyal |

NodeJS Express

Build Status

Problem Statament

We needed to develop and API that takes address in RAW format (input), and perform formmating and optimizing the address (removing repetative, null values, correcting fields, speling error etc) and return the final address as a response.

Solution Approach

  • Firstly in order to get all the correct fields (state,city,locality), we decided to use the Data Govt India Pincode Data Directory which fetches the information based on locality and State. We can get information regarding state, district and locality as well as latitude and longitude.
  • After this, we solved the mispelling problem in fields by the use of Fuzzy string matching on fields that are standarized such as State, District using the data obtained from Govt Data Directory.
  • At last used Regex in each fields of address to trim the extra space as well as removal of special charcters and certain common words.
  • We returned the final formatted address as JSON object and wrote the output in file.
  • The fields which are not found in the data directory are kept as empty.
  • Note: We took special care about data/api used, All the sources are open-source.

Sample :

Input Address

{
  "address": "# , T-90834 Thrishika nilaya , suvarana Nagar near G.M cottage , doddabidarakallu , Nagasandra Post opp- byraveshwara floor mill Bangalore Karnataka India 560073"  
}

Output Address


"addresses" : {
  [
    {
      "addressline1": "#T 90834 Thrishika nilaya suvarana Nagar",
      "addressline2": "near G.M cottage doddabidarakallu Post opp byraveshwara floor mill",
      "locality": "Narasandra",
      "city": "Bengaluru",
      "state": "Karnataka",
      "pincode": "562127",
      "geocodes": "13.0600000,77.1700000"
    }
  ]
}
- As we can observe the pincode is corrected based on locality and rest of address is formatted accordingly to the standards.

How to Run?

Clone the Repository

git clone https://github.com/priyanks25coder/Xpressathon-AddressNormalization.git

After cloning the repo, follow the below steps:

$ cd (repo path) 
$ npm install
$ node generateOutput.js

API Used

Using an Open Source Indian Post api/data directory

Data Govt India Pincode Directory:: https://data.gov.in/resources/all-india-pincode-directory-till-last-month

Mentions

We would Like to thank Xpreebees team for organizing such an event which helps students in improving their development skills. We enjoyed making this Project.🎇