Support for Structured Numerics
Background
A lot of discussion and work has gone into considering how structured numerics could be supported within OpenMRS. Structured numerics come from the HL7 notion of structure numeric data type: ranges, boundaries (like < 50), titers, etc. There is a ticket (TRUNK-413) for work that has already been done.
Design Ideas
New datatype: UNBOUNDED NUMERIC
value_modifier can be <, ?, >, ?, or null (for =)
ConceptDatatype.isNumeric() returns false
ConceptDatatype.isUnboundedNumeric() returns true
Obs.getVAlueUnboundedNumeric() returns an UnboundedNumber
class UnboundedNumber extends NumericInterval {
public String getModifier();
public Double getValue();
}
class NumericInterval {
double getUpperBound();
double getLowerBound();
boolean isIncludesUpperBound();
boolean isIncludesLowerBound();
String toString();
}
API Changes
+ Obs.getValueUnboundedNumeric();
* Obs.getValueAsString()
needs to handle this (duh)+ ConceptDatatype
of unbounded numericput this in the core liquibase dataset and put the uuid value in the Conceptatatype class
Cohort Builder needs to handle queries for these
Add tool to upgrade an existing numeric obs that may have proxy value(s) (e.g., 0, 39, and 39.9 all mean < 40) to an undounded numeric
Make HL7 hander(s) aware and able to accept SN OBXs (it would have to be backward-compatiable – ie.., accept a NM for an UnboundedNumberic concept)
Also
Propose a way for InfoPath form entry to handle these
Propose a way for HTML Form Entry to handle these
Need to research a better name then Unbounded Numeric