diff --git a/tool/src/test/resources/org/datacommons/tool/genmcf/localidresolution/output/report.json b/tool/src/test/resources/org/datacommons/tool/genmcf/localidresolution/output/report.json
index 73dccaa0..c01e4cbe 100644
--- a/tool/src/test/resources/org/datacommons/tool/genmcf/localidresolution/output/report.json
+++ b/tool/src/test/resources/org/datacommons/tool/genmcf/localidresolution/output/report.json
@@ -59,4 +59,4 @@
"observationAbout": false,
"allowNanSvobs": false
}
-}
+}
\ No newline at end of file
diff --git a/tool/src/test/resources/org/datacommons/tool/genmcf/measurementresult/output/summary_report.html b/tool/src/test/resources/org/datacommons/tool/genmcf/measurementresult/output/summary_report.html
index 9838758b..4154bf02 100644
--- a/tool/src/test/resources/org/datacommons/tool/genmcf/measurementresult/output/summary_report.html
+++ b/tool/src/test/resources/org/datacommons/tool/genmcf/measurementresult/output/summary_report.html
@@ -435,7 +435,11 @@
|
- Charts for non-numeric types are not supported yet |
+ |
diff --git a/util/src/main/java/org/datacommons/util/PlaceSeriesSummary.java b/util/src/main/java/org/datacommons/util/PlaceSeriesSummary.java
index 4d83858f..2f7eb94a 100644
--- a/util/src/main/java/org/datacommons/util/PlaceSeriesSummary.java
+++ b/util/src/main/java/org/datacommons/util/PlaceSeriesSummary.java
@@ -69,11 +69,6 @@ public ValueType getValueType() {
}
public String getTimeSeriesSVGChart() {
-
- if (getValueType() != ValueType.NUMBER) {
- return "Charts for non-numeric types are not supported yet";
- }
-
TimeSeries timeSeries = new TimeSeries("ts");
// this.timeSeries is kept sorted with a TreeMap, so we simply add the
@@ -83,14 +78,21 @@ public String getTimeSeriesSVGChart() {
LocalDateTime localDateTime = StringUtil.getValidISO8601Date(timeSeriesDataPoint.getKey());
if (localDateTime == null) continue;
+
+ DataPoint dp = timeSeriesDataPoint.getValue();
+ if (SeriesSummary.getTypeOfDataPoint(dp) != ValueType.NUMBER) continue;
+
timeSeries.addOrUpdate(
new Day(
localDateTime.getDayOfMonth(),
localDateTime.getMonthValue(),
localDateTime.getYear()),
- getValueOfDataPointAsNumber(timeSeriesDataPoint.getValue()));
+ getValueOfDataPointAsNumber(dp));
}
+ if (timeSeries.getItemCount() == 0) {
+ return "Charts for non-numeric types are not supported yet";
+ }
return StatVarSummary.constructSVGChartFromTimeSeries(timeSeries);
}
diff --git a/util/src/main/java/org/datacommons/util/StatChecker.java b/util/src/main/java/org/datacommons/util/StatChecker.java
index efada284..469f54f1 100644
--- a/util/src/main/java/org/datacommons/util/StatChecker.java
+++ b/util/src/main/java/org/datacommons/util/StatChecker.java
@@ -423,6 +423,7 @@ protected static void checkSigmaDivergence(
// Only add data points to the counter of the greatest standard deviation that it belongs to.
// ie. if the data point is beyond 3 std deviation, only add it to that counter.
for (DataPoint dp : timeSeries) {
+ if (SeriesSummary.getTypeOfDataPoint(dp) != ValueType.NUMBER) continue;
double val = SeriesSummary.getValueOfDataPointAsNumber(dp);
if (Math.abs(val - meanAndStdDev.mean) > 3 * meanAndStdDev.stdDev) {
sigma3Counter.addProblemPoints(dp);
@@ -446,6 +447,7 @@ private static MeanAndStdDev getStats(List timeSeries) {
double sum = 0;
double sumSqDev = 0;
for (DataPoint dp : timeSeries) {
+ if (SeriesSummary.getTypeOfDataPoint(dp) != ValueType.NUMBER) continue;
double val = SeriesSummary.getValueOfDataPointAsNumber(dp);
if (weights > 0) {
sumSqDev += 1 * weights / 1 / (weights + 1) * Math.pow((1 / weights * sum - val), 2);
@@ -472,8 +474,10 @@ protected static void checkPercentFluctuations(
// Don't try to compare between times because this is a Sawtooth
if (dp.getValuesCount() > 1) return;
if (dp.getValuesCount() == 0) continue;
+ if (SeriesSummary.getTypeOfDataPoint(dp) != ValueType.NUMBER) continue;
double currVal = SeriesSummary.getValueOfDataPointAsNumber(dp);
- if (baseDataPoint != null) {
+ if (baseDataPoint != null
+ && SeriesSummary.getTypeOfDataPoint(baseDataPoint) == ValueType.NUMBER) {
double currDelta;
double baseVal = SeriesSummary.getValueOfDataPointAsNumber(baseDataPoint);
if (baseVal == 0) {