On Sun, 3 Jun 2012 10:55:22 -0700 (PDT), Python_Junkie
<software.buy.design@gmail.com> declaimed the following in
gmane.comp.python.django.user:
> I hope my answer points you in the right direction.
>
> I would create 2 (generic) tables one that is called something like
<snip>
> The test_results table would be appear to be genric, ie column_A, Column_B.
> but pull the required metadata from the test_definition field.
>
> Hence you would only need 2 models
>
I'd suggest four -- at least, at the raw table level:
TestChoice (use to populate list-box)
ID
Name
Description
other data used to just identify/describe A test
TestContents (use to populate result form)
ID
TestChoiceID (foreign key)
ItemName
ItemType (Identify result type: integer, float, string)
LowerLimit null (useful if some tests have valid limits)
UpperLimit null (but may need int, float, string options)
PatientTest
ID
PatientID (identifies the patient)
TestChoiceID (identifies which test)
TestDate
other specifics to a test overall (lab tech, nurse, etc.)
TestResults
ID
PatientTestID (which test for this patient)
TestContentsID (identifies field)
ResultData (may need one for integer, float, string)
TestChoice and TestContents are mainly read-only (that is -- admin
interface is probably all that is needed to manage them).
PatientTest and TestResults would be the user application. Selection
from TestChoice (as part of the PatientTest form) would trigger the
retrieval of the TestContents of that choice, and population of the
results form.
Note that the results are not a single model instance, but a list of
records (a "formset" I believe), in which you predefine the
PatientTestID (hidden) and TestContentsID (hidden) on each entry; you
use the TestContents.Name (and maybe other data) to populate the form
text/widget names; and retrieve the results (which are the only user
entry fields).
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment