<commit_before>var express = require('express')
var request = require('superagent')

const router = express.Router()

router.get('/:locationID', (req,res) => {
  request
  .get(`http://api.songkick.com/api/3.0/metro_areas/${req.params.locationID}/calendar.json?apikey=${process.env.SONGKICK_API}`)
  .end((err,result) => {
    if (err) {
      res.status(500).send(err.message)
    }
    else {
      console.log({result: result.body.resultsPage.results});
      let searchResults = result.body.resultsPage.results.event
      console.log({searchResults});
      let events = searchResults.map((result)=> {
          return (
            {
              gig: result.displayName || "NA",
              city: result.location.city || "NA",
              lat: result.location.lat || "NA",
              long: result.location.lng || "NA",
              artists: result.performance.map(performer => performer.artist.displayName) || "NA",
              date: result.start.date,
              time: result.start.time
              // if we only want headline artists then this becomes:
              // artists: result.performance[0].artist.displayName
            }
          )
        })
      let artists = events.map((event)=> {
        return event.artists[0]
      })
      res.json({events,artists})<commit_msg>slight tweak<commit_after>var express = require('express')
var request = require('superagent')

const router = express.Router()

router.get('/:locationID', (req,res) => {
  request
  .get(`http://api.songkick.com/api/3.0/metro_areas/${req.params.locationID}/calendar.json?apikey=${process.env.SONGKICK_API}`)
  .end((err,result) => {
    if (err) {
      res.status(500).send(err.message)
    }
    else {
      console.log({result: result.body.resultsPage.results});
      let searchResults = result.body.resultsPage.results.event
      console.log({searchResults});
      let events = searchResults.map((result)=> {
          return (
            {
              gig: result.displayName || "NA",
              city: result.location.city || "NA",
              lat: result.location.lat || "NA",
              long: result.location.lng || "NA",
              artists: result.performance.map(performer => performer.artist.displayName) || "NA",
              // if we only want headline artists then this becomes:
              // artists: result.performance[0].artist.displayName
              date: result.start.date || "NA",
              time: result.start.time || "NA"
            }
          )
        })
      let artists = events.map((event)=> {
        return event.artists[0]
      })
      res.json({events,artists})
{'fraction_non_alphanumeric': 0.15180265654648956, 'fraction_numerical': 0.005313092979127135, 'mean_word_length': 2.230392156862745, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3276287', 'n_tokens_mistral': 783, 'n_tokens_neox': 771, 'n_words': 132}