Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Fix for Growth Chart not displaying Bone Age in the Table view issue. #16

Conversation

shriniketsarkar-zz
Copy link

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

@@ -336,6 +336,9 @@ window.GC = window.GC || {};

if (boneAgeList && boneAgeList.length) {
$.each(boneAgeList, function(i, o) {
if (o.hasOwnProperty("boneAgeMos") && o.hasOwnProperty("date")) {
Copy link
Member

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...

Copy link
Author

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 {
Copy link
Member

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?

Copy link
Author

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.

@shriniketsarkar-zz shriniketsarkar-zz merged commit 437ce11 into cerner/dstu2 Nov 28, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants