Skip to main content

User class that defines a user based on clickstream data.

Project description

vaknl-user

Defines the vaknl User class. A user (here identified by a dmp_user_id) is a object that is defined by website clickstream data as a basis. The User class contains functions that can transform raw Firestore website clickstream data to well defined Event dataclasses. These Event dataclasses are read and translated into user information. The User class also includes functions to write the user to Firestore.

Prerequisites

Firestore read and write permissions within the Google Cloud Platform (GCP), if one wants to make use of the Firestore functionality.

User

class User

User class where user object is identified by dmp_user_id user.

create_event(clickstream_event_json) @staticmethod

Assigns event to a (event-)dataclass based on event clickstream json.

update_funnel_step(statistics, event) @staticmethod

Updates the funnel step the user is in.

update_statistics(event)

Update user statistics with event.

add_event(clickstream_event_json)

Adds event to user based on clickstream json and updates statistics.

add_multiple_events(clickstream_event_json_list)

Adds multiple events to event_list at a time.

sort_events_by_timestamp()

Sort self.events (event list) ascending on timestamp.

events_to_dict()

Outputs list of event dicts (decoded from the list of event dataclasses).

to_firestore()

Writes user to firestore.

create_user_from_clickstream()

Gets all available website clickstream data from Firestore for the given dmp_user_id and fills the User class with information.

General script functions

Mostly functions that allow the user of this package to manually set private variables in this module.

set_project_id(name: str)

Set global private variable __project_id, which represents the GCP project id. When function is called, it also automatically updates the firestore client.

set_firestore_collection_source(name: str)

Set global private variable __firestore_collection_source, which should be the name of the Firestore source collection, from which the website clickstream data is gathered.

set_firestore_collection_destination(name: str)

Set global private variable __firestore_collection_destination, which should be the name of the Firestore destination collection to which the user is written.

create_firestore_client(project_id: str)

Sets up Firestore client.

Event

Contains Event dataclass and all sub-dataclasses that can go multiple layers deep.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vaknl-user-1.0.0.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vaknl_user-1.0.0-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file vaknl-user-1.0.0.tar.gz.

File metadata

  • Download URL: vaknl-user-1.0.0.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9

File hashes

Hashes for vaknl-user-1.0.0.tar.gz
Algorithm Hash digest
SHA256 f14e6a3fa6e99d5ef1ef1fa96d8adb411eef7d202486b42e841ea5e3469428ac
MD5 55bbd14cb3304c94b8bf018477385afd
BLAKE2b-256 66d0b29f6e44c5ac71267220d471d272dbd6499c1c11ce01358d2532b32a97dc

See more details on using hashes here.

File details

Details for the file vaknl_user-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: vaknl_user-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9

File hashes

Hashes for vaknl_user-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ffcf1e81fed6ccaed2b6bb0560f15cd1b600db3bbbd732952fedc9c5ae1a720a
MD5 b51a85adabf28bff15c65f23886aaa24
BLAKE2b-256 7bfc5bc2594156db951bd5abcfd96d17e5b2fbdee3e4d7bfaf54b58b31523056

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page