Introduction
This is a technical documentation for “factor-based” concept ranges. For the background of these ranges, refer to the main documentation.
The criteria
field in the concept_reference_range
table allows for the dynamic and flexible validation of observations based on various patient attributes.
Architecture
The key challenge in implementing this feature was to design a system that does not require extensive changes to the existing database structure while still being robust and flexible enough to handle a variety of criteria based on different patient factors.
The solution involves introducing two new tables:
concept_reference_range
: This table holds the absolute, critical, and normal ranges along with acriteria
column. Thecriteria
column contains velocity text expressions that evaluate to true or false.obs_reference_range
: This table stores reference ranges that have been used in validation after the criteria have been applied.
These tables allow for storage of different ranges. However, concept_reference_range
includes criteria expressions for factors - which can be combinations for different factors like age and gender. For example:
concept_numeric
able:concept_id: 1
, name: “Systolic blood pressure”,hi_critical: 130.0
,hi_normal: 120.0
,hi_absolute: 120.0
,low_critical: 100.0
,low_normal: 150.0
,low_absolute: 120.0
concept_id: 2
, name: “Temperature”,hi_critical: 40.0
,hi_normal: 37.0
,hi_absolute: 37.0
,low_critical: 35.0
,low_normal: 36.5
,low_absolute: 36.8
concept_reference_range
Table:concept_reference_range_id: 1
,concept_id: 1
,criteria: ”$patient.getAgeInMonths() > 1 && $patient.getAgeInMonths() < 3”
,hi_critical: 100.0
,hi_normal: 80.0
,hi_absolute: 80.0
,low_critical: 50.0
,low_normal: 64.0
,low_absolute: 60.0
concept_reference_range_id: 2
,concept_id: 1
,criteria: ”$patient.getAge() > 18 && $patient.getAge() < 70”
,hi_critical: 130.0
,hi_normal: 120.0
,hi_absolute: 120.0
,low_critical: 60.0
,low_normal: 80.0
,low_absolute: 90.0
This design allows for easy updates and expansions of criteria without requiring changes to the underlying database schema.
Business Logic Flow
Schema changes
This section details the new tables and relationships added to the OpenMRS data model to support factor-based concept ranges.
Note: The complete data model is documented here. This document only highlights the new schema additions relevant to factor-based concept ranges.
1. concept_reference_range
Table
The concept_reference_range
table is designed to store detailed reference ranges for concepts, along with criteria that determine when these ranges apply.
Table Structure:
Column Name | Data Type | Description |
---|---|---|
|
| Primary key. Unique identifier for each concept reference range. |
|
| Foreign key linking to |
|
| An expression that specifies conditions for when the reference range is applicable. |
|
| The high critical for the concept. |
|
| The high normal for the concept. |
|
| The high absolute for the concept. |
|
| The low critical for the concept. |
|
| The low normal for the concept. |
|
| The low absolute for the concept. |
Relationship:
1:N relationship with concept_numeric
: A single concept can have multiple reference ranges based on different criteria.
2. obs_reference_range
Table
The obs_reference_range
table records the validated reference range for a specific observation (Obs
).
Table Structure:
Column Name | Data Type | Description |
---|---|---|
|
| Primary key. Unique identifier for each observation reference range. |
|
| Foreign key linking to the |
|
| The high critical limit for the observation. |
|
| The high normal limit for the observation. |
|
| The high absolute limit for the observation. |
|
| The low critical limit for the observation. |
|
| The low normal limit for the observation. |
|
| The low absolute limit for the observation. |
Relationship:
Has 1:1 relationship with obs
: Each observation has one associated reference range.