How to auto-assign a term based on a combination of terms from three other vocabularies? This is a very odd scenario, so bear with me:

I'm importing data from a CSV file via the Feeds module to create product reference nodes. There are 3 columns that contain a term (let's call the columns "Code Types"), so naturally, I set up 3 vocabularies for the product reference nodes to use and mapped/imported the Code Type's terms into each. The client had determined long ago that the terms would not make much sense to the customers, so being able to search for products by selecting a combination of terms would not be helpful. To combat this, new user-friendly keywords were added on the client's old site by assigning each a combination of the 3 terms. I'm trying to replicate this for the new site, and it's driving me insane. 

I first began by adding the same 3 Code Type vocabularies to a new 4th "Product Keywords" vocabulary (Yes, terms within terms). After no luck with term or entity reference fiddling, EVA, etc., I decided referencing would go smoother if I made the Keywords a content type with the 3 Code Type term reference fields instead of its own vocabulary. I'm still open to either option, though.

What has to happen is that a product reference node is automatically assigned the Keyword term that exactly matches its 3 Code Type term reference fields, and not all Code Type term reference fields have to have a value. Here are some examples:

Product #42 has:
CodeType1 = "Red"
CodeType2 = "Wheel"
CodeType3 = "Hot Dog"

Product #216 has:
CodeType1 = [empty]
CodeType2 = [empty]
CodeType3 = "Hot Dog"



Keyword "Sloth" has:
CodeType1 = "Red"
CodeType2 = "Wheel"
CodeType3 = "Hot Dog"

Keyword "Muffin" has:
CodeType1 = [empty]
CodeType2 = [empty]
CodeType3 = "Hot Dog"



Product #42 needs to have the keyword "Sloth" automatically assigned to it.

Product #216 needs to have the keyword "Muffin" automatically assigned to it.

Sorry for the longwindedness. It's urgent, and I'm edging toward panic mode. Any ideas? Please?
These are some ideas to accomplish this through Drupal (rather than Excel). 

You could do this with a combination of custom modules and Rules, or solely with Rules (which might be a bit more laborious). I'm focusing on the version only with Rules. I haven't tested this, so there may be some adjustments needed.

1. Create a "Catalog" content type that catalogs all combinations of codetypes

Create a content type that will act as a "catalog of codetypes", containing all possible combinations of codetypes and their unique keyword assigned to each combination. This would take an initial investment of time for someone to enter all combinations. Be sure to enter a special code (like the string "empty") when a codetype is not present in a specific combination.

2. Create a View of the "Catalog" content type with three Contextual Filters that filter for a specific combination of the 3 codetypes

(This step needs to be tested and possible tweaked quite a bit). You would need to define the path as /catalog/%/%/% to create placeholders for empty codetypes. There would be 3 Contextual Filters for each of the 3 codetype fields in the catalog. Be sure to provide the fixed default value "empty" in the configuration of When the filter value is not in the URL. The result of this View would be a single record that contains the specific combination of codetypes.

3. Install View Bulk Operations and add it to the View

After enabling it, add a VBO field to the View created in step 2. There is no need to select a specific operation. This field will be used to load the single catalog record into Rules later on.

4. Create a Rule that reacts to new (imported) Product nodes being saved

This Rule will react to the Products being created through the use of Feeds. Basically it needs to load a list of entity objects from the VBO you created above. Pass the three codetypes as arguments the the View. 

5. Use the Rule to Set data value of the Keyword field in each of the imported Products.

This step may require some tweaking. You will need to bring into scope the Keyword field of the Catalog record provided by the View. That may involve creating a separate Component that has a condition that brings it to scope, or installing Conditional Rules to create an if statement that brings it to scope. Once the Keyword field of the Catalog node is brought into scope, you use its value to assign it to the Keyword field of the imported Product

So, that's it in a nutshell. You could replace several of the steps with code in a custom module, and avoid using VBO and Rules altogether - you would use EntityFieldQuery to load the Catalog node with the three codetypes, and hook_node_insert() to react to the Product node being imported/created. There may be alternative hooks in the Feeds API that may make this possible too.

I hope this helps... Let me know if you have questions.