[Digikam-users] Rating Pyramid (database subset statistics)

Johnny yggdrasil at gmx.co.uk
Thu Sep 1 20:28:17 UTC 2011


 Peter Shute <pshute-pu7m9EYnM64QrrorzV6ljw at public.gmane.org> writes:
> From: Mattias Carlsson
>
>> Having rated a bunch of images, I would like to see a rating statistics, e.g. a
>> rating pyramid as presented at http://docs.kde.org/development/en/
>> extragear-graphics/digikam/dam.html. Now, I know it would be possible to choose
>> advanced filter for each of the rating and picture subset, noting the number of
>> item for each rating in e.g. Spreadsheet and then compare to an "optimal"
>> rating pyramid, but this would be inflexible to use for different subsets.
>>
>> It would be slick to have a function where you can select any subset of
>> pictures and choose to get a "rating pyramid" displaying the rating ratio for
>> the selection. A graphic pyramid could simplify the viewing of the skewing, but
>> just numbers in a table would suffice together with the recommendation from
>> e.g. the posted link and maybe also a "diff ratio" for each rating to highlight
>> the skewing of the rating.
>>
>> Is there some existing way to do this, or is this a feature that anyone else
>> also would find useful?
>>
> It sounds like the sort of thing that would be fairly simple if you queried the
> database directly with SQL commands. Grouping by rating could give you the
> counts for each rating with one query, if that's what you mean, grouped by
> year, etc, if necessary. Does anyone know how to access the database directly?
> Is there a recommended front end?
>
> I would have simply called it the ratings counts. It's only a pyramid if you
> get more bad shots than good shots, which is true for most of us, of course.

Picking up an old thread as this was a good challenge while learning
Python coding! The attached Python script creates a rating pyramid
for the entire database. Currently, it creates two pyramids, one
with /all/ ratings and one with only 1-5 ratings (to avoid a wide base
that makes the top ridiculously small if one has many lowly rated
images).

Admittedly, this is not the greatest and most flexible thing, but a
concept if someone is inclined to build on it further, in particular it
would be great to run only for subalbums or other subsets of the DB.

This was written using Python 2.7.1. To use, that needs be installed as
well as the pyton modules sqlite and tkinter. The path to the digikam database
must be supplied as a command line argument.

./ratingpyramid.py /your/path/to/digikam_images.db

The necessary python modules can be installed by (on Fedora)
: yum install python python-sqlite2 

Also, don't forget to make the script executable:
: chmod 755 ratingpyramid.py

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ratingpyramid.py
URL: <http://mail.kde.org/pipermail/digikam-users/attachments/20110901/13d6d9e4/attachment-0001.ksh>
-------------- next part --------------

Example view:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ratingpyramid.jpg
Type: image/jpeg
Size: 33148 bytes
Desc: ratingpyramid example
URL: <http://mail.kde.org/pipermail/digikam-users/attachments/20110901/13d6d9e4/attachment-0001.jpg>
-------------- next part --------------

Cheers!
-- 
Johnny


More information about the Digikam-users mailing list