 
 fs = Npm.require('fs')
 path = Npm.require('path')
+
+ENABLE_PROFILING = true
 
 Router.configureBodyParsers = ->
   # The resolve-incidents endpoint may have files larger than the default limit

      dailyDecayRate = 1.0
      if (@request.query.activeCases + "").toLowerCase() == "true"
        dailyDecayRate = Math.pow(.5, (1 / event.caseLengthDays))
      baseIncidents = []
      constrainingIncidents = []
      event.incidents.map (incident) ->

        locations: $not: $size: 0
    else
      query = utils.eventToIncidentQuery(event)
    if dateRange
      if (@request.query.activeCases + "").toLowerCase() == "true"
        # TODO: look up disease specific stat
        event.caseLengthDays = 14
        extendedStartDate = new Date(dateRange.start)
        # Incidents from an extended date range are included to determine the
        # initial number of active cases at the beginning of the intended date range.
        # Assuming the half life of all cases is the case length, less than 10%
        # of the cases from before the extended date range would still be active
        # in the original date range.
        extendedStartDate.setDate(extendedStartDate.getDate() - (4 * event.caseLengthDays))
        dateRange.start = extendedStartDate
      query['dateRange.start'] = $lte: dateRange.end
      query['dateRange.end'] = $gte: dateRange.start
    console.time('fetch incidents') if ENABLE_PROFILING
    event.incidents = Incidents.find(query).fetch()
    console.timeEnd('fetch incidents') if ENABLE_PROFILING
  @response.setHeader('Access-Control-Allow-Origin', '*')
  @response.setHeader('Content-Type', 'application/json')
  @response.statusCode = 200
