OpenBudget/open-budget-search-api

Name: open-budget-search-api

Owner: ?????? ?? ??????

Description: null

Created: 2016-09-12 19:29:00.0

Updated: 2018-04-27 11:56:42.0

Pushed: 2018-04-27 11:56:41.0

Homepage: null

Size: 21082

Language: Python

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

open-budget-search-api

Build Status

Setup Elasticsearch with data

The budgetkey-data-pipelines project handles the loading of data to elasticsearch

see load the datapackages to elasticsearch for a method to get a local elasticsearch instance with the data.

Running

Build the search api image

er build -t open-budget-search-api .

Run the image, modify ES_HOST and ES_PORT to connect to the relevant Elasticsearch instance.

The following command connects to the budgetkey-data-pipelines default docker compose elasticsearch.

er run -d --name open-budget-search-api --rm -p18000:8000 \
       --network budgetkeydatapipelines_default \
       -eES_HOST=elasticsearch -eES_PORT=9200 \
       budgetkey/open-budget-search-api

Search api should be available at localhost:18000

Development

Start the search api, modify ES_HOST and ES_PORT to connect to the relevant Elasticsearch instance.

The following command connects to the budgetkey-data-pipelines default docker compose elasticsearch.

OST=localhost ES_PORT=19200 python3 -c 'from open_budget_search_api.main import app; app.run()'

This is the search URL format:

http://localhost:5000/search/comma_seperated_table_names/search_term/from_data/to_date/maxinum_size_of_result/offset

for example - http://localhost:5000/search/exemption/test/2000-01-01/2019-01-01/4/0

There is a log for exceptions called obudget.log which is written right next to the main.py


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.