The Wikipedia page on data integrity lists 4 types of integrity constraints: entity integrity, referential integrity, domain integrity, and user-defined integrity.
Is there a name for integrity constraints that stem from common sense / knowledge?
Example :
I have one table with 6 columns containing some data about hospital admissions:
hospital_admission_id
(integer field)patient_id
(integer field)patient_date_of_birth
(date field -> I am aware that it should be in some patient table but ignore this in this example)date_of_hospital_admission
(date field)date_of_hospital_discharge
(date field)hospital_admission_note
(text field: a relatively long text by the medical staff summarizing some data about the patient when he was admitted at the hospital)
One integrity constraint stemming from common sense / knowledge is that the patient more than one year old at the time of hospital admission (i.e. date_of_hospital_admission - patient_date_of_birth > 1 year
), hospital_admission_note
shouldn't say that the patient is a neonate.
Another integrity constraint from common sense / knowledge is that a patient cannot be admitted in the hospital if he already is in the hospital (i.e. some checks would have to be done around date_of_hospital_admission
and date_of_hospital_discharge
).
I feel that:
- It's not an entity integrity constraint since it's not an issue around primary keys.
- It's not a referential integrity constraint since it's not an issue around foreign keys.
- It's not a domain integrity constraint since it's not about checking whether values are in some list.
- I guess it could be qualified as a user-defined integrity constraint but I thought they might be some more precise technology to specifically designate integrity constraints stemming from common sense / knowledge and not just a specific user's preferences.
Best Answer
You're going beyond the scope of referential constraints with this (good) question. What you are looking for is more to do with Ontologies and Archetypes than RDBMS constraints. You could also check out this page which is on "Intelligent Databases" and gives as an example, medical records.
Check out the OpenEHR (Open Electronic Health Record here) whereby the system goes beyond data storage (essentially AIUI, your question). It's a fascinating area, touching on machine learning and artifical intelligence. It is far from a trivial problem - and in particular with medical records with all sorts of different regulatory frameworks and privacy concerns. Doctors, surgeons, dentists and pharmacists have different "views" of a patient - how to tease all these out is a major issue in the field. It will come as no surprise that the OpenEHR system is one of many competing in this fascinating and challenging area.
From the OpenEHR (what is page)