PopulationFilter Library

Provides a convenient interface for creating population filters for GlobalAnalytics functions. PopulationFilters filter the population space, before performing the analytic calculations.

 

Import


To use this library and its functions, you must use the import line at the beginning of your Base Python code.

import PopulationFilter

 

Functions

 

PopulationFilter.numeric_tag

Usage: Filter.numeric_tag(name)

Represents a tag with numeric values.

  • Parameters:
    • namestr|unicode Name of tag, including stream name (eg. "raw.score")
  • Returns: NumericFilter



PopulationFilter.string_tag

Usage: Filter.string_tag(name)

Represents a tag with string values.

  • Parameters:
    • namestr|unicode Name of tag, including stream name (eg. "raw.city")
  • Returns: StringFilter



PopulationFilter.date_tag

Usage: Filter.date_tag(name)

Represents a tag with date value.

  • Parameters:
    • namestr|unicode Name of tag, including stream name (eg. "raw.birthday")
  • Returns: DateFilter



PopulationFilter.boolean_tag

Usage: Filter.boolean_tag(name)

Represents a tag with a boolean value.

  • Parameters:
    • namestr|unicode Name of tag, including stream name (eg. "raw.allowed_to_do_that")
  • Returns: BooleanFilter



PopulationFilter.equal_to

Usage: filter.equal_to(value)

Specifies that a tag (or boolean expression of tags) is equal to another value.

  • Params:
    • value: Value, must be same type as Filter instance. e.g. (DateTime for DateFilters, True|False for BooleanFilter)
  • Returns: BooleanFilter



PopulationFilter.not_equal_to

Usage: filter.not_equal_to(value)

Opposite of Filter.equal_to

  • Params:
    • value: Value must be same type as Filter instance. e.g. (DateTime for DateFilters, True|False for BooleanFilter)
  • Returns: BooleanFilter



BooleanPopulationFilter &

Usage: filter & filter

Represents a boolean And operation

  • Params:
    • filter: Must be a BooleanFilter
  • Returns: BooleanFilter



NumericPopulationFilter.greater_than

Usage: filter.greater_than(value)

Asserts that a numeric tag is greater than the given value.

  • Params:
    • value: Must be a Number type
  • Returns: BooleanFilter



NumericPopulationFilter.greater_than_or_equal

Usage: filter.greater_than_or_equal(value)

Asserts that a numeric tag is greater than or equal to the given value.

  • Params:
    • value: Must be a Number type
  • Returns: BooleanFilter



NumericPopulationFilter.less_than

Usage: filter.less_than(value)

Asserts that a numeric tag is less than the given value.

  • Params:
    • value: Must be a Number type
  • Returns: BooleanFilter



NumericPopulationFilter.less_than_or_equal

Usage: filter.less_than_or_equal(value)

Asserts that a numeric tag is less than or equal to the given value.

  • Params:
    • value: Must be a Number type
  • Returns: BooleanFilter



Sample Code

 

import PopulationFilter

# asserts 'bpm' == 120
PopulationFilter.numeric_tag('raw.bpm').equal_to(120)

# asserts 'name' != 'Joe'
PopulationFilter.string_tag('raw.name').not_equal_to('Joe')

# asserts 'age' > 20 and 'bpm' > 80
age_filter = PopulationFilter.numeric_tag('raw.age').greater_than(20)
bpm_filter = PopulationFilter.numeric_tag('raw.bpm').greater_than(80)
comb_filter = age_filter & bpm_filter
 
 
Have more questions? Submit a request

0 Comments

Article is closed for comments.