[ckan-dev] Data viewer oddities

Rufus Pollock rufus.pollock at okfn.org
Wed Apr 18 23:08:30 UTC 2012


On 16 April 2012 16:05, Eduardo Santos <eduardo.edusantos at gmail.com> wrote:
> Hi everybody,
>
> I'm new to the list and I don't know if I'm making the question on the right
> place, but this post is exactly what I've been trying to do last week and I
> wasn't able to finish yet. Where's this dataview API? I can see the data
> preview is shown using jQuery in application,js, but I couldn't find this
> data viewer with grids and graphs.

The Data Viewer appears on resource pages, e.g.:

<http://thedatahub.org/dataset/gold-prices/resource/b9aae52b-b082-4159-b46f-7bb9c158d013>

The data viewer itself is a standalone javascript application and
library called Recline which we embed but which you can reuse
independently:

<http://okfnlabs.org/recline/>

It gets data from a CKAN instance via the CKAN DataStore's Data API:

<http://docs.ckan.org/en/latest/datastore.html>

Or if that is absent it uses the data proxy:

<http://github.com/okfn/dataproxy>

> Can you tell me wich files are needed and how I could customize this viewer
> interface? I'm using Ckan 1.6.

The DataStore is a new feature in CKAN v1.7 and for it to work in v1.6
you must be looking at a CSV or Excel file.

To customize the viewer you would either do work in CKAN around the
embedding / integration code or customize Recline directly. Happy to
talk more about both these options -- it would be useful to know more
about what you are trying to do.

Rufus

> 2012/4/16 Rufus Pollock <rufus.pollock at okfn.org>
>>
>> On 16 April 2012 10:14, Mark Wainwright <mark.wainwright at okfn.org> wrote:
>> > There seem to be a few bugs in the data viewer, which I had a quick
>> > play with when Jonathan Gray asked via Twitter: "how can I reload a
>> > graph? E.g. if I want to see date on the x axis for the gold example?
>> > http://thedatahub.org/dataset/gold-prices"
>> >
>> > (i) I believe the answer to J's question should be that it
>> > automatically reloads when you choose a new variable, and I believe
>> > also that it actually does this; but I suspect that Jonathan is not
>> > seeing it happen because the labelling of the axes is completely
>> > wrong, and doesn't change when he changes the variable from '__id__'
>> > to 'date' (the shape of the graph is the same).
>> >
>> > But besides the axis-labelling problems, there are other problems with
>> > this.
>> >
>> > (ii) Try plotting 'date' against '__id__'. The graph should be a
>> > straight line, but it is blank.
>> >
>> > (iii) Most strangely, try plotting __id__ against __id__. The result
>> > is a graph that wiggles up and down in a mystifying way - it is not
>> > the prices data, but nor is it the straight line one would naturally
>> > expect!
>>
>> Have you *sorted* the data? By default the data does not come back in
>> sorted form. This combined with a "pseudo-bug" regarding the handling
>> of numeric data which is in string form will result in all the
>> behaviour you mention:
>>
>> * Because the data was imported as a CSV all values were interpreted
>> as *strings* when I uploaded the data
>> * As such when plotting the graph Flot will simply use index of the
>> data point was that the x-axis value (because it does not know the
>> data is numeric)
>> * Thus you point 1 with, say, values __id__ = 500, date=.... will get
>> plotted at x-axis value 1 even if you choose x-axis to be __id__ or
>> date
>> * Because the data is not sorted you won't get a straight line even
>> when plotting against __id__
>>
>> The fix for this which is definitely poor UX would be:
>>
>> * Ability to configure a default sort field
>> * Better casting of data upon upload (so numeric data in csv would get
>> recognized as such ...) - use of mapping in elasticsearch
>> * Better casting of data in flot graph
>>
>> Rufus
>>
>> _______________________________________________
>> ckan-dev mailing list
>> ckan-dev at lists.okfn.org
>> http://lists.okfn.org/mailman/listinfo/ckan-dev
>
>
>
>
> --
> Eduardo Santos
> Analista de Sistemas
>
> http://eduardosan.wordpress.com
> http://twitter.com/eduardosan



-- 
Co-Founder, Open Knowledge Foundation
Promoting Open Knowledge in a Digital Age
http://www.okfn.org/ - http://blog.okfn.org/




More information about the ckan-dev mailing list