Having age and gender specific ranges in OpenMRS

We would be very interested in this too for Lab Order Fulfillment Forms, I like @jteich suggestion of modifying range instructions, maybe we can also define the age ranges in the reporting_age_group table.

UREA [Normal low, Normal high]

<15days  [1.1 - 4.3]
15d<1y  [1.5 - 6.1]
>=1y  [2.5 - 6.4]

reporting_age_group table:

| id | name | report_group_name | min_years | min_days | max_years | max_days | sort_order |
+----+------+-------------------+-----------+----------+-----------+----------+------------+
|  1 | ChemLabR1  | Chemistry Lab |       0 |        0 |       0 |        14 |          0 |
+----+------+-------------------+-----------+----------+-----------+----------+------------+
|  1 | ChemLabR2  | Chemistry Lab |      0 |        15 |       1 |        -1 |          0 |
+----+------+-------------------+-----------+----------+-----------+----------+------------+
|  1 | ChemLabR3  | Chemistry Lab |       1 |        0 |       200 |        0 |          0 |
+----+------+-------------------+-----------+----------+-----------+----------+------------+

Example of a possible range instruction format for the above UREA example using variable length arrays of format TYPE [ label1, value1, label2, value2, …]:

"Normal low" =  AgeRange ["ChemLabR1",1.1,"ChemLabR2",1.5, "ChemLabR2",2.5] 

or

"Normal low" = Gender [ "M", 1.1, "F", 1.0]

and some recursive parsing to deal with combined case:

 "Normal low" =  AgeRange ["ChemLabR1", Gender [ "M", 1.1, "F", 1.0], "ChemLabR2", Gender [ "M", 1.5, "F", 1.4]......] 

while maintaing backward compatibility for simple ranges of course. I’m guessing just the age ranges and gender will cover most use cases?

If that’s the case, we could also just have 2 values for each label, one for Female and one for Male, to simplify things

     "Normal low" =  AgeRange ["ChemLabR1", 1.0, 1.1, "ChemLabR2", 1.4, 1.5......]