diff --git a/src/actions/summarized.js b/src/actions/summarized.js
index fb9a3dd4..efa7d5cd 100644
--- a/src/actions/summarized.js
+++ b/src/actions/summarized.js
@@ -1,6 +1,5 @@
import { SUMMARIZED_FAILED, SUMMARIZED_FETCHING, SUMMARIZED_RECEIVED } from './constants'
import api from '../util/api'
-// import { calculateRates, reshapeData } from '../util/summarized'
export const failedSummarized = error => ({
type: SUMMARIZED_FAILED,
diff --git a/src/containers/NibrsContainer.js b/src/containers/NibrsContainer.js
index 25eb7479..6387f751 100644
--- a/src/containers/NibrsContainer.js
+++ b/src/containers/NibrsContainer.js
@@ -53,7 +53,7 @@ class NibrsContainer extends React.Component {
)
}
});
- content.push(
)
+ content.push()
});
return content
@@ -92,9 +92,13 @@ class NibrsContainer extends React.Component {
) {
return null
}
-
const placeDisplay = isAgency ? agency.display : lookupUsa(place).display
- const nibrsFirstYear = this.initialNibrsYear(place, placeType, since)
+ let nibrsFirstYear
+ if (placeType === 'region') {
+ nibrsFirstYear = since
+ } else {
+ nibrsFirstYear = this.initialNibrsYear(place, placeType, since)
+ }
const { data, error } = nibrsCounts
const isReady = nibrsCounts.loaded
diff --git a/src/util/api.js b/src/util/api.js
index 1aa65708..3ffde118 100644
--- a/src/util/api.js
+++ b/src/util/api.js
@@ -186,6 +186,8 @@ const fetchNibrsCounts = ({ dim, pageType, place, placeType, type, placeId }) =>
? 'national'
: placeType === 'agency'
? `agency/${place}`
+ : placeType === 'region'
+ ? `regions/${place}`
: `states/${placeId}`
const field = dimensionEndpoints[dim] || dim
diff --git a/src/util/participation.js b/src/util/participation.js
index c1e09d95..7578498d 100644
--- a/src/util/participation.js
+++ b/src/util/participation.js
@@ -15,7 +15,9 @@ export const shouldFetchSummaries = (filters, region, states) =>
isValidCrime(filters.pageType) && validateFilter(filters, region.regions, states.states)
export const shouldFetchNibrs = ({ pageType, place, placeType }) => {
- if (noNibrs.includes(pageType) || placeType === 'region' || pageType === 'violent-crime' || pageType === 'property-crime') return false
+ if (noNibrs.includes(pageType) || pageType === 'violent-crime' || pageType === 'property-crime') return false
+
+ if (placeType === 'region') return true;
const placeNorm = placeType === 'agency' ? oriToState(place) : place
const coverage = lookup(placeNorm)
diff --git a/src/util/summary.js b/src/util/summary.js
index 489daab5..a8a7ef7a 100644
--- a/src/util/summary.js
+++ b/src/util/summary.js
@@ -35,6 +35,7 @@ export const calculateRates = (summaries, placeType) => {
const summaryObject = Object()
do {
const yrData = getYearData(summaries, place, minYr)
+
if (yrData.length > 0) {
const offensesObject = Object()
const offenses = Object.keys(yrData[0]).filter(
@@ -60,8 +61,8 @@ export const calculateRates = (summaries, placeType) => {
offensesObject.year = minYr;
offensesObject.population = population
withRegionRates.push(offensesObject)
- minYr += 1;
}
+ minYr += 1;
} while (minYr <= MAX_YEAR)
summaryObject[place] = withRegionRates;
return summaryObject;
diff --git a/src/util/usa.js b/src/util/usa.js
index f7c2f42c..87b2f694 100644
--- a/src/util/usa.js
+++ b/src/util/usa.js
@@ -54,6 +54,10 @@ const data = [
{ id: 'wv', slug: 'west-virginia', placeType: 'state' },
{ id: 'wi', slug: 'wisconsin', placeType: 'state' },
{ id: 'wy', slug: 'wyoming', placeType: 'state' },
+ { id: 'west', slug: 'west', placeType: 'region' },
+ { id: 'south', slug: 'south', placeType: 'region' },
+ { id: 'northeast', slug: 'northeast', placeType: 'region' },
+ { id: 'midwest', slug: 'midwest', placeType: 'region' },
].map(d => ({
...d,
display: d.display || startCase(d.slug),