Jump to content

Research talk:Revision scoring as a service/Work log/2016-06-08

Add topic
From Meta, a Wikimedia project coordination wiki

Wednesday, June 8, 2016[edit]

Working on loading a labeling campaign for the WikiEd team. They want to label articles by whether they are academic/pop-culture or not so that they can see if students are contributing to core/non-pop-culture articles in Wikipedia. Here's my notes on doing the loading:

halfak@wikilabels-01:/srv/wikilabels/config$ sudo -u www-data ../venv/bin/wikilabels new_campaign -h
Creates a new campaign

Usage:
    new_campaign -h | --help
    new_campaign <wiki> <name> <form> <view> <labels-per-task>
                 <tasks-per-assignment> [--config=<path>] [--force]

Arguments:
    <wiki>                  Wiki database id, for example fawiki, dewiki, etc.
    <name>                  Name of campaign, note that it will return error if
                            you define a duplicate name.
    <form>                  The name of the form
    <view>                  The view for tasks
    <labels-per-task>       The number times a task can be assigned to
                            different labelers
    <tasks-per-assignment>  The number of tasks assigned per workset

Options:
    -h --help               Prints this documentation
    --config=<path>         Path to a config directory to use when connecting
                            to the database [default: config/]
    --force                 Ignore name clashes when creating the campaign
halfak@wikilabels-01:/srv/wikilabels/config$ sudo -u www-data ../venv/bin/wikilabels new_campaign enwiki "Article topic (100 pages)" article_topic PageAsOfRevision 10 10
{'id': 34, 'tasks_per_assignment': 10, 'active': True, 'created': datetime.datetime(2016, 6, 8, 16, 43, 35, 862841), 'wiki': 'enwiki', 'name': 'Article topic (100 pages)', 'form': 'article_topic', 'view': 'PageAsOfRevision', 'labels_per_task': 10}

halfak@wikilabels-01:/srv/wikilabels/config$ sudo -u www-data ../venv/bin/wikilabels task_inserts -h
Inserts a set of tasks into a campaign

Usage:
    load_tasks -h | --help
    load_tasks <campaign-id> [--config=<path>]

Arguments:
    <campaign-id>  The campaign that the tasks should be associated with

Options:
    -h --help        Prints this documentation
    --config=<path>  Path to a config directory to use when connecting
                     to the database [default: config/]
halfak@wikilabels-01:/srv/wikilabels/config$ cat ~/datasets/article_topic.stratified_100.tsv | sed -r 's/(.*)/{"rev_id": \1}/' | less
halfak@wikilabels-01:/srv/wikilabels/config$ cat ~/datasets/article_topic.stratified_100.tsv | sed -r 's/(.*)/{"rev_id": \1}/' | sudo -u www-data ../venv/bin/wikilabels task_inserts 34

Well, that was a lot easier than running the SQL manually.  :) --EpochFail (talk) 16:51, 8 June 2016 (UTC)Reply