Inferring graph ranges for clinical data

I saw this question in Slack on Micro Frontend design and wanted to share my experience on choosing graph ranges for clinical data, but couldn’t bear to throw it into the oblivion of a Slack thread:

From my experience, showing clinical data in a dynamic range can be helpful, but it helps to avoid zooming in too far (beyond the normal range). Using vertical padding (e.g., 10%) above & below normal range and expanding that as needed to allow 10% above/below the highest/lowest values in the data while staying within absolute values.

padding = 0.10; // 10% vertical padding
graphMin = min(
  max(highest value in data, high normal) * (1 + padding),
  absolute low
);
graphMax = max( 
  min(lowest value in data, low normal) * (1 - padding), 
  absolute high
);

When ranges (normals or absolute) are missing, then the data values alone are used.

1 Like

Thanks for spelling this out Burke. This was very useful when capturing the requirements for the Lab Test Trendline here: https://issues.openmrs.org/browse/MF-478