Interview questions · Notion
Analyze document collaboration patterns
This question evaluates a candidate's competency in data manipulation and analytics—specifically joins, deduplication of user-document pairs, aggregation, and computation of user- and country-level collaboration metrics using SQL or Python.
You are given two CSV files and asked to analyze collaboration behavior on documents.
File 1: document_activity.csv
Each row is a document view event.
Schema:
page_idSTRING — unique document IDuser_idSTRING — user who viewed the documentviewed_atTIMESTAMP — event timestamp in UTCis_creatorBOOLEAN —trueif the user is the document creator,falseotherwisecollaborator_sourceSTRING NULL — for non-creators, how the user arrived at the document (for example: invite link, email invite, search, direct). This field may beNULLfor creators.
File 2: users.csv
Schema:
user_idSTRING — unique user IDcountrySTRING — user country
Assumptions
- Join key:
document_activity.user_id = users.user_id. - Use the full dataset; do not filter by date.
- A user may view the same document multiple times, so for collaboration questions you should deduplicate to distinct
(page_id, user_id)pairs unless a task explicitly asks for event counts. - A document may have one creator and multiple collaborators.
Tasks
-
Compute the distribution of collaborator acquisition sources.
- Consider only non-creators (
is_creator = false). - Define the metric on distinct collaborator-document pairs
(page_id, user_id). - Required output columns:
collaborator_sourcecollaborator_countcollaborator_share
- Consider only non-creators (
-
Given an input
user_id, find which other users collaborated with that user the most.- Two users are considered to have collaborated if they both appeared on the same
page_idat least once. - Count distinct shared documents, not view events.
- Exclude the target user themself.
- Required output columns:
target_user_idco_user_idshared_page_count
- Return the user or users with the maximum
shared_page_count.
- Two users are considered to have collaborated if they both appeared on the same
-
Find which country's users are most likely to collaborate with others.
- To make the metric precise, define a user as having "collaborated with others" if they appear on at least one document with at least one other distinct user (that is, the document has 2 or more distinct users total).
- For each country, compute:
collaborating_users= number of distinct users in that country who collaborated with at least one other usertotal_users= number of distinct users in that country fromusers.csvcollaboration_rate = collaborating_users / total_users
- Required output columns:
countrycollaborating_userstotal_userscollaboration_rate
- Rank countries from highest to lowest collaboration rate.
Community answers
Nothing here yet.
Join in on CSWork →