Greetings

I'm trying to assemble a very simple drupal site (5.1 with CCK) to train volunteer first aid workers. The idea is that they would look for a condition, for example, "Backache". They would then be presented with a table with three columns headed "Symptoms", "Possible cause", and "What can you do?" So my node needs to look like this:

BACKACHE
Symptoms__________Possible Cause__________What can you do?
Worsens with__________Fallen uterus___________See "Uterine Prolapse"
Lifting
Visible curving_________Curvature of spine________See "Scoliosis"
of upper body

So I've created a node type called "Diagnosis" and added three fields to it called "Symptoms", "Possible cause", and "What can you do?" and have added data to those fields. How do I now reference those fields from within my template (node-diagnosis.tpl.php) ? And can I get those fields to automagically display as a table?

Any help will be much appreciated.

Comments

drupalnesia’s picture

Ok. What do you do is almost right:

  1. Create a Diagnosis table. Delete your previous fields ("Symptoms", "Possible cause", and "What can you do?" ) IF the type is not NODE REFERENCE only!
  2. You must create again 3 new node types: node_symptoms, node_possible_cause and node_what_can_you_do
  3. IMPORTANT! The TITLE of each new nodes must used to fill the keys, i.e: for node_symtoms you must enter any available symtoms to the header, not to Body-field or any addiitional fields! (because current version of CCK using Title-field as the Key)
  4. Now, fill the new 3 nodes with data.
  5. Edit again your Diagnosis node. Add field called "Symptoms" and the type must NODE REFERENCE. Then reference Symtoms field to node_symtoms. Repeat this step for "Possible cause", and "What can you do?" fields.
kanthan’s picture

I've done these steps. What a great concept! Thanks! I'm going to stash this for future reference.

But it doesn't quite help me in this instance. What I want to be able to do is to have the users update this on the fly. For example, if someone comes in with a backache symptom that is not recorded (eg. patient has a knife stuck between ribs), the user will call a volunteer doctor who will tell him/her what to do. S/he will then create a new entry under "Backache" and create a new entry under each column as follows

Symptom Possible Cause What can you do
Sharp pain Knife in back Remove knife

When the next person looks at the listing under Backache, s/he will now see the additional symptom on the list.

(I hope this is making sense!)

Regards.
-K.

drupalnesia’s picture

Even this is very common feature in DB App like VB and C# (called as Editlist properties in DB Lookup Combo Box control), but I never know if this feature available on Drupal. I see this kind of feature available in Prado Framework. And, from Prado forum I see that someone already starting including Prado in Drupal. Sorry... can not help better.

drupalnesia’s picture

I think you can provide 2 boxes like this:
Symptoms: select list. Another Symtoms: textbox.

1. when the Symtoms not available on the select list, then user entry the Symtoms on the textbox
2. a trigger (you need mysql 5.x) will find any new Symtoms then insert into node_symtoms table
3. next user will see the new Symtoms in the select list.

Note: you can also avoid trigger by using a simple script "insert ignore into node_symtoms ... " when user display the page (after submit), and if you would like to avoid to create your own module then you can use contemplates.module and alter the body page with the "insert ignore " script.

These 3 modules (cck, views and contemplates) will be powerfull if you use them together. Good luck!

Rosamunda’s picture

suscribing