API-in-a-box
@switzerly
shelbyswitzer.com
getnotion.com
Civic hacking with hypermedia API containers
The world runs on small data.
show-me-the-food
- identify food deserts
- add canvassing tool
- visualize findings
- change the world
The need:
- easy (and free) way to store and maintain data
- little or no changes to raw data
- has or can integrate with flexible, robust API
- does not need to be hosted
- simple setup locally or on any server
{
"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" },
"FILE_SOURCE": { "type": "string"},
}
}
}
The need:
easy (and free) way to store and maintain datalittle or no changes to raw data- has or can integrate with flexible, robust API
- does not need to be hosted
- simple setup locally or on any server
{
"collection" :
"href" : "http://dockerip:4567/resources/",
"items" : [
{
"href" : "http://dockerip:4567/resources/8903493",
"data" : [
{"name" : "name", "value" : "Bob's Convenience Store"},
{"name" : "lat", "value" : "33.760094"},
{"name" : "lng", "value" : "-84.386037"},
{"name" : "bustype", "value" : "convenience"},
{"name" : "FILE_SOURCE", "value" : "GA_EBT.csv"}
]
}
],
"queries" : [
{"rel":"search", "href":"http://dockerip:4567/resources/search", "prompt":"Search",
"data" : [
{"name" : "name", "value" : ""},
{"name" : "lat", "value" : ""},
{"name" : "lng", "value" : ""},
{"name" : "bustype", "value" : ""},
{"name" : "FILE_SOURCE", "value": ""},
{"name" : "dedupe", "value" : ""}
]
}
]
}
Hypermedia: Collection+JSON
The need:
easy (and free) way to store and maintain datalittle or no changes to raw datahas or can integrate with flexible, robust API- does not need to be hosted
- simple setup locally or on any server
API
api:
build: ./api
command: bash ./deploy/start.sh
volumes:
- api:/api
ports:
- "4567:4567"
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 ORIGIN_REPO="switzersc/food-data"
$ curl http://dockerip:4567/resources?dedupe=bustype
- throw data into github repo
- pull/build docker image
API-in-a-box
The need:
easy (and free) to store and maintain datalittle or no changes to raw datahas or can integrate with flexible, robust APIdoes not need to be hostedsimple setup locally or on any server
GET INVOLVED!
https://github.com/switzersc/api-in-a-box
http://www.codeforamerica.org/brigade/
Thanks!
@switzerly
shelbyswitzer.com
getnotion.com
https://github.com/switzersc/api-in-a-box
https://hub.docker.com/r/switzersc/api-in-a-box/
http://www.elastic.co/guide/en/elasticsearch/guide/current/index.html
http://amundsen.com/media-types/collection/
https://www.data.gov/developers/apis
Resources
API-in-a-Box - RMR
By Shelby Switzer
API-in-a-Box - RMR
- 1,449