keenex v0.3.0 Keenex

This module defines the Keenex API

looks for application variables in the :keen app named :project_id, :write_key, :read_key or if any of those aren’t available, it looks for environment variables named KEEN_PROJECT_ID, KEEN_WRITE_KEY, KEEN_READ_KEY

Add it to your applications:

def application do
    [applications: [:keenex]]
end

Or call start_link directly either using start_link or start_link3 to pass in variables

{:ok, keen} = Keenex.start_link

# OR

{:ok, keen} = Keenex.start_link("keen_project_id", "keen_write_key", "keen_read_key")

and then call functions

{status, response} = Keenex.add_event("dinner.tacos", %{test: "tacos"})

status is either :ok or :error

response is a Map converted from the json response from Keen.

Info about the contents can be found here

Summary

Functions

Publishes an event into the event collection

Publishes multiple events to one or more event collections

Calculate the average value for a target property, among all events in a collection matching given criteria

Returns the number of events in a collection matching the given criteria

Return the number of events with unique values, for a target property in a collection matching given criteria

Creates an extraction request for full-form event data with all property values

Returns the number of unique actors that successfully (or unsuccessfully) make it through a series of steps

Returns schema for a single event collection

Returns schema for all event collections

Return the maximum numeric value for a target property, among all events in a collection matching given criteria

Calculate the median value for a target property, among all events in a collection matching given criteria

Return the minimum numeric value for a target property, among all events in a collection matching given criteria

Runs multiple types of analyses over the same data

Calculate a specified percentile value for a target property, among all events in a collection matching given criteria

Return a list of unique property values for a target property, among all events in a collection matching given criteria

Starts Keenex app

Starts Keenex app with the given project_id, write_key, and read_key

Calculate the sum of all numeric values for a target property, among all events in a collection matching given criteria

Types

response :: {status, map}
status :: :ok | :error

Functions

add_event(event_collection, data)

Specs

add_event(binary, map) :: Keenex.response

Publishes an event into the event collection

Keenex.add_event("dinner.tacos", %{data: "data"})
add_events(events)

Specs

add_events(map) :: Keenex.response

Publishes multiple events to one or more event collections

Keenex.add_events(%{event_collection1: [%{data: "data"}], event_collection2: [%{data: "data"}, %{more_data: "data"}]})
average(event_collection, target_property, params \\ %{})

Specs

average(binary, binary, map) :: Keenex.response

Calculate the average value for a target property, among all events in a collection matching given criteria.

count(event_collection, params \\ %{})

Specs

count(binary, map) :: Keenex.response

Returns the number of events in a collection matching the given criteria

count_unique(event_collection, target_property, params \\ %{})

Specs

count_unique(binary, binary, map) :: Keenex.response

Return the number of events with unique values, for a target property in a collection matching given criteria

extraction(event_collection, params \\ %{})

Specs

extraction(binary, map) :: Keenex.response

Creates an extraction request for full-form event data with all property values.

funnel(steps, params \\ %{})

Returns the number of unique actors that successfully (or unsuccessfully) make it through a series of steps

inspect(event_collection)

Specs

inspect(binary) :: Keenex.response

Returns schema for a single event collection

Keenex.inspect("dinner.tacos")
inspect_all()

Specs

inspect_all :: Keenex.response

Returns schema for all event collections

Keenex.inspect_all()
maximum(event_collection, target_property, params \\ %{})

Specs

maximum(binary, binary, map) :: Keenex.response

Return the maximum numeric value for a target property, among all events in a collection matching given criteria.

median(event_collection, target_property, params \\ %{})

Specs

median(binary, binary, map) :: Keenex.response

Calculate the median value for a target property, among all events in a collection matching given criteria.

minimum(event_collection, target_property, params \\ %{})

Specs

minimum(binary, binary, map) :: Keenex.response

Return the minimum numeric value for a target property, among all events in a collection matching given criteria.

multi_analysis(event_collection, analyses, params \\ %{})

Specs

multi_analysis(binary, map, map) :: Keenex.response

Runs multiple types of analyses over the same data

percentile(event_collection, target_property, percentile, params \\ %{})

Specs

percentile(binary, binary, integer, map) :: Keenex.response

Calculate a specified percentile value for a target property, among all events in a collection matching given criteria.

select_unique(event_collection, target_property, params \\ %{})

Specs

select_unique(binary, binary, map) :: Keenex.response

Return a list of unique property values for a target property, among all events in a collection matching given criteria.

start_link()

Specs

start_link :: {Keenex.status, pid}

Starts Keenex app.

Looks for application variables in the :keen app named :project_id, :write_key, :read_key or if any of those aren’t available, it looks for environment variables named KEEN_PROJECT_ID, KEEN_WRITE_KEY, KEEN_READ_KEY

start_link(project_id, write_key, read_key)

Specs

start_link(binary, binary, binary) :: {Keenex.status, pid}

Starts Keenex app with the given project_id, write_key, and read_key

sum(event_collection, target_property, params \\ %{})

Specs

sum(binary, binary, map) :: Keenex.response

Calculate the sum of all numeric values for a target property, among all events in a collection matching given criteria.