Giter Site home page Giter Site logo

business-openva-api's Introduction

code4hr.org

The website for the Code for Hampton Roads Brigade

Goals

  1. Explain what Code for HR is and the type of work we do.
  2. To celebrate our events, projects, and discussions!
  3. Encourage current and new members to participate with clear ways to get involved.
  4. To have this site be easily reused by other Brigades just starting out.

Tech

Built using Jekyll, Bootstrap, and the CfAPI.

Contributing

Submitting an Issue

We use GitHub Issues to track bugs and features. We've included several of our open GitHub Issues right on our homepage using the Civic Tech Issue Finder.

Running the Site Locally on Your Computer

To run the site locally on your own computer (most helpful for previewing your own changes), you will need Jekyll installed (click here for Jekyll installation instructions.)

Fork and clone the repository, then run the following command in the root directory of the repo:

jekyll serve

or

jekyll serve --watch which will watch for changes to files.

Your computer should now be serving your local copy of the site at:

http://localhost:4000.

Sharing Your Changes Using Jekit

You can use the nifty Jekit app to preview changes you make to this site.

To do this, fork this repo, and commit your changes on a branch to your fork. You can then preview what your changes look like by navigating to:

https://jekit.codeforamerica.org/USERNAME/code4hr/BRANCHNAME/

For a basic example of its usage, if GitHub user @lolname has made changes to the projects page on their fork (on the master branch), they can preview their changes using Jekit by going to:

https://jekit.codeforamerica.org/lolname/code4hr/master/projects

Submitting a Pull Request

  1. Fork the project.
  2. Create a topic branch.
  3. Implement your feature or bug fix.
  4. Commit and push your changes.
  5. Submit a pull request.

business-openva-api's People

Contributors

ryayak1460 avatar ttavenner avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

business-openva-api's Issues

Config file host name is ignored

I think it's ignoring the host name. My config.json file looks like this:

{
  "host": "vabusinesses.org",
  "port": 3000,
  "elasticSearch": {
    "host": "127.0.0.1:9200"
  }
}

But when I fire up the API, I get this:

$ node api.js
Server running at:  http://ip-10-0-0-240:3000

Shouldn't it say that the server is running at http://vabusinesses.org:3000? (Or is this a cosmetic problem, and not a functional problem?)

Properly implement geo search

On businesses route should be able to pass a lat/lng and a distance and return any results within distance of lat/lng. Ideally this should exist in the data model and should also be properly handled in the elasticsearch query.

Add geojson support

Tools like Google Maps and Cartodb support loading geojson data. The JSON generated by the API is great, but if you just want to map the points geojson would be more useful.

Construct Elasticsearch controller

To build elasticsearch queries based on the current model and the data types of the query parameters. i.e. the API passes in a query from the corporate route with parameters: {name: 'Subway'}. It constructs and runs an Elasticsearch query like:

es.search({
    index: 'business',
    type: '2',
    body: {
        query: {
            match: {
                name: 'Subway'
            }
        }
    }
}

Add Continuous Deployment

Hey @waldoj I've been talking with @ttavenner and I think it would be great to setup auto-deployment using travis-ci.org or codeship.io. Free for open source. It would allow us to have any commits to the master branch auto deployed to the prod server, code swapped out, restarted, etc. I can help walk you through it, or create everything myself and give you access. The goal is to take the work out of pushing new code.

EADDRNOTAVAIL error when domain specified as host

With the changes in 348c16c, with host in config.json set to vabusinesses.org, launching api.js now fails with this error:

$ node api.js
events.js:85
      throw er; // Unhandled 'error' event
            ^
Error: listen EADDRNOTAVAIL
    at exports._errnoException (util.js:746:11)
    at Server._listen2 (net.js:1112:19)
    at listen (net.js:1155:10)
    at net.js:1253:9
    at GetAddrInfoReqWrap.asyncCallback [as callback] (dns.js:81:16)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:99:10)

I do not get this error if I set host to localhost.

I don't know if this error is consequential. That is, I don't know if the API will ever self-report its own address as localhost instead of as vabusinesses.org, or whether it only respond to internal requests (and not requests that originate externally) as a result of this. If these aren't problems, then presumably this is a pretty minor bug.

Async return not working in routes.js

Abstracted all querying into a generic function buildSearch. Elasticsearch.js returns either a promise or hands off to a callback function. Need to figure out how to get the returned data back to the calling function in a properly javascripty way.

Create models for each route

using Joi (already a requirement). Put these model files in a models directory. The model types are:

  • Businesses
  • Amendments
  • Officers
  • Mergers

API isn't responsive

My config.json file looks like this:

{
  "host": "vabusinesses.org",
  "port": 3000,
  "elasticSearch": {
    "host": "127.0.0.1:9200"
  }
}

Running api.js yields this:

$ node api.js
Server running at:  http://ip-10-0-0-240:3000

And connecting to port 3000 produces this:

$ telnet localhost 3000 
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET /businesses

Nothing is ever returned in response to GET /businesses. There aren't any log files to check, so I confess I'm at a loss. Any suggestions?

Write some tests

No clear outcomes on this yet, but Hapi has a testing plugin called lab (not yet a requirement) we could use to validate the code.

Map out dependencies between data tables

Many data tables are functionally children of others, and probably aren't terribly useful on their own. For instances, officers. Those are the officers of corporations, and a request for a given corporate ID should also return all entries from the officers table that have that corporate ID. Ditto for mergers. As best as I can tell, names is about registered DBAs, e.g., "Aaron's, Inc." trading as "Aaron Rents, Inc.," and "Thrivent Investment Management Inc." doing business as both "AAL Capital Management Corporation" and "AAL Distributors, Inc."

We need cascading queries—a request for F032816 should return the record for Aaron's, Inc. from corporate, and it should also also return its dozen officers from officers, its two DBAs from names, and its two merger records in mergers.

Map out which tables should be queries in response to a request for each type of corporation—Inc., LP, and LLC.

Update routes to parse query strings

Most search options will come in via the query string rather than a named parameters. Routes can use qs (already a requirement) for parsing in JS objects. These can then be passed to the controller.

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.