Skip to content

Commit

Permalink
Update program participation & handle gap years
Browse files Browse the repository at this point in the history
To handle the fact that Colorado started submitting
NIBRS data in 1992 but then stopped for 1995 and 1996
I added a no-data-years optional array to the UCR
program participation data. These years are not
included in the year drop down for bulk NIBRS
downloads.
  • Loading branch information
Jeremia Kimelman authored and jpwentz committed Dec 21, 2017
1 parent 17d843a commit f23131c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 25 deletions.
25 changes: 9 additions & 16 deletions public/data/ucr-program-participation.json
Expand Up @@ -38,7 +38,8 @@
"colorado": {
"srs": false,
"nibrs": {
"initial-year": 1992
"initial-year": 1992,
"no-data-years": [1995, 1996]
},
"state-program": true
},
Expand All @@ -57,10 +58,8 @@
"state-program": true
},
"washington-dc": {
"srs": false,
"nibrs": {
"initial-year": 2000
},
"srs": true,
"nibrs": false,
"state-program": true
},
"florida": {
Expand All @@ -87,9 +86,7 @@
},
"illinois": {
"srs": true,
"nibrs": {
"initial-year": 1993
},
"nibrs": false,
"state-program": true
},
"indiana": {
Expand All @@ -102,7 +99,7 @@
"iowa": {
"srs": false,
"nibrs": {
"initial-year": 1991
"initial-year": 1992
},
"state-program": true
},
Expand Down Expand Up @@ -130,7 +127,7 @@
"maine": {
"srs": true,
"nibrs": {
"initial-year": 2003
"initial-year": 2004
},
"state-program": true
},
Expand All @@ -155,16 +152,12 @@
},
"minnesota": {
"srs": true,
"nibrs": {
"initial-year": 2016
},
"nibrs": false,
"state-program": true
},
"mississippi": {
"srs": true,
"nibrs": {
"initial-year": 2009
},
"nibrs": false,
"state-program": false
},
"missouri": {
Expand Down
17 changes: 8 additions & 9 deletions src/components/DownloadBulkNibrs.js
Expand Up @@ -33,8 +33,11 @@ class DownloadBulkNibrs extends React.Component {
if (!this.state.place) return []
const { nibrs } = ucrProgram[this.state.place]
const initialYear = nibrs['initial-year']
const noDataYears = nibrs['no-data-years'] || []

return range(MAX_YEAR + 1 - initialYear).map(y => initialYear + y)
return range(MAX_YEAR + 1 - initialYear)
.map(y => initialYear + y)
.filter(y => !noDataYears.includes(y))
}

handleClick = e => {
Expand Down Expand Up @@ -80,11 +83,11 @@ class DownloadBulkNibrs extends React.Component {
<option value="Location" disabled>
Location
</option>
{nibrsStates.sort().map((s, i) =>
{nibrsStates.sort().map((s, i) => (
<option key={i} value={s}>
{lookupUsa(s).display}
</option>,
)}
</option>
))}
</select>
</div>
<div className="sm-col sm-col-4 px1 mb2 sm-m0">
Expand All @@ -100,11 +103,7 @@ class DownloadBulkNibrs extends React.Component {
<option value="Year" disabled>
Year
</option>
{nibrsYears.map((y, i) =>
<option key={i}>
{y}
</option>,
)}
{nibrsYears.map((y, i) => <option key={i}>{y}</option>)}
</select>
</div>
<div className="sm-col sm-col-3 px1 mb2 sm-m0">
Expand Down

0 comments on commit f23131c

Please sign in to comment.