CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Creating a "tree" with more than two layers in CiviCRM.
Pages: [1]

Author Topic: Creating a "tree" with more than two layers in CiviCRM.  (Read 449 times)

texvet_webmaster

  • I’m new here
  • *
  • Posts: 26
  • Karma: 3
    • The TexVet Initiative
  • CiviCRM version: 4.5.6
  • CMS version: Drupal 7.34
  • MySQL version: 5.5.38
  • PHP version: 5.3.20
Creating a "tree" with more than two layers in CiviCRM.
March 28, 2014, 08:17:16 am
Howdy,

Short Version:
Will CiviCRM allow me to create the equivalent of a taxonomical "tag" tree where groups of tags are, themselves, inside yet another group? [Example: Life (Domain (Kingdom (Phylum (Class (Order (Family (Genus (Species) ) ) ) ) ) ) ).] If so, how?



Long version:
My goal is to tag cases we create in CiviCase with tags from the LA 211 Taxonomy (http://www.211taxonomy.org/). This taxonomy has several broad categories at the top level (Like "Basic Needs") with many second-tier categories under them (Like: "Food"), which have categories under them (Ex: "Emergency Food") with categories under them, and so on.

I know I can implement this as a "flat list" and use hyphens in front of entries (or the taxonomy's alphanumeric index) to indicate how the taxonomy is structured.  Sadly, doing this makes it harder to ask the database to return something like "All cases tagged with "Food" or its sub-domains.  I'd really prefer to properly create the structure in CiviCRM with the proper parent-child associations.

I checked out the Groups and Tags feature (http://book.civicrm.org/user/current/organising-your-data/groups-and-tags/), and I've created several groups with tags in them to classify specific aspects of each case; they all work exactly as expected. However, I don't see a way to put a number of groups in a group.  (Also, were I to do so, it seems that putting tags in a group has a specific effect on how they display in CiviCRM/CiviCase.)

Is there a way to do this and I'm just being dense / overlooking something? If so, how?

I'm gonna go do more research. If you need more information from me, I'm happy to provide it.

Thanks,

Jonathan L.
« Last Edit: March 28, 2014, 08:19:06 am by texvet_webmaster »

lcdweb

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1620
  • Karma: 116
    • www.lcdservices.biz
  • CiviCRM version: many versions...
  • CMS version: Joomla/Drupal
  • MySQL version: 5.1+
  • PHP version: 5.2+
Re: Creating a "tree" with more than two layers in CiviCRM.
March 28, 2014, 09:27:40 am
the tags functionality in civicrm does support a hierarchy. when you create a new tag there is a field to select the parent tag it should be defined under. so in terms of a tag tree, it could simply be handled there.

however... there are some shortcomings.

1) the tag tree interface in the contact (or case) only goes three levels deep. structurally, the data model supports infinite depth. but there are some performance weaknesses in the tree interface that resulted in limiting the depth to three levels.

2) if I understand correctly, your goal is to be able to select a tag at a given depth and return all records flagged at that level AND any of it's children. so if you select at the class level, any children at the order, family, etc. levels would also be returned. the farther down the tree you go, the more refined your list. when searching tags, it does not take into account children. so in this example, if you searched a tag at the class level, it would only return those records actually tagged at that level.

your second option/attempt was groups. groups also support a hierarchy -- when you create a new group you can choose the parent it belongs to. and unlike tags, when you search for contacts in a group, it returns all records directly connected to that group, as well as records attached to children. so it is inclusive in what it returns.

however... groups are limited to contacts only. in your example, you want to classify case records directly. that would not be possible with the current data model.

if I were to assess your situation, I would say that there's definitely some options to work with, but they won't meet your requirements out of the box. you will need to plan on some customizations to fill in your spec requirements.

of the two directions you could go in, it's probably easier to look at extending tags. if you're tree depth is finite, and not incredibly deep (e.g. if you just need to go to level 4 or 5), you could probably work on the UI to extend that. and you could implement some customizations so that if a case is tagged at level 3, you traverse up the tree to also tag it at levels 2 and 1 (with the respective parents). that would be easier than modifying the queries to account for the tag parents/children when searching.
support CiviCRM through 'make it happen' initiatives!
http://civicrm.org/mih

texvet_webmaster

  • I’m new here
  • *
  • Posts: 26
  • Karma: 3
    • The TexVet Initiative
  • CiviCRM version: 4.5.6
  • CMS version: Drupal 7.34
  • MySQL version: 5.5.38
  • PHP version: 5.3.20
Re: Creating a "tree" with more than two layers in CiviCRM.
March 28, 2014, 01:18:56 pm
Thanks for the thorough answer.  I sincerely appreciate it.  I hadn't thought to go tag-to-tag to create the parent-child structure (Silly me.  That makes a bundle of sense.); thanks for the "only three deep limitation" heads-up.

Your answer's given me a good base to progress from.  Time to do some thinkin' and prototyping...

Regards,

Jonathan L.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Creating a "tree" with more than two layers in CiviCRM.

This forum was archived on 2017-11-26.