-
Notifications
You must be signed in to change notification settings - Fork 0
HowTo
clone the rcouch repository from https://github.com/omarkj/rcouch/tree/babelstat.
git checkout babelstat
./configure
make
make install
/opt/refuge/bin/refuge start
You also need to install couchapp to push the couch applications to babelstat. pip install couchapp
go to deps/babelstat/babelstat_couchapps/babelstat_core and type couchapp push
open up an erlang shell:
erl -name tester@127.0.0.1 -setcookie refuge
Attach to the node
^G
r 'refuge@127.0.0.1'
c 2
Create some test documents:
document_creator:test_docs_to_couchdb(<<"lines of code">>,<<"cm">>,1,<<"days">>).
document_creator:test_docs_to_couchdb(<<"commits">>,<<"km">>,1,<<"days">>).
Filter = babelstat_api:create_filter(<<"km">>,1,days,undefined,undefined).
Query = babelstat_api:create_query(<<"Spawnfest">>,<<"Teams">>,<<"Jesus don't want me for a sunBEAM">>,<<"code">>,<<"commits">>).
babelstat_api:run_query(Query,Filter,fun(Res)-> io:format("Results pn",[Res]) end).
This should return a single document with the dates and values from all of the documents matching the Query parameters.
Now you're ready to create your first calculation which you need to do through Futon.
got to [http://localhost:5984/_utils/database.html/babelstat]
Open another browser at the same location.
In the first browser open one of the documents (click on a uuid).
In the second broser click the New Document in the upper left corner.
In both browsers select the Source tab.
Copy the first document starting from "type" and down and paste it under the "id" tag in the second document (Create a copy).
Go back to Fields view in the copied document and change the title of the document.
Double click the calculation value and change it to
{Spawnfest,Teams+Jesus don't want me for a sunBEAM,lines of code}+{Spawnfest,Teams,Jesus don't want me for a sunBEAM,code,commits}
Save the document.
You have now created your first calculated time-series.
Go back to your erlang shell thats attached to the node:
Query1 = babelstat_api:create_query(<<"Spawnfest">>,<<"Teams">>,"Jesus don't want me for a sunBEAM",<<"code">>,<<"The name you put in your calculated documents title">>).
babelstat_api:run_query(Query1,Filter,fun(Res)-> io:format("Results pn",[Res] end).
You should now have received a new series with the values from the first two series added together.
You can now experiment with changing the values in the filter to convert the metric from inches, or multiplying the values by changing the scale.
Filter = babelstat_api:create_filter(<<"inches">>,10,days,undefined,undefined).
babelstat_api:run_query(Query,Filter1,fun(Res)-> io:format("Results pn",[Res] end).