Database Models
The database models of PPC Robot are defined in both ppc_robot_lib
and ppc_robot_web
packages.
ppc_robot_lib
contains models that are used by all components of the application: jobs, user accounts, notifications
and so on. ppc_robot_web
contains only models that are specific to the web application: subscriptions and invites.
The following document will describe the most important models.
Jobs and Job Definitions

All Jobs are stored in the robot_jobs
table. This table stores job name, scheduling parameters,
output path and links the job to user and his accounts. The job parameters itself (e.g. metrics that should be included
in the report) are stored in the robot_job_definitions
table with N:1 relation. This enables multiple jobs
to share single set of parameters that are changed simultaneously.
Each job is stored in a folder: robot_folders
table. User can create his own structure, the folder tree is
represented by a closure table. Job can be also associated with zero or more tags: `robot_tags
table, with
robot_jobs_tags
as the join table.
User Accounts

Each user has one or more Service Accounts (robot_service_accounts
).
Each service account has a set of credentials that are used to access the service – they are stored as JSON
and usually contains refresh token for the given platform (or login token in case of Sklik).
Each service account has zero or more Client Accounts (robot_client_accounts
). These are
the accounts that are used to retrieve the performance metrics. Any client account can also have zero or more tags
(robot_client_account_tags
) joined using the join table robot_client_accounts_tags
.
Notifications

Structure of notification and the flow that is used to deliver the notification is described in more detail in Notification Design.