The following table lists the ways we classify a user for reporting purposes. Not all definitions are currently used, but they are included for completeness and to provide a better context for the ones that are used.
Note
When selecting data based on the following definitions, follow the guidelines in the “Fetching data Using the Partition Dates” section of Analytics Reporting Partition Generation Algorithm
Patient Type |
Description |
SQL criteria for Identifying users1 |
---|---|---|
Reporting User |
A PainChek user that is not soft-deleted and was created before the end of the period. NotePainChek reports should only ever include “Reporting Users” - other PainChek users are always excluded. |
deleted_at is null AND created_at < group_end |
Assessing User |
A Reporting User that has performed at least one assessment on a Reporting Patient. |
is [Reporting User] AND EXISTS ( SELECT * FROM assessment WHERE assessment.created_by_id = user.uuid AND assessment_date BETWEEN group_start AND group_end) |
Pending User |
A Reporting User that is yet to activate their account. |
is [Reporting User] AND is_active = TRUE AND password IS NULL |
Active User |
A Reporting User that has activated their account (i.e. they are able to use PainChek). |
is [Reporting User] AND is_active = TRUE AND password IS NOT NULL |
Deactivated User |
A Reporting User that is currently inactive. NB: Pending Users + Active Users + Archived Users = Reporting Users |
is [Reporting User] AND is_active = FALSE |
Created in Period User |
A Reporting User that was created within the reporting group |
is [Reporting User] AND created_at BETWEEN group_start AND group_end |
Deactivated in Period User |
A Reporting Patient that was archived within the reporting group. Note that a user can be both “Created in Period” and “Archived in Period” See note 2. |
is [Deactivated User] AND modified_at BETWEEN group_start AND group_end |
Created in Prior Period User |
A Reporting User that was created before the start of the reporting group NB: Created in Period Users + Created in Prior Period Users = Reporting Users |
is [Reporting User] AND created_at < group_start |
Deactivated in Prior Period Patient |
A deactivated user that was archived before the start of the reporting group. See note 2. NB: Deactivated in Period Users + Deactivated in Prior Period Users = Deactivated Users |
is [Deactivated User] AND modified_at < group_start |
Note
-
The filter is assumed to apply account_user records unless a table name is explicitly stated. “user” is used as an alias for the account_user table and “assessment” is used as an alias for the assessment_assessment table
-
We use the “last modified” value for the user as a proxy to determine when they were deactivated (assuming that
is_active = FALSE
). This might not be entirely accurate as conceivable a user could be updated post being deactivated.