[OpenSpending-discuss] Help with the mapping file - views

Friedrich Lindenberg friedrich.lindenberg at okfn.org
Fri Dec 2 08:18:48 UTC 2011


Hi Michal,

On Tue, Nov 29, 2011 at 12:01 AM, M.Skop KohoVolit.eu
<michal.skop at kohovolit.eu> wrote:
> So far:
> A) local osvalidate says me: [model.mapping.recipient.fields.0.column]:
> Required
> But it should a constant ('public') - so how to define a constant?

There is no need to define constants in the newer version of
OpenSpending - these were in the past mostly used as a workaround for
missing "to" and "from" dimensions (they're now optional) and to
separate datasets.

> B) local osvalidate and openspending say me: [model.mapping]: At least one
> dimension needs to be marked as a 'key' which can be used to uniquely
> identify entries in this dataset. How do I "mark it as a 'key'" ? I've tried
> name it 'key', set datatype as 'id' or 'key', no success.
> (http://readthedocs.org/docs/openspending/en/latest/model/design.html#modeling-mapping-schema
> says nothing about such a key)

We've moved around the unique_keys mechanism: instead of defining the
unique keys set in the dataset section, you can now apply a simple
"key": true flag to those dimensions you wish to include. I've also
updated the docs to reflect that.

- Friedrich


> And I guess the B) is also the reason I cannot actually Load the file (0
> entries).
>
> Thanks a lot,
> Michal
>
>
> On 2011-11-28 22:19, Friedrich Lindenberg wrote:
>>
>> Hi David,
>>
>> interesting issue, thanks for reporting it. This seems to be some
>> munging going wrong with the classifier taxnonmies, but thankfully
>> we've now abolished them altogether. FWIW, in the latest version you
>> should be able to express this as:
>>
>>     {
>>       "entity": "dimension",
>>       "label": "Breakdown by programme",
>>       "name": "default",
>>       "dimension": "programme_group",
>>       "drilldown": "programme"
>>     }
>>
>> Best,
>>
>> - Friedrich
>>
>> On Mon, Nov 28, 2011 at 10:11 PM, David Cabo<david at calibea.com>  wrote:
>>>
>>>  Hi,
>>>  I was just picking up the import of Spanish budget data [1] into
>>> OpenSpending (after many months away), and I ran into a problem with the
>>> views definition, maybe it's related to Michal's issue:
>>>  I had a classifier and a taxonomy both named 'programme_group' (with an
>>> underscore), and a view associated to them like this:
>>>     {
>>>       "entity": "classifier",
>>>       "label": "Breakdown by programme",
>>>       "name": "default",
>>>       "dimension": "programme_group",
>>>       "breakdown": "programme",
>>>       "filters": {"taxonomy": "programme_group"}
>>>     }
>>>  Other views worked fine, but this one wasn't: I was just getting the
>>> list
>>> of entries, but not the tree view. I then noticed that the url was
>>> displaying a hyphen, not an underscore, for
>>> example http://sandbox.openspending.org/classifier/programme-group/453
>>> I've
>>> just changed the model definition to use a hyphen in the dimension name,
>>> and
>>> now it all seems to be working.
>>>  Regards,
>>> /david
>>> [1]: http://thedatahub.org/dataset/spain-national-budget-2008-2011
>>> On 28 November 2011 19:29, Friedrich Lindenberg
>>> <friedrich.lindenberg at okfn.org>  wrote:
>>>>
>>>> Hi,
>>>>
>>>> I've looked at the model file a bit but couldn't immediately find the
>>>> error. Maybe you could try the latest version of OpenSpending, where
>>>> we can edit this together. This requires some editing of the model,
>>>> but there's a utility to help you with it:
>>>> https://github.com/okfn/osvalidate. After doing that, you can sign up
>>>> on openspending.org and then using the "Create a dataset..." option in
>>>> the "Datasets" dropdown. There, you can link in data references and
>>>> copy&  paste the mapping and views sections of the model file. This
>>>>
>>>> should give you much better error messages and you can edit the views
>>>> without reloading the data.
>>>>
>>>> - Friedrich
>>>>
>>>> On Mon, Nov 28, 2011 at 5:40 PM, M.Skop KohoVolit.eu
>>>> <michal.skop at kohovolit.eu>  wrote:
>>>>>
>>>>> I would like to ask you for help with the mapping file - views. I
>>>>> probably
>>>>> still cannot get the idea of drilldowns/taxonomies/cuts/filters right.
>>>>> I
>>>>> have tried many settings, reading the wiki and some mapping files, but
>>>>> no
>>>>> success with following:
>>>>>
>>>>> I have a datafile
>>>>> http://sandbox.openspending.org/dataset/cz_2006-2010_os_2
>>>>> which has 7 different categories (levels)
>>>>> 1:budget - 2:chapter(=group of organizations) - 3:organization -
>>>>> 4:group
>>>>> of
>>>>> entries (e.g. 'salaries') - 5:subgroup of entries - 6:subsubgroup of
>>>>> entries
>>>>> - 7:entry(account number) ->  amount
>>>>> e.g.
>>>>> 1:budget - 2:Chapter 311 - 3:Organization X - 4:group 4_1 - 5:subgroup
>>>>> 5_1 -
>>>>> 6:subsubgroup 6_1 - 7:entry 5111
>>>>> or
>>>>> 1:budget - 2:Chapter 311 - 3:Organization Y - 4:group 4_1 - 5:subgroup
>>>>> 5_1 -
>>>>> 6:subsubgroup 6_1 - 7:entry 5111
>>>>>
>>>>> (mind that spending groups at level 4 till 7 are the same for all the
>>>>> organizations)
>>>>>
>>>>> I want to be able to drilldown (with appropriate filters) _using the
>>>>> tree-chart_ (and api)
>>>>> A) 1 ->  2 ->  3 ->  4 ->  5 ->  6 ->  7 (and get the final amount in
>>>>> given
>>>>> year
>>>>> and organization and entry=account)
>>>>> and/or
>>>>> B) 1 ->  4 ->  5 ->  6 ->  7 ->  2 ->  3 (or similarly 1 ->  4 ->  2 ->
>>>>>  3 ... )
>>>>>
>>>>> How shall I specify the mapping file?
>>>>>
>>>>> Thanks a lot for your help,
>>>>> Michal
>>>>> p.s.: It works in desirable manner down to level 3/4 at the
>>>>> http://sandbox.openspending.org/dataset/cz_2006-2010_os_2, but I cannot
>>>>> get
>>>>> it work well further down to level 6/7
>>>>>
>>>>> --
>>>>> Mgr. Michal Škop, Ph.D.
>>>>> KohoVolit.eu
>>>>> michal.skop at kohovolit.eu
>>>>> +420 775 187 021 / +420 721 484 915
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> openspending mailing list
>>>>> openspending at lists.okfn.org
>>>>> http://lists.okfn.org/mailman/listinfo/openspending
>>>>>
>>>> _______________________________________________
>>>> openspending mailing list
>>>> openspending at lists.okfn.org
>>>> http://lists.okfn.org/mailman/listinfo/openspending
>>>
>>>
>
>
> --
> Mgr. Michal Škop, Ph.D.
> KohoVolit.eu
> michal.skop at kohovolit.eu
> +420 775 187 021 / +420 721 484 915
>
>
> _______________________________________________
> openspending mailing list
> openspending at lists.okfn.org
> http://lists.okfn.org/mailman/listinfo/openspending




More information about the openspending mailing list