Skip to content

priyanks25coder/Address-Reform

Repository files navigation

Address Formatting

Team ID: StatusCode200 | Team Members: Priyank Shah , Pranjal Goyal & Bhuvan Gandhi | ReferenceID: SEOYpjVCT7

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 etc) and return the final address as a response.

Solution Approach

  • First of all we looked into serveal string matching algorithm, and decided to use the Levenshtein distance Algorithm.
  • The algorithm calculates the minimum number of single-character edits required to change one word into the other. Strings do not have to be the same length
  • 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.
  • Now at last in order to solve the problem of null/empty values in field, we decided to use the Data Govt India Pincode API which fetches the information based on pincode. We can get information regarding state, district and locality.
  • At last used Regex in each fields of address to trim the extra space as well as removal of special charcter such as (@,*) etc.
  • We returned the final formatted address as JSON object.

Deployed version:

API Endpoint: https://address-format-project.herokuapp.com/

Google Slide:

https://docs.google.com/presentation/d/15NHsy8HAPtnYqiQsnKyEZ28u6_X_wqwv_jWorB3Xxb8/edit#slide=id.gf83d41c71d_0_105

Example :

Input Address

{
    "house": "B-221",
    "street": "Backery Street",
    "landmark": "Near GIDC",
    "subdistrict": "",
    "district": "Ahmedabad",
    "village": "",
    "area": "Naroda",
    "pincode": "382330",
    "state": "Gujarat"

}

Output Address

{
  "house": "B-221",
  "street": "Backery Street",
  "area": "Naroda",
  "landmark": "Near GIDC",
  "village": "NA",
  "subdistrict": "NA",
  "district": "Ahmedabad",
  "state": "Gujarat",
  "pincode": "382330"
}

How to Run?

After cloning the repo, follow the below steps:

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

API Used

Using an Open Source Indian Post api

Data Govt India Pincode Api:: https://data.gov.in/resources/all-india-pincode-directory-along-contact-details

Mentions

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