standalone debian packaging

This commit is contained in:
Benjamin Dauvergne 2016-06-24 15:43:55 +02:00
parent 2fc56d8059
commit 7f46a1b8a8
5 changed files with 7 additions and 237 deletions

View File

@ -1,6 +1,3 @@
BI for Publik
=============
w.c.s. OLAP
~~~~~~~~~~~
@ -27,227 +24,3 @@ cube.
--key KEY HMAC key for signatures
--pg-dsn PG_DSN Psycopg2 DB DSN
--schema SCHEMA schema name
Bi-Joe
~~~~~~
BI Joe is a library and a Django application to simplify querying a postgresql
database containing a star schema with BI annotations in order to
easily produce BI dashboards
It's inspired by the Cubes project.
Feature
~~~~~~~
* use PostgreSQL database as datastore,
* declare joins to define star schemas of your cubes
* declare dimensions as SQL query or exepression defining, label, group by,
ordering or member list.
* declare measure as SQL expression using aggregate functions
Missing features
~~~~~~~~~~~~~~~~
* hierarchical dimensions
* measure necessiting a rollup (percentage based on count() of facts at an upper
level)
Model
~~~~~
You declare your model using JSON files, those JSON files are targeted by a list
of glob patterns in the Djagno setting BIJOE_SCHEMAS.
.. code:: python
BIJOE_SCHEMAS = ['/var/lib/bijoe/cubes/*.model']
The JSON model files must conform to this schema:
* name: technical identifier of the mode, a short string without space if
preferred
* label: any string describing the model
* pg_dsn: string describing the connection to PostgreSQL, as expected by
psycopg2, ex.: `"dbname=olap_db user=admin password=xxx"`
* search_path: search path to set set if relations are not all in the public
schema,
* cubes: the list of cube descriptors,
* name: technical identifier of the cube, same remark thant for models,
* label: as for model,
* fact_table: name of the table storing facts
* key: column of the table identifying individual facts
* joins: list of equality joins, all joins are RIGHT OUTER JOINS, table are
cross joined when drill involve dimensions using multiple joins.
* name: SQL identifier for naming the join,
* table: name of the relation being joined,
* master: table and column indicating the left part of the equality
condition for the join, you can use `mydim_id` to reference the fact
table or `otherjoin.mydim_id` to reference another join.
* detail: name of the column on the joined table for the equality condition,
* kind: type of join, must be `inner`, `left` or `right`, default is right.
* dimensions: list of dimension descriptors,
* name: technical identifier of the dimension, it will be used to name the
dimension in the API,
* label: human description for the dimension, used in UIs,
* join: list of join names, indicate that some joins must be used when using
this dimension,
* type: indicate the type of the dimension, numerical, time-like,
geographical, duration, etc..
* value: SQL expression giving the value for the dimension,
it can be different than the value used for filtering or grouping,
* sql_filter: SQL expression that will be used in the SQL template
`<sql_filter> IN (...)` when filtering along a dimension,
* value_label: SQL expression giving the shown value
* group_by: SQL expression to group facts along a dimension, default is to
use value
* order_by: SQL expression to order dimension values, default is to use
value
* measures: list of measure descriptors
* name: as for models,
* label: as for models,
* type: type of the measure: integer or duration,
* expression: SQL expression indicating how to compute the aggregate,
ex.: `avg(delay)`, `count(product_type)`.
Example
+++++++
.. code:: json
{
"name" : "cam",
"label" : "cam",
"pg_dsn" : "dbname=wcs-olap",
"search_path" : [
"cam",
"public"
],
"cubes" : [
{
"name" : "all_formdata",
"label" : "Tous les formulaires",
"fact_table" : "formdata",
"key" : "id",
"joins" : [
{
"name" : "formdef",
"master" : "formdef_id",
"detail" : "id",
"table" : "formdef"
},
{
"name" : "dates",
"master" : "receipt_time",
"detail" : "date",
"table" : "dates"
}
],
"dimensions" : [
{
"name" : "formdef",
"label" : "formulaire",
"type" : "integer",
"join" : ["formdef"],
"value" : "formdef.id",
"value_label" : "formdef.label"
},
{
"join": [
"receipt_time"
],
"label": "date de la demande",
"name": "receipt_time",
"type": "date",
"value": "receipt_time.date"
},
],
"measures" : [
{
"name": "count",
"label": "nombre de demandes",
"type": "integer",
"expression": "count({fact_table}.id)",
},
{
"name" : "avg_endpoint_delay",
"label" : "Délai de traitement",
"type" : "duration",
"expression" : "avg(endpoint_delay)"
}
]
}
]
}
API
~~~
Model description is handled by `bijoe.schema` and model querying by
`bijoe.engine`.
bijoe.schema.Warehouse
++++++++++++++++++++++
`Warehouse` is the main class to manipulate models, it has two class methods:
* `from_json(d)` which transform a dictionnary obtained by eventually parsing
some JSON file to a Warehouse object.
* `to_json()` which transform a Warehouse object into a JSON compatible
dictionnary.
bijoe.engine.Engine
+++++++++++++++++++
`Engine(warehouse)` is the entry-point for querying a model, you get an
`EngineCube` object by indexing the engine with the name of a cube.
.. code:: python
cube = Engine(warehouse)['mycube']
You can query your cube using the `query` method.
.. code:: python
cube.query(filters=[('year', [2013, 2014, 2015])],
drilldown=['year', 'product'],
measures=['count', 'avg_sale'])
It returns a sequence of rows whose elements are the values of the drilldown
dimensions in the same order as in the query followed by the values of the
measures also in the same ordre as the query.
The `count` measure is a special measure which is always present whose
expression is always `count({fact_table}.{key})` where `fact_table` and `key`
are the corresponding attributes of the cube.

4
debian/changelog vendored
View File

@ -1,5 +1,5 @@
publik-bi (0.0.0-1) jessie; urgency=low
wcs-olap (0.0.0-1) jessie; urgency=low
* Initial package, targetting jessie.
-- Benjamin Dauvergne <bdauvergne@entrouvert.com> Mon, 18 May 2016 13:59:28 +0200
-- Benjamin Dauvergne <bdauvergne@entrouvert.com> Mon, 4 Jun 2016 13:59:28 +0200

6
debian/control vendored
View File

@ -1,4 +1,4 @@
Source: publik-bi
Source: wcs-olap
Section: python
Priority: optional
Maintainer: Benjamin Dauvergne <bdauvergne@entrouvert.com>
@ -7,8 +7,8 @@ Standards-Version: 3.9.1
X-Python-Version: >= 2.7
Homepage: http://dev.entrouvert.org/projects/publik-bi/
Package: publik-bi
Package: wcs-olap
Architecture: all
Depends: ${python:Depends}
XB-Python-Version: ${python:Versions}
Description: Publik BI tools
Description: Export w.c.s. datas into a snowflake schema built on PostgreSQL

View File

@ -1,3 +1,2 @@
python-ldap python-ldap
isodate python-isodate
psycopg2 python-psycopg2

View File

@ -42,7 +42,7 @@ def get_version():
return '0.0.0'
setup(name="publik-bi",
setup(name="wcs-olap",
version=get_version(),
license="AGPLv3+",
description="Export w.c.s. data to an OLAP cube",
@ -54,10 +54,8 @@ setup(name="publik-bi",
maintainer_email="bdauvergne@entrouvert.com",
packages=find_packages(),
include_package_data=True,
install_requires=['requests', 'django', 'psycopg2', 'isodate', 'Django-Select2',
'XStatic-ChartNew.js'],
install_requires=['requests', 'psycopg2', 'isodate'],
entry_points={
'console_scripts': ['wcs-olap=wcs_olap.cmd:main'],
},
scripts=['bijoe-ctl'],
cmdclass={'sdist': eo_sdist})