[ckan-dev] List of all datasets from sub-organizations for the parent organization

Adrià Mercader adria.mercader at okfn.org
Fri Dec 13 10:30:15 UTC 2019


Hi,

Just wanted to quickly mention that ckanext-hierarchy has just been
moved to the ckan Github org and David Read is doing some cleaning up
so it seems like a great moment to submit improvements that benefit
the wider community, obviously if you have the time and it makes
sense:

https://github.com/ckan/ckanext-hierarchy

P. s. this list will shut down next week so I encourage you to follow
the discussion in the new mailing list. Check here for details on how
to migrate: https://ckan.org/2019/11/22/migrating-our-mailing-lists/

On Fri, 13 Dec 2019 at 03:23, mane moshref <many_yammy at yahoo.com> wrote:
>
> Hi Harald,
>
> as you already helped me alot in this case, I have one more question:
>
> at the moment the representation of organizations (both parent and children) are in tree structure. However, I am interested to represent it with their image (logos).
> I am capable of categorizing and styling them in a way I need, however I have a big problem. I cannot access the images.
>
> So, i do something like the following in organization_item.html:
>
> <div class="box" style="background-color:#0065bd;">
>  <center><h2 style="color: white; border: 10px" >org_1</h2></center>
>
> {% for organization in h.get_allowable_children_groups_g('org_1')  %}
>
>             <img src="{{ organization.image_display_url or h.url_for_static('/base/images/placeholder-group.png') }}" alt="{{ organization.title }}" />
>           </a>
>
> {% endfor %}
> </div>
>
> The problem is that I don't get any images but I get the title. My question is, is it because in the extension we only call id, name and title?
> Do you have any idea how I should handle it?
>
> I have 3 organizations each with 5 - 6 subgroups. On the page "Organization" I want tohave three boxes. In each box each organization should be represented similar to the version in core ckan.
>
>
> I do appreciate your help in advance
> Mani
>
>
> On Tuesday, September 3, 2019, 2:57:27 PM GMT+2, von Waldow, Harald <harald.vonwaldow at eawag.ch> wrote:
>
>
> Hi Mandana
>
> "groups" and "organizations" are very similar in CKAN, so it should be
> possible to integrate this into ckanext-hierarchy. The underlying
> functions in core (model.Group.get_children_group*) are the same
> (whether you are dealing with group or organization is determined by
> parameter "type").
>
> > Generally, i have a very big problem in understanding how CKAN calls
> > the packages assigned to a group.
>
> There is a property "groups" in a package with a value of the list of
> groups it belongs to. Usually the packages are found through solr with
> something like "groups:wanted_group" in the searchstring.
>
> Kind regards,
> Harald
>
> On Wed, 2019-08-28 at 12:12 +0000, mane moshref wrote:
> > Thanks Harald for the descriptions. Very much appreciated.
> >
> > Actually, my ultimate aim is to have a hierarchy for the groups. So I
> > thought probably first try the hierarchy for the organizations and
> > then for the group.
> > As your code re-implementation of the "before_search" works very
> > nicely, I am wondered how this could be applied for the group.
> > I mean having the hierarchy for the group is not a problem but again
> > listing all the children groups for the parent group is a challenge
> > for me.
> >
> > Generally, i have a very big problem in understanding how CKAN calls
> > the packages assigned to a group. [It is easy for the organisation as
> > there exists the field "own_org"]. I assume it is managed in the
> > table "member". But how I should search for it and which function
> > exactly does that, I don't know.
> > Do you have by any chance any idea how your implementation of
> > "before_search" can be used for the groups as well?
> >
> >
> > Best regards
> > Mandana
> >
> >
> > ps. Well for the Unicode I just changed the name. So no real fix :(
> >
> > On Wednesday, August 28, 2019, 10:00:24 AM GMT+2, von Waldow, Harald
> > <Harald.vonWaldow at eawag.ch> wrote:
> >
> >
> > Hi Mandana
> >
> > Happy to hear that. Some info for the record:
> >
> > I forked ckanext-hierarchy because there was heavy refactoring
> > involved
> > and also I lost some features on the way and added a bit:
> >
> > + Search for organizations doesn't work (just not implemented). This
> > is
> >   because I could not come up with a satisfactory way to display
> > search
> > results for organizations while keeping the hierarchical display. If
> > there are not too many organizations this might not be an issue (my
> > case). Also we are dealing with two fundamentally different search
> > paradigms.
> >
> > + I kicked out pagination. But that should be easy to re-insert.
> >
> > + I re-implemented (much more robustly, I hope) the modification of
> > the
> > search string necessary to include child-packages
> > (IPackageController:before_search). In the original ckanext-hierarchy
> > this is implemented in a more ad-hoc fashion and will break if the
> > input-search-string is not of a special (simple) form. To do that
> > more
> > generally, I am using my "lucparser module (https://github.com/eawag-
> > rd
> > m/lucparser), which is pulled in as requirement. Without having
> > looked
> > into it, this might be also the reason that the original ckanext-
> > hierarchy doesn't work for for you. Maybe other extensions modify the
> > search-string, or CKAN core has changed it, so that it has a form
> > that
> > the original implementation can't deal with.
> >
> > PS: If you fixed a bug (related to a unicode issue?) I'd be happy
> > about
> > a PR or an Issue.
> >
> >
> > Best,
> > Harald
> >
> >
> >
> >
> > On Mon, 2019-08-26 at 16:48 +0000, mane moshref wrote:
> > >
> > > Many thanks Harald.
> > >
> > > Your code / fork works perfectly (except a tiny problem related to
> > > encoding Ü/Ö/Ä which is already solved).
> > >
> > > I just wondered why the original one doesn't work. I read from the
> > > code that "inlcude-children" should do the job, however, it didn't
> > > work neither in UI nor by manipulating the could and set it to
> > > "True".
> > > If it works for others then probably my own problem.
> > >
> > > Anyway, you saved my day. Thanks a lot
> > > Mandana
> > > On Monday, August 26, 2019, 04:17:31 PM GMT+2, von Waldow, Harald
> > <Ha
> > > rald.vonWaldow at eawag.ch> wrote:
> > >
> > >
> > > Hi Mandana
> > >
> > > ckanext-hierarchy implements a field 'include_children' in
> > > snippets/search_form.html. When this is checked desired behaviour
> > > should result.
> > >
> > > Maybe you want to try out my fork:
> > > https://github.com/eawag-rdm/ckanext-hierarchy_s
> > >
> > > I refactored some stuff but also including datasets from child-
> > > organizations is the default there.
> > >
> > > Best,
> > > Harald
> > >
> > >
> > > On Mon, 2019-08-26 at 11:00 +0000, mane moshref wrote:
> > > > Hello all,
> > > >
> > > >
> > > > I am using the ckanext-hierarchy plugin.
> > > > I have some parent organizations which are basically only name
> > > > (without datasets) and under each couple of sub-organizations or
> > > > children.
> > > > my use case is that I would like to open a parent organization
> > page
> > > > and there I see the list of all datasets from all sub-
> > > organizations.
> > > >
> > > > Question:
> > > > Does anyone know which part of the code I should modify? or in
> > > > general how this works in CKAN?
> > > >
> > > >
> > > > Best regards
> > > > Mandana
> > >
> > > > _______________________________________________
> > > > ckan-dev mailing list
> > > > ckan-dev at lists.okfn.org
> > > > https://lists.okfn.org/mailman/listinfo/ckan-dev
> > > > Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
> > > --
> > > Harald von Waldow
> > > Eawag
> > > ICT Services
> > > Research Data Management
> > > Ueberlandstrasse 133
> > > 8600 Duebendorf
> > > http://www.eawag.ch
> > > https://opendata.eawag.ch
> > > _______________________________________________
> > > ckan-dev mailing list
> > > ckan-dev at lists.okfn.org
> > > https://lists.okfn.org/mailman/listinfo/ckan-dev
> > > Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
>
> >
> > >
> > > _______________________________________________
> > > ckan-dev mailing list
> > > ckan-dev at lists.okfn.org
> > > https://lists.okfn.org/mailman/listinfo/ckan-dev
> > > Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
> > --
> > Harald von Waldow
> > Eawag
> > ICT Services
> > Research Data Management
> > Ueberlandstrasse 133
> > 8600 Duebendorf
> > http://www.eawag.ch
> > https://opendata.eawag.ch
> > _______________________________________________
> > ckan-dev mailing list
> > ckan-dev at lists.okfn.org
> > https://lists.okfn.org/mailman/listinfo/ckan-dev
> > Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
> > _______________________________________________
> > ckan-dev mailing list
> > ckan-dev at lists.okfn.org
> > https://lists.okfn.org/mailman/listinfo/ckan-dev
> > Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
> --
> Harald von Waldow
> Eawag
> ICT Services
> Research Data Management
> Ueberlandstrasse 133
> 8600 Duebendorf
> http://www.eawag.ch
> https://opendata.eawag.ch
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> https://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> https://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev



More information about the ckan-dev mailing list