Skip to content

Commit

Permalink
dont calculate sum for string features
Browse files Browse the repository at this point in the history
  • Loading branch information
Jirayr-Solvee committed Feb 16, 2022
1 parent 6e904ab commit 3a279d4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 23 deletions.
43 changes: 21 additions & 22 deletions src/whylogs/viewer/index-hbs-cdn-all-in.html
Original file line number Diff line number Diff line change
Expand Up @@ -1121,13 +1121,13 @@
background: #FFF;
border-radius: 4px;
}

.frequent-item-box-wrap {
width: 100%;
display: flex;
justify-content: center;
}

.frequent-item-box-to-title {
margin-left: 30px;
margin-bottom: 20px;
Expand All @@ -1137,16 +1137,16 @@
line-height: 16px;
color: #4F595B;
}

.frequent-items-body {
display: flex;
flex-direction: column;
}

.text-align-center {
text-align: center;
}

.fequent-items-wrap {
width: 100%;
}
Expand All @@ -1163,7 +1163,7 @@
.graph-svg-container {
padding-bottom: 13%;
}

.svg-content-responsive {
display: inline-block;
position: absolute;
Expand Down Expand Up @@ -1694,11 +1694,11 @@ <h1 class="no-responsive__title">Hold on! :)</h1>
histogramData = chartData(data)
overlappedHistogramData = chartData(referenceData.columns[key.data.key])
}
let yFormat,

let yFormat,
xFormat,
sizes;

sizes = new GenerateChartParams(230, currentWidth, histogramData)

const {
Expand All @@ -1716,7 +1716,7 @@ <h1 class="no-responsive__title">Hold on! :)</h1>
.attr("preserveAspectRatio", "xMinYMin meet")
.attr("viewBox", "0 0 600 400")
.classed("svg-content-responsive", true)

const xAxis = d3.axisBottom(xScale).ticks(SVG_WIDTH / 80, xFormat).tickSizeOuter(0);
const yAxis = d3.axisLeft(yScale).ticks(SVG_HEIGHT / 40, yFormat);
yFormat = yScale.tickFormat(100, yFormat);
Expand Down Expand Up @@ -2050,10 +2050,9 @@ <h1 class="no-responsive__title">Hold on! :)</h1>
});

Handlebars.registerHelper("totalCount", function (column) {
if (column.numberSummary) {
return column.numberSummary.count.toString();
if (column.numberSummary || column.stringSummary) {
return column.counters.count.toString();
}

return "-";
});

Expand Down Expand Up @@ -2246,7 +2245,7 @@ <h1 class="no-responsive__title">Hold on! :)</h1>
}
if (profileFromCSVfile && Object.values(profileFromCSVfile)) {
chartString = '';
let propertyPanelGraph = true;
let propertyPanelGraph = true;
chartString += generateChart(data, 50, 280, 0, true, propertyPanelGraph);
}
}
Expand Down Expand Up @@ -2675,9 +2674,9 @@ <h1 class="no-responsive__title">Hold on! :)</h1>
$("#page-button").on("click", function () {
getProfileCharts(
feature,
feature[0],
getDoubleHistogramChart,
getBarChart,
feature[0],
getDoubleHistogramChart,
getBarChart,
getPositiveNegativeChart
)

Expand All @@ -2687,9 +2686,9 @@ <h1 class="no-responsive__title">Hold on! :)</h1>

getProfileCharts(
feature,
feature[0],
getDoubleHistogramChart,
getBarChart,
feature[0],
getDoubleHistogramChart,
getBarChart,
getPositiveNegativeChart
)
$(".frequent-items-body").html(``);
Expand All @@ -2711,7 +2710,7 @@ <h1 class="no-responsive__title">Hold on! :)</h1>
</div>
</div>
`);

$(".clickable-test-feature-body").html(``);
referenceProfilePanelHeight()
})
Expand Down Expand Up @@ -2794,7 +2793,7 @@ <h1 class="no-responsive__title">Hold on! :)</h1>
function closeFeatureHeading() {
const $tableContent = $("#table-content")
const $clickableTestFeatureWrap = $(".clickable-test-feature-wrap")

$("#compare-profile").remove("d-none")
$tableContent.removeClass("d-none")
$clickableTestFeatureWrap.addClass("d-none")
Expand Down
6 changes: 5 additions & 1 deletion src/whylogs/viz/utils/profile_viz_calculations.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,11 @@ def calculate_coefficient_of_variation(profile_jsons, feature_name):

def calculate_sum(profile_jsons, feature_name):
feature = profile_jsons.get("columns").get(feature_name)
sum = feature.get("numberSummary").get("mean") * int(feature.get("counters").get("count"))
feature_number_summary = feature.get("numberSummary")
if feature_number_summary:
sum = feature_number_summary.get("mean") * int(feature.get("counters").get("count"))
else:
sum = 0
return sum


Expand Down

0 comments on commit 3a279d4

Please sign in to comment.