Giter Site home page Giter Site logo

ursa-major's Introduction

Ursa-major

A RESTful API for searching / matching / uploading factories in mongo and elastic search database. It uses MongoDB to store all the facroties, and Elastic search database to fuzzy match factory names. You can choose mapbox ot google as your geocode API.

Get Started

  • Run $npm install
  • Update .env, please see .env.example for refernece
  • Run $npm run dev

Go to localhost:8000, you should be able ro see 'WELCOME TO REST API URSA!'

More about .env file

DB_PATH=mongodb://(Mongodb databse uri)

PORT=8000

ES_HOST=Elastic search database host

ES_PORT=Elastic search database port

ES_AUTH=Elastic search database Auth

MASTER_ACCOUNT=a firebase uid, the account that holds all the seed factories

WORKER=true (If worker is true, wheneven localhost:8000/healthCheck is hit, it will get 100 temp documents, and parse it into factory, address, and geo, and find matches for that temp)

GEOCODE_API=mapbox or google

GEOCODE_KEY=your geocode api key

NODE_ENV=production or development

Deploy

Run $eb deploy

Test

  • Install Jest globally so we can use jest in command line: yarn global add jest
  • Run $npm run test (no need to Run $npm run dev)

Indexing production database

  • connect to prod database, update .env file
  • Uncomment indexing code in addressSchema.js, factorySchema.js and geoSchema.js
  • In app.js, comment out // if (process.env.NODE_ENV === 'development') { and // } else if (process.env.NODE_ENV === 'production') { Raven.config(process.env.SENTRY_KEY).install()}
  • Run $NODE_ENV=production node src/app.js

Upload a batch of files in for each account

Uncomment routes.js, app.get('/uploadMultipleFiles', temp.uploadMultipleFiles); Create a folder files at the root directory, put all the CSV files in it. Update accounts in uploadFiles.js with your uid, file_name, file_description, csv_file_name. csv_file_name is the name of the CSV file in the files folder

GET localhost:8000/uploadMultipleFiles

ursa-major's People

Contributors

yining1023 avatar

Watchers

James Cloos avatar Annajiat Alim Rasel 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.