Skip to content

flowmachine.features.subscriber.subscriber_tacs

Source: flowmachine/features/subscriber/subscriber_tacs.py

Features that represent TACs (unique phone model identifiers), and handsets associated with a subscriber.

Class SubscriberHandset

SubscriberHandset(start, stop, *, hours='all', table='all', subscriber_identifier='msisdn', method='most-common', subscriber_subset=None)
Source: flowmachine/features/subscriber/subscriber_tacs.py

Class representing a single handset associated to the subscriber.

Attributes

Parameters

  • start, stop: str

    iso-format start and stop datetimes

  • hours: 2-tuple of floats, default 'all'

    Restrict the analysis to only a certain set of hours within each day.

  • table: str, default 'all'

  • subscriber_identifier: str, default 'msisdn'

    The focus of the analysis, usually either 'msisdn', 'imei'

  • method: {'most-common', 'last'}

    Method for choosing a handset to associate.

Examples

subscriber_handsets = SubscriberHandset('2016-01-01', '2016-01-07')
subscriber_handsets.get_dataframe()
          tac        subscriber  brand  model width height depth   ...    j2me_midp_10 j2me_midp_20 j2me_midp_21 j2me_cldc_10 j2me_cldc_11 j2me_cldc_20 hnd_type
0  18867440.0  038OVABN11Ak4W5P   Sony  TO-64  None   None  None   ...            None         None         None         None         None         None    Smart
1  21572046.0  09NrjaNNvDanD8pk  Apple  WS-44  None   None  None   ...            None         None         None         None         None         None  Feature
2  81963365.0  0ayZGYEQrqYlKw6g   Sony  YG-07  None   None  None   ...            None         None         None         None         None         None    Smart
3  92380772.0  0DB8zw67E9mZAPK2   Oppo  GK-00  None   None  None   ...            None         None         None         None         None         None  Feature
4  77510543.0  0Gl95NRLjW2aw8pW   Sony  KZ-03  None   None  None   ...            None         None         None         None         None         None  Feature
. . .

Note

Be aware that when using a imei as a subscriber identifier, than one imei is always associated to a single handset.

Methods

cache

cache
Source: flowmachine/core/query.py

Returns
  • bool

    True is caching is switched on.

column_names

column_names
Source: flowmachine/features/subscriber/subscriber_tacs.py

Returns the column names.

Returns
  • typing.List[str]

    List of the column names of this query.

column_names_as_string_list

column_names_as_string_list
Source: flowmachine/core/query.py

Get the column names as a comma separated list

Returns
  • str

    Comma separated list of column names

dependencies

dependencies
Source: flowmachine/core/query.py

Returns
  • set

    The set of queries which this one is directly dependent on.

fully_qualified_table_name

fully_qualified_table_name
Source: flowmachine/core/query.py

Returns a unique fully qualified name for the query to be stored as under the cache schema, based on a hash of the parameters, class, and subqueries.

Returns
  • str

    String form of the table's fqn

index_cols

index_cols
Source: flowmachine/core/query.py

A list of columns to use as indexes when storing this query.

Returns
  • ixen: list

    By default, returns the location columns if they are present and self.spatial_unit is defined, and the subscriber column.

Examples
daily_location("2016-01-01").index_cols
[['name'], '"subscriber"']

is_stored

is_stored
Source: flowmachine/core/query.py

Returns
  • bool

    True if the table is stored, and False otherwise.

query_id

query_id
Source: flowmachine/core/query.py

Generate a uniquely identifying hash of this query, based on the parameters of it and the subqueries it is composed of.

Returns
  • str

    query_id hash string

query_state

query_state
Source: flowmachine/core/query.py

Return the current query state.

Returns
  • QueryState

    The current query state

query_state_str

query_state_str
Source: flowmachine/core/query.py

Return the current query state as a string

Returns
  • str

    The current query state. The possible values are the ones defined in flowmachine.core.query_state.QueryState.

table_name

table_name
Source: flowmachine/core/query.py

Returns a uniquename for the query to be stored as, based on a hash of the parameters, class, and subqueries.

Returns
  • str

    String form of the table's fqn

Class SubscriberHandsetCharacteristic

SubscriberHandsetCharacteristic(
    start,
    stop,
    characteristic,
    hours="all",
    table="all",
    subscriber_identifier="msisdn",
    method="most-common",
    subscriber_subset=None,
)
Source: flowmachine/features/subscriber/subscriber_tacs.py

Class extracting a single characteristic from the handset.

Attributes

Parameters

  • start, stop: str

    iso-format start and stop datetimes

  • characteristic: {

    "brand", "depth", "display_colors", "display_height", "display_type", "display_width", "hardware_bluetooth", "hardware_edge", "hardware_gprs", "hardware_gps", "hardware_umts", "hardware_wifi", "height", "hnd_type", "j2me_cldc_10", "j2me_cldc_11", "j2me_cldc_20", "j2me_midp_10", "j2me_midp_20", "j2me_midp_21", "mms_built_in_camera", "mms_receiver", "model", "software_os_name", "software_os_vendor", "software_os_version", "syncml_dm_acc_gprs", "syncml_dm_app_bookmark", "syncml_dm_app_browser", "syncml_dm_app_internet", "syncml_dm_app_java", "syncml_dm_app_mms", "syncml_dm_settings", "tac", "wap_1_2_1", "wap_2_0", "wap_push_oma_app_browser", "wap_push_oma_app_ims", "wap_push_oma_app_internet", "wap_push_oma_app_mms", "wap_push_oma_app_poc", "wap_push_oma_cp_bookmarks", "wap_push_oma_settings", "wap_push_ota_app_browser", "wap_push_ota_app_internet", "wap_push_ota_app_mms", "wap_push_ota_bookmarks", "wap_push_ota_multi_shot", "wap_push_ota_settings", "wap_push_ota_single_shot", "wap_push_ota_support", "weight", "width",

  • }

    The required handset characteristic.

  • hours: 2-tuple of floats, default 'all'

    Restrict the analysis to only a certain set of hours within each day.

  • table: str, default 'all'

  • subscriber_identifier: str, default 'msisdn'

    The focus of the analysis, usually either 'msisdn', 'imei'

  • method: {'most-common', 'last'}

    Method for choosing a handset to associate.

Examples

subscriber_smart = SubscriberHandsetCharacteristic('2016-01-01', '2016-01-07',
    'hnd_type')
subscriber_smart.get_dataframe()
         subscriber        value
0  038OVABN11Ak4W5P        Smart
1  09NrjaNNvDanD8pk      Feature
2  0ayZGYEQrqYlKw6g      Feature
3  0DB8zw67E9mZAPK2      Feature
4  0Gl95NRLjW2aw8pW      Feature
                        .
                        .
                        .
Notes
----
For most-common, this query checks whether the subscriber most commonly uses a particular type of phone, rather than the type of their most commonly used phone.

Methods

cache

cache
Source: flowmachine/core/query.py

Returns
  • bool

    True is caching is switched on.

column_names

column_names
Source: flowmachine/features/subscriber/subscriber_tacs.py

Returns the column names.

Returns
  • typing.List[str]

    List of the column names of this query.

column_names_as_string_list

column_names_as_string_list
Source: flowmachine/core/query.py

Get the column names as a comma separated list

Returns
  • str

    Comma separated list of column names

dependencies

dependencies
Source: flowmachine/core/query.py

Returns
  • set

    The set of queries which this one is directly dependent on.

fully_qualified_table_name

fully_qualified_table_name
Source: flowmachine/core/query.py

Returns a unique fully qualified name for the query to be stored as under the cache schema, based on a hash of the parameters, class, and subqueries.

Returns
  • str

    String form of the table's fqn

index_cols

index_cols
Source: flowmachine/core/query.py

A list of columns to use as indexes when storing this query.

Returns
  • ixen: list

    By default, returns the location columns if they are present and self.spatial_unit is defined, and the subscriber column.

Examples
daily_location("2016-01-01").index_cols
[['name'], '"subscriber"']

is_stored

is_stored
Source: flowmachine/core/query.py

Returns
  • bool

    True if the table is stored, and False otherwise.

query_id

query_id
Source: flowmachine/core/query.py

Generate a uniquely identifying hash of this query, based on the parameters of it and the subqueries it is composed of.

Returns
  • str

    query_id hash string

query_state

query_state
Source: flowmachine/core/query.py

Return the current query state.

Returns
  • QueryState

    The current query state

query_state_str

query_state_str
Source: flowmachine/core/query.py

Return the current query state as a string

Returns
  • str

    The current query state. The possible values are the ones defined in flowmachine.core.query_state.QueryState.

table_name

table_name
Source: flowmachine/core/query.py

Returns a uniquename for the query to be stored as, based on a hash of the parameters, class, and subqueries.

Returns
  • str

    String form of the table's fqn

Class SubscriberHandsets

SubscriberHandsets(start, stop, *, hours='all', table='all', subscriber_identifier='msisdn', subscriber_subset=None)
Source: flowmachine/features/subscriber/subscriber_tacs.py

Class representing all the handsets for which a subscriber has been associated.

Attributes

Parameters

  • start, stop: str

    iso-format start and stop datetimes

  • hours: 2-tuple of floats, default 'all'

    Restrict the analysis to only a certain set of hours within each day.

  • table: str, default 'all'

  • subscriber_identifier: str, default 'msisdn'

    The focus of the analysis, usually either 'msisdn', 'imei'

Examples

subscriber_handsets = SubscriberHandsets('2016-01-01 13:30:30',
                           '2016-01-02 16:25:00')
subscriber_handsets.get_dataframe()
          tac        subscriber                      time    brand  model width   ...    j2me_midp_20 j2me_midp_21 j2me_cldc_10 j2me_cldc_11 j2me_cldc_20 hnd_type
0  85151913.0  1vGR8kp342yxEpwY 2016-01-01 13:31:06+00:00     Sony  KQ-99  None   ...            None         None         None         None         None  Feature
1  15314569.0  QPdr2B94VaEzZgoW 2016-01-01 13:31:06+00:00     Oppo  UT-18  None   ...            None         None         None         None         None    Smart
2  92380772.0  LjDxeZEREElG7m0r 2016-01-01 13:32:21+00:00     Oppo  GK-00  None   ...            None         None         None         None         None  Feature
3  99503609.0  Kabe7EppYbMEj6O3 2016-01-01 13:32:21+00:00  Samsung  NN-71  None   ...            None         None         None         None         None    Smart
4  16875116.0  gWPl7QBD8VnEyX8K 2016-01-01 13:34:41+00:00     Sony  JH-73  None   ...            None         None         None         None         None    Smart
. . .

Methods

cache

cache
Source: flowmachine/core/query.py

Returns
  • bool

    True is caching is switched on.

column_names

column_names
Source: flowmachine/features/subscriber/subscriber_tacs.py

Returns the column names.

Returns
  • typing.List[str]

    List of the column names of this query.

column_names_as_string_list

column_names_as_string_list
Source: flowmachine/core/query.py

Get the column names as a comma separated list

Returns
  • str

    Comma separated list of column names

dependencies

dependencies
Source: flowmachine/core/query.py

Returns
  • set

    The set of queries which this one is directly dependent on.

fully_qualified_table_name

fully_qualified_table_name
Source: flowmachine/core/query.py

Returns a unique fully qualified name for the query to be stored as under the cache schema, based on a hash of the parameters, class, and subqueries.

Returns
  • str

    String form of the table's fqn

index_cols

index_cols
Source: flowmachine/core/query.py

A list of columns to use as indexes when storing this query.

Returns
  • ixen: list

    By default, returns the location columns if they are present and self.spatial_unit is defined, and the subscriber column.

Examples
daily_location("2016-01-01").index_cols
[['name'], '"subscriber"']

is_stored

is_stored
Source: flowmachine/core/query.py

Returns
  • bool

    True if the table is stored, and False otherwise.

query_id

query_id
Source: flowmachine/core/query.py

Generate a uniquely identifying hash of this query, based on the parameters of it and the subqueries it is composed of.

Returns
  • str

    query_id hash string

query_state

query_state
Source: flowmachine/core/query.py

Return the current query state.

Returns
  • QueryState

    The current query state

query_state_str

query_state_str
Source: flowmachine/core/query.py

Return the current query state as a string

Returns
  • str

    The current query state. The possible values are the ones defined in flowmachine.core.query_state.QueryState.

table_name

table_name
Source: flowmachine/core/query.py

Returns a uniquename for the query to be stored as, based on a hash of the parameters, class, and subqueries.

Returns
  • str

    String form of the table's fqn

Class SubscriberTAC

SubscriberTAC(start, stop, *, hours='all', table='all', subscriber_subset=None, subscriber_identifier='msisdn', method='most-common')
Source: flowmachine/features/subscriber/subscriber_tacs.py

Class representing a single TAC associated to the subscriber.

Attributes

Parameters

  • start, stop: str

    iso-format start and stop datetimes

  • hours: 2-tuple of floats, default 'all'

    Restrict the analysis to only a certain set of hours within each day.

  • table: str, default 'all'

  • subscriber_identifier: str, default 'msisdn'

    The focus of the analysis, usually either 'msisdn', 'imei'

  • method: {'most-common', 'last'}

    Method for choosing a TAC to associate.

Examples

subscriber_tacs = SubscriberTAC('2016-01-01', '2016-01-07')
subscriber_tacs.head()
         subscriber         tac
0  038OVABN11Ak4W5P  18867440.0
1  09NrjaNNvDanD8pk  21572046.0
2  0ayZGYEQrqYlKw6g  81963365.0
3  0DB8zw67E9mZAPK2  92380772.0
4  0Gl95NRLjW2aw8pW  77510543.0
                        .
                        .
                        .

Note

Be aware that when using a imei as a subscriber identifier, than one imei is always associated to a single TAC.

Methods

cache

cache
Source: flowmachine/core/query.py

Returns
  • bool

    True is caching is switched on.

column_names

column_names
Source: flowmachine/features/subscriber/subscriber_tacs.py

Returns the column names.

Returns
  • typing.List[str]

    List of the column names of this query.

column_names_as_string_list

column_names_as_string_list
Source: flowmachine/core/query.py

Get the column names as a comma separated list

Returns
  • str

    Comma separated list of column names

dependencies

dependencies
Source: flowmachine/core/query.py

Returns
  • set

    The set of queries which this one is directly dependent on.

fully_qualified_table_name

fully_qualified_table_name
Source: flowmachine/core/query.py

Returns a unique fully qualified name for the query to be stored as under the cache schema, based on a hash of the parameters, class, and subqueries.

Returns
  • str

    String form of the table's fqn

index_cols

index_cols
Source: flowmachine/core/query.py

A list of columns to use as indexes when storing this query.

Returns
  • ixen: list

    By default, returns the location columns if they are present and self.spatial_unit is defined, and the subscriber column.

Examples
daily_location("2016-01-01").index_cols
[['name'], '"subscriber"']

is_stored

is_stored
Source: flowmachine/core/query.py

Returns
  • bool

    True if the table is stored, and False otherwise.

query_id

query_id
Source: flowmachine/core/query.py

Generate a uniquely identifying hash of this query, based on the parameters of it and the subqueries it is composed of.

Returns
  • str

    query_id hash string

query_state

query_state
Source: flowmachine/core/query.py

Return the current query state.

Returns
  • QueryState

    The current query state

query_state_str

query_state_str
Source: flowmachine/core/query.py

Return the current query state as a string

Returns
  • str

    The current query state. The possible values are the ones defined in flowmachine.core.query_state.QueryState.

table_name

table_name
Source: flowmachine/core/query.py

Returns a uniquename for the query to be stored as, based on a hash of the parameters, class, and subqueries.

Returns
  • str

    String form of the table's fqn

Class SubscriberTACs

SubscriberTACs(start, stop, *, hours='all', table='all', subscriber_subset=None, subscriber_identifier='msisdn')
Source: flowmachine/features/subscriber/subscriber_tacs.py

Class representing all the TACs for which a subscriber has been associated.

Attributes

Parameters

  • start, stop: str

    iso-format start and stop datetimes

  • hours: 2-tuple of floats, default 'all'

    Restrict the analysis to only a certain set of hours within each day.

  • table: str, default 'all'

  • subscriber_identifier: {'msisdn', 'imei'}, default 'msisdn'

    Either msisdn, or imei, the column that identifies the subscriber.

  • subscriber_subset: flowmachine.core.Table, flowmachine.core.Query, list, str, default None

    If provided, string or list of string which are msisdn or imeis to limit results to; or, a query or table which has a column with a name matching subscriber_identifier (typically, msisdn), to limit results to.

Examples

subscriber_tacs = SubscriberTACs('2016-01-01 13:30:30',
                           '2016-01-02 16:25:00')
subscriber_tacs.head()
            subscriber                      time         tac
0     1vGR8kp342yxEpwY 2016-01-01 13:31:06+00:00  85151913.0
1     QPdr2B94VaEzZgoW 2016-01-01 13:31:06+00:00  15314569.0
2     LjDxeZEREElG7m0r 2016-01-01 13:32:21+00:00  92380772.0
                        .
                        .
                        .

Methods

cache

cache
Source: flowmachine/core/query.py

Returns
  • bool

    True is caching is switched on.

column_names

column_names
Source: flowmachine/features/subscriber/subscriber_tacs.py

Returns the column names.

Returns
  • typing.List[str]

    List of the column names of this query.

column_names_as_string_list

column_names_as_string_list
Source: flowmachine/core/query.py

Get the column names as a comma separated list

Returns
  • str

    Comma separated list of column names

dependencies

dependencies
Source: flowmachine/core/query.py

Returns
  • set

    The set of queries which this one is directly dependent on.

fully_qualified_table_name

fully_qualified_table_name
Source: flowmachine/core/query.py

Returns a unique fully qualified name for the query to be stored as under the cache schema, based on a hash of the parameters, class, and subqueries.

Returns
  • str

    String form of the table's fqn

index_cols

index_cols
Source: flowmachine/core/query.py

A list of columns to use as indexes when storing this query.

Returns
  • ixen: list

    By default, returns the location columns if they are present and self.spatial_unit is defined, and the subscriber column.

Examples
daily_location("2016-01-01").index_cols
[['name'], '"subscriber"']

is_stored

is_stored
Source: flowmachine/core/query.py

Returns
  • bool

    True if the table is stored, and False otherwise.

query_id

query_id
Source: flowmachine/core/query.py

Generate a uniquely identifying hash of this query, based on the parameters of it and the subqueries it is composed of.

Returns
  • str

    query_id hash string

query_state

query_state
Source: flowmachine/core/query.py

Return the current query state.

Returns
  • QueryState

    The current query state

query_state_str

query_state_str
Source: flowmachine/core/query.py

Return the current query state as a string

Returns
  • str

    The current query state. The possible values are the ones defined in flowmachine.core.query_state.QueryState.

table_name

table_name
Source: flowmachine/core/query.py

Returns a uniquename for the query to be stored as, based on a hash of the parameters, class, and subqueries.

Returns
  • str

    String form of the table's fqn