Skip to content

jampekka/statcubeserver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

REST-API-server for statistical data

Statcubeserver serves statistical data over a REST-API. The API is a fairly thin REST-wrapper for pydatacube functionality.

Install and startup

Statcubeserver requires pydatacube (usually latest git, developed in sync), CherryPy 3 and Python 2 (most likely 2.7).

There's no separate installer, just run scripts in the project root. Currently supports loading PC-Axis datasets of the Helsinki Region Infoshare service using the load_hri.py script, by running eg:

mkdir hri_data_files
python2 load_hri.py hri_data_files > hri_data_index.json

which downloads and stores the PC-Axis files to hri_data_files-directory and writes metadata/index of them to hri_data_index.json.

The px_json_server.py can be used to serve this data:

python2 px_json_server.py hri_data_index.json

And if everything goes fine, the API can be accessed (by default) at http://localhost:8080/resources/ and a (quite spartan) web-UI at http://localhost:8080/browser/ .

API Usage

WARNING! The API is still subject to change. Please inform the developers if you are using the server, so we can ensure backwards compatibility.

NOTE! The links here point to a server instance serving Helsinki Region's statistics. To work with a local version, change the host, port and path accordingly (eg. http://dev.hel.fi/stats/ -> http://localhost:8080/).

Examples

Click the links to see example results.

Browse datasets with a browser: /browser/

Preview a dataset and see available methods: /browser/?resource=<resource uri>

Get available datasets: /resources/

Get dataset metadata and methods: /resources/<resource id>/

Get a filtered dataset: /resources/<resource_id>/filter<&col1=cat1,cat2&col2=cat3 ...>

Get dataset's data (can be filtered) as "entries": /resources/<dataset path>/entries

Get data as "table": /resources/<dataset path>/table<?start=firstrow&end=lastrow>

Get data as "columns": /resources/<dataset path>/columns

Get grouped data ("pivot") as columns: /resources/<dataset path>/group_for_columns?as_values=<col1,col2...>

Get data as JSON-stat: /resources/<dataset path>/jsonstat

Demos and advanced examples

http://helsinkiregioninfoshare.github.io/hri-demos/

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published