complex hierarchical taxonomies in drupal?


I've been struggling with this problem for some time now, and am a bit stumped. Bits of it are trivial to solve, but when I start hooking things up, there's a pretty big gap and disconnect.

On the surface, it's a simple problem. I'm using Drupal, and am building a website to store things like profiles for individuals. That's easy. I need to add lists of the degrees they've been awarded. Like this:

D'Arcy Norman

  • Bachelor's of Science, 1992 (University of Calgary)
  • Bachelor's of Education, 1994 (University of Calgary)

Sounds easy. Could just be a CCK content type, with a text field that allows multiple values. Enter whatever text you want.

buuuuut...

I also need for the site to be organized such that I can list everyone who's earned a BSc in Zoology from UCalgary, or everyone that's earned a Bachelor's Degree in 1992, or just people who have earned a BEd from UBC in 1998. Or potentially any combination or permutation.

So, simple text fields don't cut it. They solve the display problem but not the data modeling and querying problems.

Taxonomies seem like the natural way to store the data - I can set up a Taxonomy vocabulary to represent the full hierarchical structure that is needed.

The problem with a hierarchical taxonomy is that I can't seem to get it to actually display the hierarchy, with the full lineage shown. On the node display page, I get something like this by default:

First, that shows all terms from all vocabularies. In this case, "calgary" and "ucalgary" are from the Tags vocabulary, and "Bachelors" "Education" and "Science" are all from the Degrees vocabulary. Except they're all munged together. And the hierarchy is completely gone.

With a bit of custom code, I can separate the vocabularies, like this:

Getting closer. But the hierarchy is still gone. I can't get it to show something like:

Degrees:

  • Bachelors > Science
  • Bachelors > Education

The specifications call for the end result to look similar to this:

And there's perhaps an even bigger problem - I can't associate a year or institution with the degree. Under this strategy, there is no easy way to say Bachelors > Science (University of Calgary, 1992) and have the data be stored in such a way as to be properly searchable and meaningful as opposed to be essentially for display purposes only.

The other thing I'm hitting my head against is the need to keep data entry as simple as possible. Some really nicely designed forms have been sketched out with ease of use as the primary concern. But they're going to be pretty darned difficult to implement in Drupal without writing custom modules. If ease of use wasn't such a big concern, I could probably just use text fields for display so I could enter whatever text I wanted to represent the degrees, and have a set of Taxonomy vocabularies to be used to represent the data for querying and filtering. But that's redundant data entry, and would be very confusing to anyone actually entering the data.

One other idea I had was to model institutions and degrees as nodes (using a custom content type) and use the node relation CCK field to tie it together. That could work, and we've used that technique on other projects (like the Great Teachers website) but I'm not sure that's the best angle to take in this case.

Any Drupalistas out there with some ideas on how to properly represent multiple bits of hierarchical data to store and display things like sets of degrees granted in given years by given institutions?


See Also