4

im given a hard copy of a form that is used by a hospital to gather information about its patients ! the form is divided into sections and each section has A LOT of YES/NO check boxes.

For example, one of the section is the History section that has more than 20 unrelated yes/no fields:

smoker ( yes or no)

diabetes (yes or no )

Chronic Lung (yes or no ) . . . . .

Another section is the "stress test data" section that has questions like the following:

Standard test (yes/no) , if yes , what are the results ( negative or positive), if positive ( what is the extent (low or high, or intermediate )

...

i am asked to design a database, show the relation tables and the relation between them ! :S:S this is looks NOTHING like the "student-class database" or the "CD company database" i came across ! this is just..i dont know..DYNAMIC :s:s

i have NO IDEA how to even START designing this database or what are the things that i should read or look into or practice in order to design a database for such a data!

PLEASE HELP !!

3
  • @Paul: fair 'nuff, it's just one of those days.
    – Matt Ball
    Dec 7, 2010 at 19:29
  • @Matt: I know. I've had those days myself.
    – Paul Sasik
    Dec 7, 2010 at 20:01
  • I seems this is a big project for which you have no experience. I suggest you go to your boss and tell him you have never done this kind of work. I think it is better to be candid in the beginning than to present a design that will not work. You have been candid here that you have "NO IDEA" so be candid where you work.
    – RC_Cleland
    Dec 7, 2010 at 23:23

6 Answers 6

4

Take a look at these two SO examples:

4

Take a look at the EAV (Entity Attribute Value) Database Design scheme.

You don't have to use it exclusively, just for your dynamic data. Will it make that part of your queries interesting? Yes. But buys an incredible amount of flexibility. Btw, i've used the EAV scheme for several EHR/EMR projects succesfully.

1
  • +1: I've used this approach in the past and it really does work for ridiculously dynamic data :)
    – Juliet
    Dec 7, 2010 at 18:58
1

Well there are two basic ways you can do this. You'll have a patients table in either case with the patient's id number, name, and maybe contact information.

Then, you can either add columns to this table (i.e. smoker column which would either be 1 for yes or 0 for no), and you could add a whole bunch of columns corresponding to each of the attributes of the patients.

The other (and better, IMHO) would be to leave the patients table alone, and then add an attributes table. The attributes table would have columns of patientID, attributeName, and attributeValue. So for a smoker, you would take the patient ID and add a row in the attributes table of (id, "smoker", 1) and continue adding like that. Then you have to write queries to get all the information about a given patient from the attributes table, but that's another challenge...

1
  • In general, if the data does not change a lot, the dynamic approach is horrible to query. It is easy to display on the client side, but horrible to make a good query against this approach. Lost of LEFT JOINS Dec 7, 2010 at 18:46
1

Have a look at Martin Fowler's "Analysis Patterns". He does a nice job of explaining some nice object models for health care systems. I think it might give you some good ideas on the data model as well.

Start with the objects, and the rest will follow.

0

Before you proceed with your design in a relational database, try to imagine whether it's going to be easy to maintain. In practice, many of these kinds of systems attempt to break the relational model -- this is pretty classic case where you have forms, each form has fields, none of the fields are related to each other, each patient has copies of forms and fields, and so on.

I would strongly prefer this over a relational model. Look into projects such as Couch DB, which are document-centric databases instead of the mode you're used to seeing with tables and schemas and such.

Poke around CouchDB, Mnesia, or other non-relational database. Get a book on the subject and found out the best way to design these sorts of systems in an idiomatic manner.

In practice, these sorts of systems are like entity-attribute-value databases, except they can be nicely searched an indexed.

0

What do you mean by "dynamic"? Seems like you have a fairly standard set of data about patients to be stored. My advice to you would be to model that data: patients and their attributes. Do not attempt to model a questionnaire. The means used to gather that data is irrelevant and the form design has nothing much to do with database design.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.