Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Table view header generation issue #7

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion js/gc-chart-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ window.GC = window.GC || {};
weight : { std : 1, nicu : 3 },
headc : { std : 1, nicu : 1 },
bmi : { std : 1, nicu : 1 },
percentile : { std : 0, nicu : 0 },
percentile : { std : 0, nicu : 3 },
zscore : { std : 2, nicu : 2 },
velocity : { std : "year", nicu : "day" }
},
Expand Down
3 changes: 2 additions & 1 deletion js/gc-grid-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ XDate, setTimeout, getDataSet*/
if ( isNaN(pct) || !isFinite(pct) ) {
return EMPTY_MARK;
}
return GC.Util.roundToPrecision(pct * 100, 0);

return GC.Util.roundToPrecision(pct * 100, GC.chartSettings.roundPrecision.percentile[GC.chartSettings.nicu ? "nicu" : "std"]);
}
}
return EMPTY_MARK;
Expand Down
10 changes: 8 additions & 2 deletions js/gc-smart-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,10 @@ window.GC = window.GC || {};
if ( d.valid() ) {
this.DOB = d;
this.birthdate = d.toString();
this.gestationAge = this.weeker = Math.round(40 - this.DOB.diffWeeks(this.EDD));

if (this.gestationAge == null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you explain why do you want to keep the gestationAge/weeker if DOB or EDD is changed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cerner gives us the pre-calculated gest age in their fhir service response.
There is sometimes a discrepancy of 1 day when using the calculation, so this logic is guarding against changing the gest age, if we have already read and populated it elsewhere.
is the DOB or EDD likely to change? and if so, wont restarting the app simply realign all the values?

this.gestationAge = this.weeker = Math.round(40 - this.DOB.diffWeeks(this.EDD));
}

$("html")
.trigger("change:patient:DOB", this.DOB)
Expand All @@ -421,7 +424,10 @@ window.GC = window.GC || {};
d = new XDate( d );
if ( d.valid() ) {
this.EDD = d;
this.gestationAge = this.weeker = Math.round(40 - this.DOB.diffWeeks(d));

if (this.gestationAge == null) {
this.gestationAge = this.weeker = Math.round(40 - this.DOB.diffWeeks(d));
}

$("html")
.trigger("change:patient:EDD", this.EDD)
Expand Down
10 changes: 8 additions & 2 deletions load-fhir-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,14 @@ GC.get_data = function() {
};

function months(d){
return -1 * new XDate(d).diffMonths(new XDate(p.demographics.birthday));
}
var diffDays = -1 * new XDate(d).diffDays(new XDate(p.demographics.birthday));
if (diffDays < 0) {
return ((Math.ceil(diffDays))/7)/ 4.348214285714286;
}
else {
return ((Math.floor(diffDays))/7)/ 4.348214285714286;
}
}

$.each(familyHistories, function(index, fh){
if (fh.resourceType === "FamilyHistory") {
Expand Down