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

von Waldow, Harald Harald.vonWaldow at eawag.ch
Tue Sep 3 12:57:01 UTC 2019


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20190903/fab47b59/attachment.sig>


More information about the ckan-dev mailing list