Note: Very rudimentary and slightly mobile specific. Eventually stuff will be refactored out of here to be a generic thing that everyone doing EL -> Limn can use
Also see https://wikitech.wikimedia.org/wiki/Mobile_Reportcard
You will need Limn itself.
To run the generate.py
script you should create a Python virtualenv, activate it and install all the required dependencies:
$ virtualenv env $ source env/bin/activate $ pip install -r requirements.txt
After that, every time when you want to run generate.py
you only need to activate the virtualenv with all the dependencies already installed by running source env/bin/activate
.
Later you need to link the data directory to the Limn instance. Assuming that you have Limn cloned to ~/limn
and this project to ~/limn-mobile-data
, you will need to run the following command (only once):
$ cd ~/limn $ coke --vardir ./var --data ~/limn-mobile-data --to mobile link_data
Then you should be able to start Limn by running npm start
and see it in action at http://localhost:5000
.
You will need to install some header files for some of the Python dependencies to compile. To do that it's best if you install MySQL and libyaml using Homebrew:
$ brew install mysql $ brew install libyaml
On Ubuntu the following does the trick:
$ sudo apt-get install libmysqlclient-dev libyaml-dev
mobile/<name>.sql
http://datasets.wikimedia.org/limn-public-data/mobile/datafiles/<name>.csv
to appropriate position in dashboards/reportcard.json
mobile/config.yaml
python generate.py -c scripts/config.yaml mobile -g <graphname>
By default the instance you run will show graphs using production data. To generate the data for your local instance you need to make the analytics databases available to your local machine. If you have access to stat1, you can do that by running:
$ scripts/ssh
in a separate terminal window and leaving it open.
Then, you should create a file called scripts/my.cnf.research
with the following content:
[client] user=[analytics DB user] password=[analytics DB password]
Now, you should be able to run generate.py
with config overrides:
$ python generate.py -c scripts/config.yaml mobile -g my_graph_id
When all the data is generated you still need to do one more thing to let Limn know that it should use the local data. The hacky solution is to replace all the data URLs temporarily. You can do it by running:
$ scripts/localurl
Now, you should be able to do:
$ cd ~/limn $ npm start
and see your local instance data at http://localhost:5000
. You have to remember to replace all the local URLs to remote URLs before pushing your changes though by running:
$ scripts/remoteurl