g0v / api.ly

api.ly.g0v.tw - ly api endpoint
14 stars 6 forks source link

api.ly

gemnasium

api.ly.g0v.tw endpoint source and utility scripts

Development

Host

Besides Vagrant, of course you can run a api server in your host.

the server provides RESTFUL service by pgrest. pgrest rely on postgresql, so you should install postgresql and related components to your host.

For example, in Debian/Ubuntu

init

% npm i

Then refer to the cookbook to initialize your postgresql.

Bootstrap with the initial dump file:

% createdb ly
% psql ly -c 'create extension plv8'
% lsc app.ls --db ly --boot
% curl -SsL 'https://www.dropbox.com/s/6j0zlzlubq8it5u/api.ly.bz2?dl=1' | bzcat |  psql ly -f -

run pgrest

$ lsc app.ls tcp://ly:password@localhost/ly
or
$ lsc app.ls tcp://ly:password@localhost:5433/ly    # if your postgresql is running on port 5433

pgrest will bind a local port to serve

data flow

fulltext from gazettes

(not automated yet)

ivod clip metadata

populated with update-ivod.sh

TTS data (WIP)

National Parliament Library provides a database called TTS. to work with it you'll need to have lisproxy.psgi up and running, and install phatomjs and casperjs to use scripts/tts.coffee

% sudo apt-get install cpanminus
% cpanm Plack::App::Proxy
% npm i -g bower
% npm i -g casperjs
% npm i -g phantomjs
% bower install jquery

% plackup lisproxy.psgi &

bill and motion metadata

populated with populate-ttsmotions.ls and populated-ttsbills.ls

interpellation

populated with populate-ttsinter.ls

API listing for api.ly

To regenerate api, just run docgen.s then commit apiary.apib, the document will hook to apiary automatically

cd ~/api.ly
lsc docgen.ls
git commit apiary.apib

License

MIT: http://g0v.mit-license.org