Team ID: StatusCode200 | Team Members: Priyank Shah , Pranjal Goyal & Bhuvan Gandhi | ReferenceID: SEOYpjVCT7
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.
- 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.
API Endpoint: https://address-format-project.herokuapp.com/
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"
}
After cloning the repo, follow the below steps:
$ cd (repo path)
$ npm install
$ node index.js
Using an Open Source Indian Post api
Data Govt India Pincode Api:: https://data.gov.in/resources/all-india-pincode-directory-along-contact-details
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.🎇