Myth0147

Untitled

Nov 22nd, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.40 KB | None | 0 0
  1. Create a repo on GitHub or bitbucket, please name it "apitest"
  2.  
  3. use python, Django and PostgreSQL
  4. Database setup : (NOTE: Enable geolocation features in Postgresql with extensions: cube and earthdistance.
  5. Use the specific data types to create latitude and longitude
  6.  
  7. --------Interview Stage 1--------
  8. create a new table in Postgres and load this CSV that denotes the mapping between pincode and lat/long (https://github.com/sanand0/pincode/blob/master/data/IN.csv).
  9. Create Two APIs in Django: Get, Post.
  10. Post: Post lat, lng of any location with pincode+address+city and you can add new pincode in db. This api will be /post_location. Remember to check if pincode
  11. already exists or if there are existing latitude+longitude THAT ARE CLOSE ENOUGH TO BE THE SAME (dont assume that they will exactly be the same.)
  12.  
  13. Write testcases (using the test framework in your language. please use a test framework, do NOT just write functions and call it tests).
  14. Test different situations of adding data.
  15.  
  16. --------Interview Stage 2--------
  17. Get : There are two GET apis. Given a location, fetch all the nearby pin codes within a radius. For example, I can ask - give me all points within 5km radius
  18. of (45.12, 71.12) . To do this you will need to do mathematical computation of radius. there are two ways to do this:
  19. You can use postgres "earthdistance" to compute all points in 5km radius. This api will be /get_using_postgres
  20. Implement the mathematical computation yourself. this api will be /get_using_self
  21.  
  22. Write testcases (using the test framework in your language. please use a test framework, do NOT just write functions and call it tests). Test results between /get_using_postgres and /get_using_self.
  23.  
  24. --------Interview Stage 3--------
  25. a Geojson is a json file which defines shapes of locations - for example the shape of delhi, gurgaon, etc. This geojson is used to define delhi and its areas. https://gist.github.com/ramsingla/6202001?short_path=7d9a995
  26. you can check it out by going to http://geojson.io and pasting the raw json on the right side (on tab marked JSON).
  27. You will then parse this json, and load the boundaries latitude and longitude (geometry -> coordinates) into postgresql in a new table. you can use any structure,
  28. but remember that one place will have lots of lat/long (because it marks the boundaries).
  29. Write a new API : given a latitude/longitude, it will tell you which place it falls within.
  30.  
  31. Write testcases.
Add Comment
Please, Sign In to add comment