-
Notifications
You must be signed in to change notification settings - Fork 6
Fix dates mismatch issue where dates for observation’s displayed in the Graph and Table view’s don’t match the observation’s effectiveDateTime as received by the app from service. #17
Fix dates mismatch issue where dates for observation’s displayed in the Graph and Table view’s don’t match the observation’s effectiveDateTime as received by the app from service. #17
Conversation
… the Graph and Table view’s don’t match the observation’s effectiveDateTime as received by the app from the service.
@@ -1398,15 +1398,15 @@ ChartPane.prototype = { | |||
html = []; | |||
this.forEachColumn(function( col, colIndex/*, colsLen*/ ) { | |||
$.each(annotated, function(i, entry) { | |||
var dateString = entry.hasOwnProperty('dateString') ? entry.dateString : ''; |
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.
Do you need to check entry
object?
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.
We wouldnt need to check entry
since its an object in the array and we are doing a $.each on the array.
@@ -253,8 +253,9 @@ | |||
|
|||
$.each(model, function( index, data ) { | |||
//debugger; | |||
var dateString = data.hasOwnProperty('dateString') ? data.dateString : ''; |
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.
check data
?
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.
We wouldnt need to check data
since its an object in the array and we are doing a $.each on the array.
@@ -478,8 +479,8 @@ | |||
{ | |||
label : "Date", | |||
get : function( entry/*, model*/ ) { | |||
return new XDate(patient.DOB.getTime()) | |||
.addMonths(entry.agemos) | |||
var dateString = entry.hasOwnProperty('dateString') ? entry.dateString : ''; |
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.
check entry?
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.
The entry
here represents the model which is pulled from an array of models.
E.g : var entry = model[colIndex], v, x//,
So it should always be available.
js/gc-smart-data.js
Outdated
@@ -336,6 +344,9 @@ window.GC = window.GC || {}; | |||
|
|||
if (boneAgeList && boneAgeList.length) { | |||
$.each(boneAgeList, function(i, o) { | |||
if (o.hasOwnProperty("boneAgeMos") && o.hasOwnProperty("date") && o.hasOwnProperty("dateString")) { |
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.
check o?
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.
$.each will guarantee that o
always has a value .
js/gc-smart-data.js
Outdated
@@ -475,6 +486,9 @@ window.GC = window.GC || {}; | |||
model[ o.agemos ].lengthAndStature = o.value; | |||
} else { | |||
model[ o.agemos ] = { "lengthAndStature" : o.value }; | |||
if (o.hasOwnProperty('dateString')) { | |||
model[ o.agemos ]['dateString'] = o.dateString; |
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.
fix the spaces
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.
Fixed.
js/gc-smart-data.js
Outdated
@@ -484,6 +498,9 @@ window.GC = window.GC || {}; | |||
model[ o.agemos ].weight = o.value; | |||
} else { | |||
model[ o.agemos ] = { "weight" : o.value }; |
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.
remove spaces in []
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.
Fixed in the entire file.
…eView_Fix_Issue_35 # Conflicts: # js/gc-smart-data.js # load-fhir-data.js
…eView_Fix_Issue_35 # Conflicts: # js/gc-smart-data.js
Issue : The open source version of growth chart has a mismatch in the observations (i.e height, weight etc) being displayed on the Graph and Table Views. After some investigation, the issue seems to be with the way the app processes date for an observation. The app converts the dateString received from the resource call into
Age in Months
using the XDate library. Then the app converts theAge in Months
back to a Date String for displaying it on the Graph and Table View for that observation. The XDate library computes this Date String incorrectly thus resulting in a date which could be off by a few days from the actual date of the observation.More Info on this Issue : smart-on-fhir#35
Fix : This PR fixes the display to consume the effectiveDateTime received with the observation as a string. We pass down a separate key
dateString
with the apps object for observations and use it later on to display the string directly thus avoiding any conversions using the XDate library.Consideration: This fix adds a new variable
dateString
and does not alter any of the apps existing logic to handle a date object for an observation.@kpshek
@zplata
@mjhenkes
@kolkheang