Concept set versus concept set derived
What's the difference between concept_set code> and concept_set_derived code> tables?
concept_set_derived code> tables? Humans (you and me) should only edit set relationships in the concept_set code> table. These relationships are then programmatically burst into the concept_set_derived code> table for "real world" use.
- Humans use
concept_set code> - Computers use
concept_set_derived code>
Understanding by example
Here's an example (using made-up concepts). Suppose we want to relate the following three concepts using concept sets:
- metoprolol
- Beta Blockers
- Anti-Hypertensive Medications
We (humans) use the dictionary editing tools to define two relationships:
| concept | set |
| metoprolol | Beta Blockers |
| Beta Blockers | Anti-Hypertensive Medications |
The above relationships, state that metoprolol is a Beta-Blocker and that all Beta-Blockers are Anti-Hypertensive Medications. The idea that metoprolol is an Anti-Hypertensive Medication is implied.
We then run a script (e.g., AdministratorService.updateConceptSetDerived(Concept concept)) to programmatically burst all of the implicit relationships and put these into the concept_set_derived code> table. Each time the script is run, the concept_set_derived code> table is cleared, and all entries in the concept_set code> table are copied into concept_set_derived code>, along with any implied relationships.
| concept | set |
| metoprolol | Beta Blockers |
| Beta Blockers | Anti-Hypertensive Medications |
| metoprolol | Anti-Hypertensive Medications |
The third item in the list above is derived from the manually defined relationships.
Why all this monkey business with concept_set_derived code>?
The concept_set code> table is displayed in the Data Model. The concept_set_derived code> is considered part of the business stuff that's needed to make OpenMRS work. The bottom line is that bursting out implicit relationships into a concept_set_derived code> table prevents the application from having to calculate all of the implicit relationships in real time. Likewise, we don't want to burden humans with having to explicitly define all of these implicit relationships (why create three relationships when two says it all — in the example above).
