<commit_before>categories = [{:name => 'music', :description => 'Concerts & Tour Dates' },
{:name => 'conference', :description => 'Conferences & Tradeshows' },
{:name => 'comedy', :description => 'Comedy' },
{:name => 'learning_education', :description => 'Education' },
{:name => 'family_fun_kids', :description => 'Kids & Family' },
{:name => 'festivals_parades', :description => 'Festivals' },
{:name => 'movies_film', :description => 'Film' },
{:name => 'food', :description => 'Food & Wine' },
{:name => 'fundraisers', :description => 'Fundraising & Charity' },
{:name => 'art', :description => 'Art Galleries & Exhibits' },
{:name => 'support', :description => 'Health & Wellness' },
{:name => 'holiday', :description => 'Holiday' },
{:name => 'books', :description => 'Literary & Books' },
{:name => 'attractions', :description => 'Museums & Attractions' },
{:name => 'community', :description => 'Neighborhood' },
{:name => 'business', :description => 'Business & Networking' },
{:name => 'singles_social', :description => 'Nightlife & Singles' },
{:name => 'schools_alumni', :description => 'University & Alumni' },
{:name => 'clubs_associations', :description => 'Organizations & Meetups' },
{:name => 'outdoors_recreation', :description => 'Outdoors & Recreation' },
{:name => 'performing_arts', :description => 'Performing Arts' },
{:name => 'animals', :description => 'Pets' },
{:name => 'politics_activism', :description => 'Politics & Activism' },
{:name => 'sales', :description => 'Sales & Retail' },
{:name => 'science', :description => 'Science' },
{:name => 'religion_spirituality', :description => 'Religion & Spirituality' },
{:name => 'sports', :description => 'Sports' },
{:name => 'technology', :description => 'Technology' },
{:name => 'other', :description => 'Other & Miscellaneous' }]

Category.create(categories)

sample_cats = ["art", "music", "food", "festivals_parades", "business", "technology", "sports", "fundraisers", "outdoors_recreation", "clubs_associations"]

sample_cats.each do |c|

  cat = Category.where(name:c)[0]

  p url = "http://api.eventful.com/json/events/search?location=San%20Francisco&category=#{c}&date=this_week&app_key=#{ENV['EVENTFUL_KEY']}"

  response = HTTParty.get(url)

  body = JSON.parse(response)

  # p body
  # p "*"*30
  # p body["events"]
  # p "*"*30
  # p body["events"]["event"][0]["title"]
  # p body["events"]["event"]["title"]

  body["events"]["event"].each_with_index do |event, index|
    name = event["title"]
    city = event["city_name"]
    description = event["description"]
    venue = event["venue_name"]
    price = event["price"]
    starttime = event["start_time"]
    endtime = event["stop_time"]
    perf = []
    if event["performers"] && !event["performers"].nil?
      puts "this is event-performers:"
      p event["performers"]
      event["performers"]["performer"].each {|k,v | perf << v["name"] }
    else
      performer = nil
    end
    performer = perf.join(", ")
    event["free"] == 1 ? free = true : free = false
    if description == ""
      if event["performers"]
        event["performers"].each {|k,v| description = description + " " + v["short_bio"] }
      end
    end<commit_msg>fix seed file issue - line 64<commit_after>categories = [{:name => 'music', :description => 'Concerts & Tour Dates' },
{:name => 'conference', :description => 'Conferences & Tradeshows' },
{:name => 'comedy', :description => 'Comedy' },
{:name => 'learning_education', :description => 'Education' },
{:name => 'family_fun_kids', :description => 'Kids & Family' },
{:name => 'festivals_parades', :description => 'Festivals' },
{:name => 'movies_film', :description => 'Film' },
{:name => 'food', :description => 'Food & Wine' },
{:name => 'fundraisers', :description => 'Fundraising & Charity' },
{:name => 'art', :description => 'Art Galleries & Exhibits' },
{:name => 'support', :description => 'Health & Wellness' },
{:name => 'holiday', :description => 'Holiday' },
{:name => 'books', :description => 'Literary & Books' },
{:name => 'attractions', :description => 'Museums & Attractions' },
{:name => 'community', :description => 'Neighborhood' },
{:name => 'business', :description => 'Business & Networking' },
{:name => 'singles_social', :description => 'Nightlife & Singles' },
{:name => 'schools_alumni', :description => 'University & Alumni' },
{:name => 'clubs_associations', :description => 'Organizations & Meetups' },
{:name => 'outdoors_recreation', :description => 'Outdoors & Recreation' },
{:name => 'performing_arts', :description => 'Performing Arts' },
{:name => 'animals', :description => 'Pets' },
{:name => 'politics_activism', :description => 'Politics & Activism' },
{:name => 'sales', :description => 'Sales & Retail' },
{:name => 'science', :description => 'Science' },
{:name => 'religion_spirituality', :description => 'Religion & Spirituality' },
{:name => 'sports', :description => 'Sports' },
{:name => 'technology', :description => 'Technology' },
{:name => 'other', :description => 'Other & Miscellaneous' }]

Category.create(categories)

sample_cats = ["art", "music", "food", "festivals_parades", "business", "technology", "sports", "fundraisers", "outdoors_recreation", "clubs_associations"]

sample_cats.each do |c|

  cat = Category.where(name:c)[0]

  p url = "http://api.eventful.com/json/events/search?location=San%20Francisco&category=#{c}&date=this_week&app_key=#{ENV['EVENTFUL_KEY']}"

  response = HTTParty.get(url)

  body = JSON.parse(response)

  # p body
  # p "*"*30
  # p body["events"]
  # p "*"*30
  # p body["events"]["event"][0]["title"]
  # p body["events"]["event"]["title"]

  body["events"]["event"].each_with_index do |event, index|
    name = event["title"]
    city = event["city_name"]
    description = event["description"]
    venue = event["venue_name"]
    price = event["price"]
    starttime = event["start_time"]
    endtime = event["stop_time"]
    perf = []
    if event["performers"] && !event["performers"].nil?
      puts "this is event-performers:"
      p event["performers"]
      event["performers"]["performer"].each {|k,v | perf << v["name"] }
    else
      performer = nil
    end
    performer = perf.join(", ")
    event["free"] == 1 ? free = true : free = false
    if description == ""
      if event["performers"]
        event["performers"]["performer"].each {|k,v| description = description + " " + v["short_bio"] }
      end
    end
{'fraction_non_alphanumeric': 0.21638884561458172, 'fraction_numerical': 0.003115750116840629, 'mean_word_length': 5.045197740112994, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 119, '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': '2103829', 'n_tokens_mistral': 2160, 'n_tokens_neox': 2081, 'n_words': 462}