GithubHelp home page GithubHelp logo

topos_oa's Introduction

Setup

In order to run the code, please be sure that you have installed Goji and mgo using command listed below.

go get goji.io
go get gopkg.in/mgo.v2

As for the dataset, please download a CSV version of non-geospatial data(https://data.cityofnewyork.us/Housing-Development/Building-Footprints/nqwf-w8eh) and make sure to place it under test folder.

Read CSV file and insert into mongoDB

I use default mongoDB port(27017) for this assignment. Execute reader.go under test folder using command

go run reader.go

and there should be a database called Building_data. Since the dataset is too large, I only insert the first 10000 records to the database. Check your mongoDB with dbKoda or whatever you like and you will see all the inserted records.

Test the APIs

Use one command line to run api.go. When it's connected to the database, there are two ways to test the APIs.

  1. Use any http develop tool like postman to send http request in the following format(all APIs receive get requests).
localhost:8080/buildings                      #for all records
localhost:8080/buildings/bid                  #bid can be replaced with any buildingID
localhost:8080/buildings/height/hgt           #hgt can be replaced with any float to query buildings which is at least of hgt height
localhost:8080/buildings/groupbytype/         #this request aggregate all buildings based on their type and return statistic result

image1
image2
image3
2. Execute test.go to test all APIs, the responses will be write to files under the same folder. agg.txt store the responses of aggregate request, all_building.txt store info of all builidngs in database, height_test.txt store info of height query.

topos_oa's People

Contributors

mmao95 avatar

Watchers

James Cloos 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.