0

I'm trying to come up with a clean database design for a new project I'm working on. One of the data items I need to store in the database will come from an HTML form:

Q1: "Anticoagulated patient?" [YES, NO]

JavaScript;
(If yes is selected, an additional question is displayed):

Q2: "Type of Anticoagulant" [Warfari, Coumarin, Clopidogrel]

My question is, is it necessary to store the first question's response in the database? To me the data seems redundant. If the type is specified, then it can be assumed that the patient is "anticoagulated".

Once the form is submitted, the form will be accessed at a later point so the data can be ammended and the interface will need to reflect the state of the database. I should still be able to do this without needing to record the first question:

JavaScript;(If Q2 has a value, then the default option should be set to Yes 
otherwise it should be set to No)

Q1: "Anticoagulated patient?" [Yes, No]

JavaScript;(Only display if Q1 is set to Yes):

Q2: "Type of Anticoagulant" [Warfari, Coumarin, Clopidogrel] 

What are your thoughts on this?

4

3 に答える 3

1

I think the two questions should indeed be handled on the client-side, as you suggested. This will provide a better user experience.

As for the database, don't use two fields, one is more than enough. Note that even if you don't show the second question dynamically, you can still store the answer somewhere else (such as the web server session) and not the back-end database.

于 2012-09-08T19:15:33.343 に答える
1

I would say the extra space required to store the response to question 1 will be far outweighed by the amount of extra logic involved in marking Q2 as implying Q1. Keep it simple!

于 2012-09-08T19:16:00.957 に答える
1

I think , you have make right decision on this, but just think about the future and extending the application logic , maybe you need to add another question later then you will have to store the question in db, Briefly for current situation it is adequate to store the answer.

于 2012-09-08T19:18:55.877 に答える