Koop provider for CSV
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
config
src
test
.dockerignore
.gitignore
.nvmrc
.travis.yml
Dockerfile
LICENSE
README.md
package.json

README.md

npm version Build Status

koop-provider-csv

A simple CSV provider for Koop

This provider works with a CSV file with coordinate columns (x and y).

Configuration

This provider uses config for configuration. The configuration files are within the config folder.

A configuration should look like this:

{
  // required:
  // 1. CSV source path, a local file path or a URL
  "source": "example.csv",
  // 2. service name
  "sourceName": "csv",
  // 3. coordinate column names
  "columns": {
    "x": "longitude",
    "y": "latitude"
  },
  // optional:
  // 1. delimiter
  "delimiter": ",",
  // 2. test server port
  "port": 8080
}

Test it out

Run server:

  • npm install
  • npm start

Tests:

  • npm test

Development output callstack logs

During development you can output error callstack with

  • NODE_ENV=test npm start

Deploy to AWS Lambda

Koop providers can be quickly deployed and scaled with AWS Lambda. To first create the service:

  • npm run lambda-create

To deploy code updates

  • npm run lambda-update

AWS Lambda configuration

By default, AWS Lambda has a 3 second timeout and only 128MB memory. If your Koop provider uses a slower service, then you should change the AWS Lambda timeout to a higher time limit (e.g. 60 seconds) as well as add more memory (e.g. 512MB).

With Docker

  • docker build -t koop-provider-sample .
  • docker run -it -p 8080:8080 koop-provider-sample