Tough one: Is this even possible? CCK

saltcod - August 28, 2008 - 16:50

I'm creating a database of antibiotic recommendations for work, and I'm having conceptual issues with AND/OR options.

As an example:

Someone with Mengingitis should take:

Ampicillin (200mg for 10days)
or
[Gentamicin (40mg - 10days) + Cefotaxime (200mg - 7days)]

It would be simple if they had to take only Ampicillin OR Gentamicin -- but they need to take Gentamicin AND Cefotaxime.

Any idea how Do I deal with the And/ors in CCK?

One option would be to make

WorldFallz - August 28, 2008 - 17:18

One option would be to make one content type for disease and another for medications. In the disease content type add a multiple value nodereference field that points to your medications content type. As a bonus, you can add a nodereferrer field to your medications content type and it will list all the diseases that have that medication listed.

it's been my experience that with drupal the question is never "if" but "how", lol...

===
"Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime."
-- Lao Tzu
"God helps those who help themselves." -- Benjamin Franklin
"Search is your best friend." -- Worldfallz

thanks worldfallz! there's

saltcod - August 28, 2008 - 17:31

thanks worldfallz! there's a lot to swallow in your post - I'm going to have to get to work!

i never thought of doing it that way.

Thanks very much for taking the time to write.

Humm.........much harder

saltcod - August 28, 2008 - 17:56

Humm.........much harder than I thought.

I can't even find where to download nodereference.

Is nodereference a dead module? It gets mentioned a lot, but I can't find it to download.

Thanks

ok. So node reference is a

saltcod - August 28, 2008 - 17:59

ok. So node reference is a part of CCK.

Great.

Now I just need to figure out how the nodes reference each other and see how I can use it to arrange the info the way I want.

yes... and nodereferrer is a

WorldFallz - August 28, 2008 - 18:31

yes... and nodereferrer is a separate module. I use this with images and galleries... if you have more questions post back.

===
"Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime."
-- Lao Tzu
"God helps those who help themselves." -- Benjamin Franklin
"Search is your best friend." -- Worldfallz

Thanks again! I'm on the

saltcod - August 28, 2008 - 19:00

Thanks again! I'm on the path, but the road is long.

I have a quick question if you've got a moment:

I've managed to connect the infection and the medication, as you recommended via nodereference, and now i can get the medication to show up on the infection page.

I'm wondering now, should I create a content type for DOSE, and another content type for DURATION?

For example:

If an adult has chicken pox they might need 200mg of Gentamicin for 10 days. However, if a child gets chickenpox, they might only need 200mg of Penicillin for 7 days.

To further the point, if someone has a skin infection, they might need 400mg Penicillin for 7 days, or 200mg of Penicillin for 21 days......etc........

Would creating two more content types (dose and duration) do the trick?

Thoughts very welcome!

hmmm... this is a bit of a

WorldFallz - August 28, 2008 - 19:50

hmmm... this is a bit of a horse of a different color. It would work, but seems hacky-- i don't think dose & duration are properly nodes, but i'm not really sure what the right data model is.

In this use case, ideally what you'd want is a grouped multi-value select list that included medication, dosage, & duration as individual input areas of one grouped field. Exactly like the way the http://drupal.org/project/cck_address field works-- separate items for street, city, state, zip, etc but they function as one field so when you add one "address" you get all the subfields also. Problem is, I have no idea how to go about that. You might be able to mimic that with 3 separate fields using the http://drupal.org/project/hierarchical_select module but I'm not sure. Another option might be the http://drupal.org/project/multireference module since it allows 2 texts fields to be associated with a nodereference (you could use one for dosage and the other for duration).

I also saw another promising module but it's in active developement: http://drupal.org/project/flexifield

If I think of anything else I'll post back....

===
"Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime."
-- Lao Tzu
"God helps those who help themselves." -- Benjamin Franklin
"Search is your best friend." -- Worldfallz

my curiosity got the better

WorldFallz - August 28, 2008 - 22:42

my curiosity got the better of me-- i tried out the multi-reference field and it will do exactly what you need. you may want to theme it though, very cool module.

===
"Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime."
-- Lao Tzu
"God helps those who help themselves." -- Benjamin Franklin
"Search is your best friend." -- Worldfallz

Thank you SO much for

saltcod - August 29, 2008 - 11:21

Thank you SO much for this.

It always amazes me when someone is so willing to give of their time. It also makes me want to spread some of my own knowledge around! I'm going to buy you a virtual coffee when I finally get this crazy system setup!

I've looked at all of the modules you recommended and some look quite good. Hierarchical select looks amazing.

I'm going to play with these today and see what I come up with. I'll post back with results!

thanks again very much. And stay tuned for updates!

i do most of my learning by

WorldFallz - August 29, 2008 - 13:15

i do most of my learning by responding to posts where I don't have an immediate answer-- so it benefits both of us. And if it encourages you to do likewise as you develop knowledge that's even better!

And definitely post back your results-- it will help the next person that finds this thread.

===
"Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime."
-- Lao Tzu
"God helps those who help themselves." -- Benjamin Franklin
"Search is your best friend." -- Worldfallz

 
 

Drupal is a registered trademark of Dries Buytaert.