I am designing a database for patient vital signs (height, weight, BP, etc). The closer I come to finishing, the more complicated the project gets. Makes me think I'm doing something wrong design-wise.
DATABASE GOALS
1. Store patient identifying data (name, med record, date of birth, etc.)
2. Store multiple sets of vital signs for each patient
3. Show a patient record with:
- patient ID data
- All his/her vital signs data
DESIGN
1. Table: "tbl_patientData"
2. Table: "tbl_vitalsData" (linked to "tbl_patientData" by [medRec] field)
3. Form: frm_patientRecord with
a. Fields from "tbl_patientData"
b. Subform "frm_vitalsData subform" (linked to main form by [medRec])
The above works fine, my question is what is the best way to do the analysis/calculations based on the above data?
ANALYSIS GOALS
1. Show patient's most recent (i.e. newest) height, weight, BP, etc
2. Calculate Body-Mass-Index (BMI) based on Height and Weight
2. Calculate BMI percentile based on BMI, age, gender, and norms table
3. Calculate BP percentile based on age, gender, and norms table
Problem #1: "tbl_vitalsData" has many empty fields because, for a vitals-entry-date, the record may only include certain values (e.g. BP but not Ht, Wt or Wt but no Ht). Having this table full of holes makes it hard to calculate the above values because I have to decide
a) which value(s) to use
b) which date to base calculation of age on.
Problem #2: Because there are so many calculations, the database becomes slowed down.
QUESTIONS
1. What is the best way to get the most recent value from each column of a table?
2. Where is the best place to do calculations on field data? In a query, on a form? Some other place?
3. How can I save these calculations so that they only get re-calculated if the field data changes?