<commit_before>require 'fileutils'
require 'sequel'

FileUtils.mkdir 'db' unless Dir.exist?('db')
DB = Sequel.connect('sqlite://db/diabetes.sqlite3')

# create an items table
begin
  DB.create_table :data do
    primary_key :id
    Number :date
    Number :time
    Number :level
  end
end
# create a dataset from the items table
data = DB[:data]
# time is in military time
data.insert(id: 1)
data.insert(date: 4_15_17, time: 741, level: 281)
data.insert(date: 4_15_17, time: 957, level: 146)
data.insert(date: 4_15_17, time: 1156, level: 208)
data.insert(date: 4_15_17, time: 1254, level: 187)
data.insert(date: 4_15_17, time: 1440, level: 304)
data.insert(date: 4_15_17, time: 1516, level: 277)
data.insert(date: 4_15_17, time: 1600, level: 210)
data.insert(date: 4_15_17, time: 1727, level: 88)
data.insert(date: 4_15_17, time: 1810, level: 68)
data.insert(date: 4_15_17, time: 2145, level: 108)<commit_msg>Update createdb.rb<commit_after>require 'fileutils'
require 'sequel'

# This file populates a database file within the db folder 
# For demonstration purposes 

FileUtils.mkdir 'db' unless Dir.exist?('db')
DB = Sequel.connect('sqlite://db/diabetes.sqlite3')

# create an items table
begin
  DB.create_table :data do
    primary_key :id
    Number :date
    Number :time
    Number :level
  end
end
# create a dataset from the items table
data = DB[:data]
# time is in military time
data.insert(id: 1)
data.insert(date: 04_15_17, time: 741, level: 281)
data.insert(date: 04_15_17, time: 957, level: 146)
data.insert(date: 04_15_17, time: 1156, level: 208)
data.insert(date: 04_15_17, time: 1254, level: 187)
data.insert(date: 04_15_17, time: 1440, level: 304)
data.insert(date: 04_15_17, time: 1516, level: 277)
data.insert(date: 04_15_17, time: 1600, level: 210)
data.insert(date: 04_15_17, time: 1727, level: 88)
data.insert(date: 04_15_17, time: 1810, level: 68)
data.insert(date: 04_15_17, time: 2145, level: 108)
{'fraction_non_alphanumeric': 0.13032191069574248, 'fraction_numerical': 0.1277258566978193, 'mean_word_length': 5.040752351097178, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6831362', 'n_tokens_mistral': 923, 'n_tokens_neox': 729, 'n_words': 221}