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

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

shriniketsarkar-zz
Copy link

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 the Age 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

… 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 : '';
Copy link
Member

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?

Copy link
Author

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 : '';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check data?

Copy link
Author

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 : '';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check entry?

Copy link
Author

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.

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check o?

Copy link
Author

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 .

@@ -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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix the spaces

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@@ -484,6 +498,9 @@ window.GC = window.GC || {};
model[ o.agemos ].weight = o.value;
} else {
model[ o.agemos ] = { "weight" : o.value };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove spaces in []

Copy link
Author

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
@shriniketsarkar-zz shriniketsarkar-zz merged commit c5cdad8 into cerner/dstu2 Dec 1, 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.

5 participants