-
Notifications
You must be signed in to change notification settings - Fork 6
Fix for Growth Chart not displaying Bone Age in the Table view issue. #16
Fix for Growth Chart not displaying Bone Age in the Table view issue. #16
Conversation
@@ -336,6 +336,9 @@ window.GC = window.GC || {}; | |||
|
|||
if (boneAgeList && boneAgeList.length) { | |||
$.each(boneAgeList, function(i, o) { | |||
if (o.hasOwnProperty("boneAgeMos") && o.hasOwnProperty("date")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd check if the o
object is valid first.
if (o && o.hasOwnProperty...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
o
is object in an array and since we are doing $.each we should always have o
.
@@ -336,6 +336,9 @@ window.GC = window.GC || {}; | |||
|
|||
if (boneAgeList && boneAgeList.length) { | |||
$.each(boneAgeList, function(i, o) { | |||
if (o.hasOwnProperty("boneAgeMos") && o.hasOwnProperty("date")) { | |||
o = new SmartBoneage(o.date, o.boneAgeMos); | |||
} | |||
if (o instanceof SmartBoneage) { | |||
patient.boneAge.push(o.toGCBoneage(patient)); | |||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In what scenario is the value in patient.boneAge
in the else condition used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If its a valid Bone Age observation we should always have boneAgeMos
and date
available but incase if any of these are not available it should hit the else
route.
From my investigation for this issue, the app is currently looking for the SmartBoneage
object but it didnt get it as the app was not creating it anywhere (hence this PR).
We might be able to remove the else
case here (since with this PR we expect SmartBoneage object to be created) but I haven't investigated where bone age is used in the calculations. Hence decided to retain the logic so that I dont break any calculations down the line accidentally.
Issue : The open source version of growth chart does not display the Bone Age received in the observations on the Table View of the app.
More Info on this Issue : smart-on-fhir#27
Fix : This PR fixes the display to consume the observation received. The issue was because the observation was never used while building the SmartBoneage object in the gc-smart-data.js
Changes :
The fix now checks if the observation has the properties "boneAgeMos" and "date" and creates a SmartBoneage object to be used later in the app. This fixed the display in the Table View.
@kpshek
@zplata
@mjhenkes
@kolkheang