<commit_before>CREATE KEYSPACE gonalytics WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };

CREATE TABLE visits
(
    id timeuuid,
    ip varchar,
    nb_of_actions bigint,
    site_id bigint,
    referrer varchar,
    language varchar,
    first_action_at timestamp,
    last_action_at timestamp,
    PRIMARY KEY (id)
);<commit_msg>Cassandra schema design concept.<commit_after>DROP KEYSPACE IF EXISTS gonalytics;

CREATE KEYSPACE gonalytics WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };

CREATE TYPE gonalytics.window (
   width int,
   height int
);

CREATE TYPE gonalytics.plugins (
   java boolean
);

CREATE TYPE gonalytics.browser (
   name varchar,
   version varchar,
   major_version varchar,
   user_agent varchar,
   platform varchar,
   cookie boolean,
   is_online boolean,
   window frozen<gonalytics.window>,
   plugins frozen<gonalytics.plugins>
);

CREATE TYPE gonalytics.screen (
    width int,
    height int
);

CREATE TYPE gonalytics.operating_system (
    name varchar,
    version varchar
);

CREATE TYPE gonalytics.device (
    name varchar,
    is_mobile boolean,
    is_tablet boolean,
    is_phone boolean
);

CREATE TYPE gonalytics.location (
    city_name varchar,
    city_id int,
    country_name varchar,
    country_code varchar,
    country_id int,
    continent_name varchar,
    continent_code varchar,
    continent_id int,
    latitude double,
    longitude double,
    time_zone varchar,
    metro_code int,
    postal_code varchar,
    is_anonymous_proxy boolean,
    is_satellite_provider boolean
);

CREATE TYPE gonalytics.page (
    title varchar,
    host varchar,
    url varchar
);

CREATE TYPE gonalytics.action (
    id timeuuid,
    visit_id timeuuid,
    referrer varchar,
    page frozen<gonalytics.page>,
    created_at timestamp
);

CREATE TABLE IF NOT EXISTS gonalytics.visits
(
    id timeuuid,
    ip varchar,
    nb_of_actions bigint,
    site_id bigint,
    referrer varchar,
    language varchar,
    browser frozen<gonalytics.browser>,
    screen frozen<gonalytics.screen>,
    os frozen<gonalytics.operating_system>,
    device frozen<gonalytics.device>,
    location frozen<gonalytics.location>,
    first_page frozen<gonalytics.page>,
    last_page frozen<gonalytics.page>,
    actions map<timestamp, frozen<gonalytics.action>>,
    first_action_at timestamp,
    last_action_at timestamp,
    PRIMARY KEY (id)
) WITH comment='Visits and related actions.';
{'fraction_non_alphanumeric': 0.07220653489310205, 'fraction_numerical': 0.0008067769261799112, 'mean_word_length': 3.609665427509294, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '7098637', 'n_tokens_mistral': 788, 'n_tokens_neox': 758, 'n_words': 208}