Guerrilla APIs

@switzerly

shelbyswitzer.com

show-me-the-food

  • identify food deserts
  • add canvassing tool
  • visualize findings
  • change the world

The need:

  • easy (and free) to store and maintain data
  • little or no changes to raw data
  • has or can integrate with flexible, robust API (that doesn't need to be hosted)
  • simple setup locally or on any server
  • A cluster has many indices
  • An index has many documents
  • A document has many properties
  • A document's properties are defined in a mapping

Elasticsearch structure

{
	"business" : {
		"name" : "Hairy Convenience",
		"lat" : "33.760094",
		"lng" : "-84.386037",
		"bustype" : "convenience"
	}
}

document:

mapping:

{
	"business" : {
		"properties" : {
			"name" : { "type" : "string" },
			"lat" : { "type" : "string" },
			"lng" : { "type" : "string" },
			"bustype" : { "type" : "string" }
		}
	}
}

gem 'stretcher'

gem 'remote_table'

The need:

  • easy (and free) to store and maintain data
  • little or no changes to raw data
  • has or can integrate with flexible, robust API (that doesn't need to be hosted)
  • simple setup locally or on any server

{ cool diagram }

{ cooler diagram }

web:
  build: .
  command: bundle exec rails s -p 3000 -b '0.0.0.0'
  volumes:
    - .:/api-in-a-box
  ports:
    - "3000:3000"
  links:
    - elastic

elastic:
  image: dockerfile/elasticsearch
  ports:
    - "9200:9200"
    - "9300:9300"
  volumes:
    - docker_volumes/elasticsearch_data:/usr/local/elasticsearch/data

docker-compose.yml

$ docker-compose up -e DATA_URL="https://api.github.com/repos/switzersc/food-data"
$ curl http://localhost:4567/resources?type=business&dedupe=name
  1. throw data into github repo
  2. install docker
  3.  
  4.  
  5. =>
{
    "resources" : [
        {
            "name" : "Bob's Convenience Store",
            "lat" : "33.760094",
	    "lng" : "-84.386037",
	    "bustype" : "convenience"
        }
    ]
}

API-in-a-box

The need:

  • easy (and free) to store and maintain data
  • little or no changes to raw data
  • has or can integrate with flexible, robust API (that doesn't need to be hosted)
  • simple setup locally or on any server

Thanks!

@switzerly

shelbyswitzer.com

https://www.docker.com/

http://www.elastic.co/guide/en/elasticsearch/guide/current/index.html

http://amundsen.com/media-types/collection/

https://www.data.gov/developers/apis

 

cool things:

guerilla APIs

By Shelby Switzer