Giter Site home page Giter Site logo

microsofttakehome's Introduction

Running the application

I provide two ways to run the application. The first being a deployable artifact location in the target directory. The second being a maven command to run the source.

From the root directory you can run either

java -jar microsofttest-0.0.1-SNAPSHOT.jar

Or

mvn spring-boot:run

Once the application boots up you can access its single endpoint at

localhost:8080/trucks?lat={latValue}&lon={lonValue}

The current implementation will always the closest 5 food trucks ("not really, it assumes lat and lon are on a 2d plane"). A typical response will look like so

[
  {
    "lat": 37.78754,
    "lon": -122.39773,
    "address": "564 HOWARD ST",
    "name": "Tortas: Burritos: Tacos: Churros: Nachos: Asada Fries",
    "id": 1447794
  },
  {
    "lat": 37.787304,
    "lon": -122.39804,
    "address": "580 HOWARD ST",
    "name": "Mexican Food",
    "id": 1367290
  },
  {
    "lat": 37.787956,
    "lon": -122.39724,
    "address": "540 HOWARD ST",
    "name": "Tacos: burritos: quesadillas",
    "id": 1339633
  },
  {
    "lat": 37.7868,
    "lon": -122.39787,
    "address": "201 02ND ST",
    "name": "Prepackaged Kettlecorn",
    "id": 1353225
  },
  {
    "lat": 37.788445,
    "lon": -122.39864,
    "address": "555 MISSION ST",
    "name": "Noodles",
    "id": 1408986
  }
]

I just picked a few fields to display, could display a lot more as well. These just seemed like the important ones.

The implementation uses a spatial library called JSI, I've worked with some other spatial libraries in the past but I've never used this one. I picked it specifically because of it's speed. There are a few problems though. One pitfall is that that it assumes a 2d plane, so it works well with coordinates that are very close together, like a city, but would not work well with a country or whole planet.

Another problem is how the library is implemented. The calculations each run on different threads which creates a problem for a webservice, because I need to collect all the results manually. This creates code that is hard to test and is overly complicated.

Doing the exercise again, I would opt for a different library I'ved used in the past. One that accounts for earth curvatures.

One problem I didn't get to solve due to time is the data. Not all of it is "good" data. There are duplicate locations, revoked permits, different schedules for different locations. That would all need to be accounted for in a proper search.

microsofttakehome's People

Contributors

jeremyheaton avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.