cellyzer_logo

Documentation - Cellyzer

 

Documentation - Cellyzer1. Quick Start1.1 Installation1.2 Reading Datasets1.3 Using Functions2. Reference2.1 IOread_callread_msgread_cellto_csvto_json2.2 coreCommon Functions for Call & Message Datasets● Get all the users● Get records of a given user or records between given 2 users● Get connected users● Get connections for a given list of users● Get the connection matrix● Visualize connection network● Get most active time of a given user● Get close contactsFunctions that are specific for Call datasets● Get call records by Antenna-ID● Get ignored call detailsFunctions for antenna(cell) datasets● Get cell records● Get population● Get users around a given cell● Get trip details of a given userFunctions that are specific for a User● Get home location● Get work location2.3 utilsPrinting a list of Record objectsPrinting a Dataset object2.4 visualizationConnection Network GraphActive time - Bar chartPopulation visualization around cellsVisualize home and work locationsVisualize trips of a user

 

1. Quick Start

 

1.1 Installation

Binary installers for the latest released version are available at the Python package index : https://pypi.org/project/cellyzer/. Use the pip package manager to install cellyzer.

After installing Cellyzer it can be used in your project by simply importing it

1.2 Reading Datasets

Cellyzer accepts 3 kinds of datasets as below in the given format.

Adding a call dataset to Cellyzer is as above. read_msg, read_cell can be used to add message and cell datasets respectively. Default file type for the dataset file is csv. Also you can add xlsx and json files.

A dataset object consists of a list of Record objects. A Record object represents a row in the dataset. Accessing the attributes of a Record object gives the values of the fields in that row of the dataset.

1.3 Using Functions

Cellyzer is modeled using object-oriented approach. A dataset you add is kept as an object. Hence you can use your own functions and classes with Cellyzer objects. Also you can access the inbuilt functions for the added dataset objects.

Other than inbuilt functions for dataset objects, Cellyzer gives some helping functions in utils and visualization modules to print, visualize data.

 

 

2. Reference

 

2.1 IO

IO module is to read, write, filter and clean datasets.

read_call
FileTypeCheck_csv_xlsx_json
read_msg
read_cell
filter_call
filter_msg
filter_cell
parse_records
create_call_obj
create_msg_obj
create_cell_obj
...
to_csv
to_json

IO functions can be accessed directly using the name of the import of the Cellyzer library.

Example:

read_call

read_msg

read_cell

to_csv

to_json

 


 

2.2 core

Cellyzer core module consists of all the classes and relevant methods.

RecordCallRecord+ user+ other_user+ direction+ duration+ timestamp+ cell_id+ cost+ getters()MessageRecord+ user+ other_user+ direction+ length+ timestamp+ getters()CellRecord+ cell_id+ latitude+ longitude+ getters()Dataset+ fieldnames []+ records []+ getters()+ setters()+ to_dict()CallMessageDataset+ get_records(user1, user2)+ get_all_users()+ get_connected_users(user)+ print_connection_matrix()+ get_connections(users[])+ visualize_connection_network(directed<bool>, users[])+ get_most_active_time(user)CellDataset+ call_dataset<CallDataset>+ get_cell_records(cell_id)+ get_location(cell_id)+ get_population(cell_id)+ get_unique_users_around_cell(call_records)+ check_user_location_matches_cell(user, cell_id)+ get_trip_details(user, console_print<bool>, tabulate<bool>)CallDataset+ get_close_contacts(user, top_contact<int>)+ get_call_records_by_antenna_id(cell_id)+ get_ignored_call_details(user)MessageDataset+ get_close_contacts(user, top_contact<int>)User+ call_dataset<CallDataset>+ cell_dataset<CellDataset>+ user+ work_start_hour<int>+ work_end_time<int>+ get_user_calldata(calldataset)+ get_ignored_call_details()+ get_home_location()+ get_work_location()

Common Functions for Call & Message Datasets

● Get all the users

Returns a list with all the users available in the dataset

● Get records of a given user or records between given 2 users

If a single user is given, the system outputs all the records where that user is involved. If two users were given, the system returns a list of records where there had been a call/message between those two users.

● Get connected users

Outputs a list of users that are connected to a given user

● Get connections for a given list of users

Returns a list of 2 user lists in the format [user1,user2] where user1 has made a call/message to user2.

● Get the connection matrix

Get a matrix(2D list) with which user is connected to who and the number of calls/messages between them. The matrix is visualized in an HTML page.

● Visualize connection network

Generates a graph with the connections within a given list of users. If the graph is directed the arrow head implies the direction of the call/message. The value near the arrow gives the number of connections made to that direction.

● Get most active time of a given user

Returns a dictionary with the hours in the day as keys and values as number of calls/messages made. Can get the idea of how the user is active with the time.

● Get close contacts

Get the top contacts who have the most number of messages with a given specific user.

 

Functions that are specific for Call datasets

● Get call records by Antenna-ID

Returns all the records related to a given specific cell

● Get ignored call details

Get records of ignored call details of a given user

 

Functions for antenna(cell) datasets

● Get cell records

Returns all the records in the cell dataset

● Get population

Get population around all the cells or around a given cell ID

● Get users around a given cell

Returns all the unique users around a given cell_id

● Get trip details of a given user

Get/print/tabulate trip details of a specific user

 

Functions that are specific for a User

● Get home location

Get the home location of a given user

● Get work location

Get the work location of a given user

 


 

2.3 utils

Printing a list of Record objects

As discussed in the Quick-Start, Cellyzer keeps a dataset as a Dataset object where it contains a list of Record objects. A Record object represents a row in the dataset. In order to print a list of record objects in a readable manner Cellyzer provides a function.

 

Printing a Dataset object

You can have a readable console print of the dataset using the inbuilt function print_dataset. It will print the datasets in a tabulate way. If the dataset is is larger than 50 rows it summarize it with 5 head and 5 tail rows. You can also set the optional parameters head, tail to summarize and tabulate the dataset.

 


 

2.4 visualization

 

Connection Network Graph

Visualize the connections of the given list of user couples in a graph. Nodes are users and Edges are the connections. The arrow head from A to B represent a call/message from user A to B. The edge value near the arrow head represents the number of calls/messages made from A to B.

connection_network

 

Active time - Bar chart

Generates a bar chart of the active time of a given user. X-axis represents the time(hour of the day). Y-axis number of records

active_time

 

Population visualization around cells

Visualize a map with population around cells

pupulation_around_cell_2

 

Visualize home and work locations

Visualize a map of home and work locations

home_work_location

 

Visualize trips of a user

Visualize the trips/routes of a given user in a map. Very useful to get the behavior of the user. Decisions like w here he spent most of the time, where he wend more frequently can be get easily with this map.

trip_visualization