We are designing a knowledge graph to represent developer productivity signals. The graph should support:
- Coaching insights: to help identify areas for improvement and growth.
- Experiment design: to test interventions and measure their impact.
- Accountability dashboards: to track progress and outcomes.
We need to define:
- Entities (nodes) and their properties.
- Relationships (edges) between entities.
- Possibly, the types of signals (metrics) that we are capturing.
Key entities might include:
- Developer (person)
- Team
- Project
- Task/Issue/PR (work items)
- Metric/Signal (a measurable quantity)
- Experiment (if we are running experiments)
- Goal/Target (for accountability)
- CoachingSession (if we are tracking coaching)
- Intervention (something we do to try to improve productivity)
Relationships:
- Developer works_on Team
- Team works_on Project
- Developer assigned_to Task
- Task belongs_to Project
- Task has_metric (e.g., cycle time, lines of code, number of PR reviews, etc.)
- Developer generates_metric (for individual metrics)
- Team generates_metric (for team-level metrics)
- Project generates_metric (for project-level metrics)
- Experiment targets_metric (the metric we are trying to change)
- Experiment applies_intervention (what we are doing)
- Experiment has_participant (Developer or Team)
- Goal is_about_metric (the metric we want to improve)
- Goal has_target (a specific value or range)
- Developer has_goal (individual goal)
- Team has_goal (team goal)
- CoachingSession involves Developer (and maybe a coach)
- CoachingSession discusses_metric (or discusses_task, etc.)
- Intervention is_part_of_experiment (or experiment uses_intervention)
We also need to consider the time dimension: metrics are measured over time, experiments have start and end dates, goals have timeframes.
Let's structure the graph with the following node types:
-
Developer
- properties: id, name, email, role, etc.
-
Team
- properties: id, name, description, etc.
-
Project
- properties: id, name, description, start_date, end_date, etc.
-
Task (or WorkItem)
- properties: id, type (bug, feature, chore, etc.), title, description, status, created_at, updated_at, closed_at, etc.
- relationships: belongs_to Project, assigned_to Developer, part_of Team (via project or directly?), has_parent (for subtasks)
-
Metric
- properties: id, name, description, unit (e.g., hours, count, percentage), calculation_method (how it's derived from raw data)
- relationships: measured_on (could be on Task, Developer, Team, Project) -> we need a way to link a metric value to the entity it measures and the time period.
-
MetricValue (to capture the actual measurement over time)
- properties: id, metric_id (or link to Metric node), entity_id (the entity being measured, e.g., developer, team, etc.), entity_type, value, timestamp, period (e.g., daily, weekly, per task, etc.)
- Note: Alternatively, we could have the metric value as a property of a relationship? But since we want to track over time, having a separate node for each measurement might be better.
-
Experiment
- properties: id, name, description, start_date, end_date, status (planned, ongoing, completed), hypothesis, result_summary
- relationships: targets_metric (the primary metric we are trying to change), applies_intervention, has_participant (Developer or Team), based_on (could be linked to a CoachingSession or Insight that prompted it)
-
Intervention
- properties: id, name, description, type (training, tooling change, process change, etc.)
- relationships: part_of_experiment (or experiment uses_intervention)
-
Goal
- properties: id, name, description, target_value, operator (>, <, =, etc.), timeframe (start_date, end_date), status (active, achieved, missed)
- relationships: is_about_metric, belongs_to Developer or Team or Project
-
CoachingSession
- properties: id, date, duration, notes, coach (could be a person, maybe another developer or manager)
- relationships: involves Developer (the coachee), discusses_metric, discusses_task, leads_to_goal (or creates_goal), leads_to_intervention (if a coaching session results in an intervention)
-
Insight (could be an automated insight generated from the data, or a human insight)
- properties: id, description, generated_at, source (algorithm, human), confidence
- relationships: about_metric, about_developer, about_team, triggers_experiment (if we design an experiment based on it)
-
AccountableParty (could be Developer or Team) for a Goal? But we already have relationships from Goal to Developer/Team.
We might also want to capture the raw data sources, but that might be too low-level. We are focusing on signals (metrics) and their use.
Now, for the knowledge graph, we need to define the schema (nodes and edges) and also how we query it.
Let's list the node labels and their properties:
Node Labels:
-
Developer
- id (string, primary key)
- name (string)
- email (string)
- role (string)
- hire_date (date)
- etc.
-
Team
- id (string)
- name (string)
- description (string)
-
Project
- id (string)
- name (string)
- description (string)
- start_date (date)
- end_date (date) (optional)
-
Task
- id (string)
- type (string: 'issue', 'pull_request', 'commit', etc.)
- title (string)
- description (string)
- status (string: 'open', 'in_progress', 'resolved', 'closed', etc.)
- created_at (datetime)
- updated_at (datetime)
- closed_at (datetime) (optional)
- url (string) (link to the task in the tracker)
-
Metric
- id (string)
- name (string) (e.g., 'Cycle Time', 'Pull Request Review Time', 'Lines of Code per Day')
- description (string)
- unit (string) (e.g., 'hours', 'days', 'count', 'percentage')
- calculation_method (string) (e.g., 'time between status changes', 'count of lines added', etc.)
- category (string) (e.g., 'efficiency', 'quality', 'collaboration')
-
MetricValue
- id (string)
- metric_id (string) -> references Metric.id
- entity_type (string: 'Developer', 'Team', 'Project', 'Task')
- entity_id (string) -> references the id of the entity
- value (float)
- timestamp (datetime) (when the measurement was taken or the period end)
- period_start (datetime) (optional, if the metric is for a period)
- period_end (datetime) (optional)
- period (string) (e.g., 'daily', 'weekly', 'per_task')
Note: We could also have a relationship instead of entity_type and entity_id, but using generic properties might be easier for some graph databases. Alternatively, we can have separate relationships: (developer)-[HAS_METRIC_VALUE]->(metric_value) but then we need multiple node types for metric values? We can have one node type for MetricValue and then connect it to the entity via a relationship. But then we have to define relationships for each entity type. Let's do:
(Developer)-[:HAS_METRIC {value: 10, timestamp: ...}]->(Metric)
But that would not allow multiple measurements over time for the same metric on the same developer if we want to store history. We could create multiple relationships with different timestamps, but then we lose the ability to have properties on the relationship that are time-stamped and also we can't easily query the history. Alternatively, we can have a MetricValue node and connect it to the entity and the metric.
Now relationships:
-
Team membership:
(Developer)-[:MEMBER_OF]->(Team)
(Team)-[:WORKS_ON]->(Project)
-
Task assignment and ownership:
(Developer)-[:ASSIGNED_TO]->(Task)
(Task)-[:BELONGS_TO]->(Project)
(Task)-[:PART_OF_TEAM]->(Team) // optional, can be derived from project, but might be direct if team is not tied to project? We can derive from project's team, but if a task is not in a project? Maybe all tasks belong to a project. Alternatively, we can have (Task)-[:IN_Sprint]->(Sprint) but that's another entity. Let's keep it simple: task belongs to project, and project belongs to team.
Alternatively, we can have (Task)-[:ASSIGNED_TO_TEAM]->(Team) but that might be redundant.
-
Metrics:
(MetricValue)-[:FOR_ENTITY]->(Developer) // but we want to link to any entity. Instead, we can have:
(MetricValue)-[:MEASURES]->(Metric)
And then connect MetricValue to the entity it is about via:
(Developer)-[:HAS_METRIC_VALUE]->(MetricValue)
(Team)-[:HAS_METRIC_VALUE]->(MetricValue)
(Project)-[:HAS_METRIC_VALUE]->(MetricValue)
(Task)-[:HAS_METRIC_VALUE]->(MetricValue)
But that would require four different relationship types. Alternatively, we can have a generic relationship:
(Entity)-[:HAS_METRIC_VALUE]->(MetricValue)
where Entity can be Developer, Team, Project, Task. This is possible in labeled property graphs if we allow any node to have that relationship. But then we lose the ability to enforce that only certain node types can have that relationship? Not a big issue.
Let's use:
(Entity)-[:HAS_METRIC_VALUE]->(MetricValue)
and (MetricValue)-[:OF_METRIC]->(Metric)
-
Experiment relationships:
(Experiment)-[:TARGETS_METRIC]->(Metric)
(Experiment)-[:USES_INTERVENTION]->(Intervention)
(Experiment)-[:HAS_PARTICIPANT]->(Developer) or (Team) -> we can have two relationship types, or a generic one:
(Experiment)-[:INVOLVES]->(Developer)
(Experiment)-[:INVOLVES_TEAM]->(Team)
But we might want to know which participants are in the control group vs treatment? Then we need more structure. We can have a Participation node that captures group assignment and other details.
Alternatively, we can have:
(Experiment)-[:HAS_GROUP]->(Group) where Group has a label (control, treatment) and then (Group)-[:CONTAINS]->(Developer) and (Group)-[:CONTAINS_TEAM]->(Team). But that complicates.
Simpler: have a property on the relationship between Experiment and Developer: group: 'control' or 'treatment'. And similarly for Team.
So:
(Developer)-[:PARTICIPATES_IN {group: 'control'}]->(Experiment)
(Team)-[:PARTICIPATES_IN {group: 'control'}]->(Experiment)
But then we are connecting from the participant to the experiment, or from experiment to participant? We want to query: which developers are in which experiment? Either way.
Let's do:
(Experiment)-[:HAS_PARTICIPANT {entity_type: 'Developer', entity_id: ...}]->(Developer) but that's not a direct relationship.
Better: direct relationships:
(Experiment)-[:HAS_DEVELOPER_PARTICIPANT {group: 'treatment'}]->(Developer)
(Experiment)-[:HAS_TEAM_PARTICIPANT {group: 'control'}]->(Team)
We might also want to link tasks to metrics directly? But we have MetricValue nodes that are about tasks, developers, etc.
Now, we need to consider that the same metric might be calculated for different entities and over time. So the MetricValue node is central.
Example: For a developer, we might have daily cycle time (average time to close tasks) for the last 30 days. Each day we have a MetricValue for that developer and the 'Cycle Time' metric.
We also want to be able to calculate derived metrics? That can be done by the calculation_method in Metric, but the actual values are stored in MetricValue.
Now, for experiment design, we might want to compare the metric values before and after an intervention, between control and treatment groups. So we need to be able to query:
- For a given experiment, get the participants and their metric values for the target metric over time (before, during, after).
- Compare the change in metric between groups.
For coaching insights, we might want to see a developer's metrics over time, their goals, and coaching sessions.
For accountability dashboards, we might want to see goal progress (current metric value vs target) for developers, teams, projects.
We might also want to track the impact of interventions on metrics, and then link that to coaching sessions.
This schema seems comprehensive but might be a bit heavy. We can start with a subset and expand.
Let's try to write out a simple example in Cypher (Neo4j) to see if the schema works.
Example nodes:
CREATE (d1:Developer {id: 'd1', name: 'Alice'})
CREATE (t1:Team {id: 't1', name: 'Team Alpha'})
CREATE (p1:Project {id: 'p1', name: 'Project X', start_date: date('2023-01-01')})
CREATE (ts1:Task {id: 'ts1', type: 'pull_request', title: 'Add login feature', status: 'closed', created_at: datetime('2023-01-02'), closed_at: datetime('2023-01-05')})
CREATE (m1:Metric {id: 'm1', name: 'Cycle Time', unit: 'hours', calculation_method: 'time from created to closed'})
CREATE (mv1:MetricValue {id: 'mv1', value: 72, timestamp: datetime('2023-01-05'), period_start: datetime('2023-01-02'), period_end: datetime('2023-01-05')})
CREATE (mv1)-[:OF_METRIC]->(m1)
CREATE (d1)-[:HAS_METRIC_VALUE]->(mv1)
CREATE (ts1)-[:HAS_METRIC_VALUE]->(mv1) // the cycle time is for this task? Actually, cycle time per task is a metric on the task. But we also might want average cycle time for a developer over a period. So we might have multiple MetricValue nodes for the same metric but different entities.
Alternatively, we might have:
- For each task, we compute its cycle time and store it as a MetricValue for that task.
- Then for a developer, we compute the average cycle time of their closed tasks in a period, and store that as a MetricValue for the developer.
So we can have:
(ts1)-[:HAS_METRIC_VALUE]->(mv_task_cycle) where mv_task_cycle.value = 72, and it's for metric 'Cycle Time' and entity is the task.
Then for developer d1, we might have a weekly average:
(mv_dev_cycle)-[:OF_METRIC]->(m1)
(d1)-[:HAS_METRIC_VALUE]->(mv_dev_cycle)
and mv_dev_cycle.value = (average of cycle times of tasks closed by d1 in that week)
So the same metric can be measured at different granularities.
Now, for experiments:
CREATE (exp1:Experiment {id: 'exp1', name: 'Code Review Improvement', start_date: date('2023-02-01'), end_date: date('2023-02-28'), status: 'completed'})
CREATE (int1:Intervention {id: 'int1', name: ' mandates 24h review time', type: 'process'})
CREATE (exp1)-[:TARGETS_METRIC]->(m1) // maybe target 'Cycle Time' but actually we want to reduce cycle time? Or maybe target 'Review Time' separately? We might have a separate metric for review time.
CREATE (exp1)-[:USES_INTERVENTION]->(int1)
CREATE (d1)-[:PARTICIPATES_IN {group: 'treatment'}]->(exp1)
But then we want to measure the effect on cycle time. We can query the MetricValues for d1 for metric m1 before and after.
We also need to capture the hypothesis and result.
For goals:
CREATE (goal1:Goal {id: 'g1', name: 'Reduce cycle time', target_value: 48, operator: '<', start_date: date('2023-03-01'), end_date: date('2023-03-31'), status: 'active'})
CREATE (d1)-[:HAS_GOAL]->(goal1)
CREATE (goal1)-[:ABOUT_METRIC]->(m1)
Then we can check the latest MetricValue for d1 and m1 to see if it meets the goal.
For coaching:
CREATE (cs1:CoachingSession {id: 'cs1', date: datetime('2023-01-10'), duration: 60, notes: 'Discussed slow cycle time'})
CREATE (d1)-[:IN_COACHING_SESSION]->(cs1) // or (cs1)-[:INVOLVES]->(d1)
CREATE (cs1)-[:DISCUSSES_METRIC]->(m1)
CREATE (cs1)-[:LEADS_TO_GOAL]->(goal1)
This seems to cover the basics.
Now, we might also want to capture the relationship between tasks and projects, teams, and developers more richly.
We have:
(d1)-[:ASSIGNED_TO]->(ts1)
(ts1)-[:BELONGS_TO]->(p1)
(p1)-[:WORKED_ON_BY]->(t1) // or (t1)-[:WORKS_ON]->(p1)
(d1)-[:MEMBER_OF]->(t1)
So we can traverse from task to project to team, and to developer.
We might also want to capture the code changes (commits) and link them to tasks? That might be too detailed. We can have a separate entity for Commit and link to Task and Developer.
But let's not overcomplicate. The above should be enough for productivity signals.
Now, to power coaching insights, we might want to run queries like:
- For a developer, get their metrics over time, their goals, and coaching sessions.
- Identify developers who are consistently below team average on a metric.
- Find correlations between interventions and metric changes.
For experiment design:
- Find similar developers (by metrics) to assign to control and treatment.
- Analyze the effect of an intervention by comparing pre-post changes in the target metric between groups.
For accountability dashboards:
- Show goal progress for each developer/team.
- Show current values of key metrics and trends.
We might also want to capture the definition of metrics (how they are calculated) so that we can consistently compute them. The Metric node has calculation_method, but we might need to store the actual code or formula? That might be outside the graph. But at least we can store a description.
We might also want to track the data source (e.g., Jira, GitHub) and the freshness of the data. That could be in a separate node or as properties on MetricValue.
Given the complexity, we might start with a simpler schema and then extend.
Simplified schema:
Nodes:
- Developer
- Team
- Project
- Task
- Metric
- MetricValue
- Experiment
- Intervention
- Goal
- CoachingSession
Relationships:
- (Developer)-[:MEMBER_OF]->(Team)
- (Team)-[:WORKS_ON]->(Project)
- (Developer)-[:ASSIGNED_TO]->(Task)
- (Task)-[:BELONGS_TO]->(Project)
- (Developer)-[:HAS_METRIC_VALUE]->(MetricValue)
- (Team)-[:HAS_METRIC_VALUE]->(MetricValue)
- (Project)-[:HAS_METRIC_VALUE]->(MetricValue)
- (Task)-[:HAS_METRIC_VALUE]->(MetricValue)
- (MetricValue)-[:OF_METRIC]->(Metric)
- (Experiment)-[:TARGETS_METRIC]->(Metric)
- (Experiment)-[:USES_INTERVENTION]->(Intervention)
- (Developer)-[:PARTICIPATES_IN {group: 'treatment'}]->(Experiment)
- (Team)-[:PARTICIPATES_IN {group: 'control'}]->(Experiment)
- (Developer)-[:HAS_GOAL]->(Goal)
- (Team)-[:HAS_GOAL]->(Goal)
- (Goal)-[:ABOUT_METRIC]->(Metric)
- (CoachingSession)-[:INVOLVES]->(Developer)
- (CoachingSession)-[:FACILITATED_BY]->(Developer) // optional
- (CoachingSession)-[:DISCUSSES_METRIC]->(Metric)
- (CoachingSession)-[:DISCUSSES_TASK]->(Task)
- (CoachingSession)-[:LEADS_TO_GOAL]->(Goal)
- (CoachingSession)-[:LEADS_TO_INTERVENTION]->(Intervention)
- (Insight)-[:ABOUT_DEVELOPER]->(Developer)
- (Insight)-[:ABOUT_TEAM]->(Team)
- (Insight)-[:ABOUT_METRIC]->(Metric)
- (Insight)-[:TRIGGERS_EXPERIMENT]->(Experiment)
- (Insight)-[:TRIGGERS_COACHING_SESSION]->(CoachingSession)
- (Intervention)-[:RESULT_OF_COACHING]->(CoachingSession) // optional
- (Intervention)-[:PART_OF_EXPERIMENT]->(Experiment) // if not already via EXPERIMENT-USES_INTERVENTION? We have both directions.
We have both (Experiment)-[:USES_INTERVENTION]->(Intervention) and (Intervention)-[:PART_OF_EXPERIMENT]->(Experiment). That's redundant. We can pick one. Let's keep (Experiment)-[:USES_INTERVENTION]->(Intervention) and also (Intervention)-[:RESULT_OF_COACHING]->(CoachingSession) if it comes from coaching. But an intervention might be used in multiple experiments? Possibly. So we might want to keep both directions? Not necessary. We can just have (Experiment)-[:USES_INTERVENTION]->(Intervention) and then (Intervention)-[:SOURCE_FROM_COACHING]->(CoachingSession) or something.
Alternatively, we can have:
(Experiment)-[:HAS_INTERVENTION]->(Intervention)
and (Intervention)-[:CAUSED_BY]->(CoachingSession) or (Insight). But then we lose the experiment link? We can have multiple causes.
Let's simplify: every intervention is either part of an experiment or from coaching? It could be both. So we can have:
(Intervention)-[:USED_IN_EXPERIMENT]->(Experiment)
(Intervention)-[:SUGGESTED_BY_COACHING_SESSION]->(CoachingSession)
(Intervention)-[:SUGGESTED_BY_INSIGHT]->(Insight)
But then we have to create an Intervention node even for ad-hoc interventions not part of an experiment? Possibly.
Alternatively, we can have:
(Experiment)-[:HAS_INTERVENTION]->(Intervention)
and then (CoachingSession)-[:RECOMMENDS_INTERVENTION]->(Intervention)
and (Insight)-[:RECOMMENDS_INTERVENTION]->(Intervention)
That might be better.
So:
(CoachingSession)-[:RECOMMENDS_INTERVENTION]->(Intervention)
(Insight)-[:RECOMMENDS_INTERVENTION]->(Intervention)
And then (Experiment)-[:HAS_INTERVENTION]->(Intervention) to note that the experiment is testing that intervention.
Now, we have a way to trace interventions back to their source.
We also might want to track the outcome of an experiment: did the metric improve? We can store that in the Experiment node as result_summary, but also we might want to link the experiment to the MetricValue before and after? That might be too detailed. We can compute on the fly.
Given the scope, this schema should be a good starting point.
Now, we need to output this as a knowledge graph representation. Since we are not actually building a graph database, we can describe it in a formal way, perhaps using a diagram notation or a textual description.
We can use a format like:
Node Types:
- Developer: id, name, email, role, hire_date
- Team: id, name, description
- Project: id, name, description, start_date, end_date
- Task: id, type, title, description, status, created_at, updated_at, closed_at, url
- Metric: id, name, description, unit, calculation_method, category
- MetricValue: id, metric_id, entity_type, entity_id, value, timestamp, period_start, period_end, period
- Experiment: id, name, description, start_date, end_date, status, hypothesis, result_summary
- Intervention: id, name, description, type
- Goal: id, name, description, target_value, operator, start_date, end_date, status
- CoachingSession: id, date, duration, notes, coach_id
- Insight: id, description, generated_at, source, confidence
But note: In the MetricValue node, we have metric_id and entity_type, entity_id. If we use relationships to link to Metric and the entity, we don't need metric_id and entity_id as properties. We can have:
- MetricValue: id, value, timestamp, period_start, period_end, period
And then relationships:
- (MetricValue)-[:OF_METRIC]->(Metric)
- (Entity)-[:HAS_METRIC_VALUE]->(MetricValue)
That is cleaner. So we adjust.
Similarly, for Goal, we don't need to store metric_id as property if we have [:ABOUT_METRIC] relationship.
For CoachingSession, coach_id is a reference to Developer.id, but we can also have a relationship [:FACILITATED_BY]->(Developer). So we can remove coach_id property and use relationship.
Let's refactor:
Node Types (with properties only, relationships separate):
- Developer: id, name, email, role, hire_date
- Team: id, name, description
- Project: id, name, description, start_date, end_date
- Task: id, type, title, description, status, created_at, updated_at, closed_at, url
- Metric: id, name, description, unit, calculation_method, category
- MetricValue: id, value, timestamp, period_start, period_end, period
- Experiment: id, name, description, start_date, end_date, status, hypothesis, result_summary
- Intervention: id, name, description, type
- Goal: id, name, description, target_value, operator, start_date, end_date, status
- CoachingSession: id, date, duration, notes
- Insight: id, description, generated_at, source, confidence
Relationships:
-
Membership and assignment:
(Developer)-[:MEMBER_OF]->(Team)
(Team)-[:WORKS_ON]->(Project)
(Developer)-[:ASSIGNED_TO]->(Task)
(Task)-[:BELONGS_TO]->(Project)
-
Metric values:
(Developer)-[:HAS_METRIC_VALUE]->(MetricValue)
(Team)-[:HAS_METRIC_VALUE]->(MetricValue)
(Project)-[:HAS_METRIC_VALUE]->(MetricValue)
(Task)-[:HAS_METRIC_VALUE]->(MetricValue)
(MetricValue)-[:OF_METRIC]->(Metric)
-
Experiments:
(Experiment)-[:TARGETS_METRIC]->(Metric)
(Experiment)-[:HAS_INTERVENTION]->(Intervention)
(Developer)-[:PARTICIPATES_IN {group: 'treatment'}]->(Experiment)
(Team)-[:PARTICIPATES_IN {group: 'control'}]->(Experiment)
-
Goals:
(Developer)-[:HAS_GOAL]->(Goal)
(Team)-[:HAS_GOAL]->(Goal)
(Project)-[:HAS_GOAL]->(Goal) // optional, but we include for completeness.
(Goal)-[:ABOUT_METRIC]->(Metric)
-
Coaching:
(CoachingSession)-[:INVOLVES]->(Developer) // the coachee
(CoachingSession)-[:FACILITATED_BY]->(Developer) // the coach, optional
(CoachingSession)-[:DISCUSSES_METRIC]->(Metric)
(CoachingSession)-[:DISCUSSES_TASK]->(Task)
(CoachingSession)-[:LEADS_TO_GOAL]->(Goal)
(CoachingSession)-[:RECOMMENDS_INTERVENTION]->(Intervention)
-
Insights:
(Insight)-[:ABOUT_DEVELOPER]->(Developer)
(Insight)-[:ABOUT_TEAM]->(Team)
(Insight)-[:ABOUT_METRIC]->(Metric)
(Insight)-[:TRIGGERS_EXPERIMENT]->(Experiment)
(Insight)-[:TRIGGERS_COACHING_SESSION]->(CoachingSession)
(Insight)-[:RECOMMENDS_INTERVENTION]->(Intervention)
-
Intervention sources:
(Intervention)-[:USED_IN_EXPERIMENT]->(Experiment) // if we want to go from intervention to experiment. But we already have Experiment->Intervention. We might not need both.
We'll keep only Experiment->Intervention and CoachingSession->Intervention and Insight->Intervention.
-
Additional: We might want to link a Task to the experiment if the task is part of an experiment? That could be done via the developer's participation? If a developer is in an experiment, then all their tasks during the experiment period are considered part of the experiment? Not necessarily, because the experiment might only apply to certain tasks. We can have:
(Task)-[:PART_OF_EXPERIMENT]->(Experiment)
But then we need to assign tasks to experiments. Alternatively, we can infer from the developer's participation and the task's dates. But to be precise, we might want to explicitly assign tasks to experiments if the intervention applies to specific tasks (e.g., tasks of a certain type). So we can add:
(Task)-[:IN_EXPERIMENT]->(Experiment)
But that might be too many relationships. We can start without and see.
Given the complexity, we might want to keep the schema as is and then adjust as needed.
Now, we should also consider indexing and performance. But that's implementation-specific.
This knowledge graph can be used to answer questions like:
- What are the current cycle times for each developer on the team? (query MetricValue for metric 'Cycle Time' for each developer, latest timestamp)
- Which developers have not met their goals? (join Goal and MetricValue for the about metric, compare value vs target)
- What coaching sessions has a developer had, and what interventions were recommended?
- For a given experiment, what was the change in the target metric for the treatment group vs control group? (get MetricValue for participants before and after, compare averages)
- What insights have been generated about a particular metric, and did they lead to experiments or coaching?
We might also want to calculate derived metrics on the fly, but if we precompute and store in MetricValue, it's easier.
We should also consider that MetricValue might be aggregated (e.g., weekly average) or per task. We have a 'period' property to indicate the aggregation period.
Now, let's produce a final answer that describes this knowledge graph in a clear, structured way. We'll list node types with their properties and relationship types with their meanings.
We'll also note that we are using a property graph model where relationships are first-class citizens.
We might also want to include constraints: e.g., MetricValue must have exactly one OF_METRIC and one HAS_METRIC_VALUE from an entity. But that's for implementation.
Let's write the answer.
Developer Productivity Knowledge Graph Schema
This knowledge graph models developer productivity signals to enable coaching insights, experiment design, and accountability dashboards. The schema uses a labeled property graph structure with 11 node types and 20+ relationship types.
Node Types
1. Developer
Represents individual contributors.
id (string, PK)
name (string)
email (string)
role (string)
hire_date (date)
- Other attributes: level, location, etc.
2. Team
A group of developers working together.
id (string, PK)
name (string)
description (string)
3. Project
A product or initiative with a timeline.
id (string, PK)
name (string)
description (string)
start_date (date)
end_date (date, optional)
4. Task
A unit of work (issue, PR, commit, etc.).
id (string, PK)
type (string: issue, pull_request, commit, chore, etc.)
title (string)
description (string)
status (string: open, in_progress, resolved, closed, etc.)
created_at (datetime)
updated_at (datetime)
closed_at (datetime, optional)
url (string, link to tracker)
5. Metric
Definition of a productivity signal.
id (string, PK)
name (string, e.g., Cycle Time, PR Review Time, LoC/Day)
description (string)
unit (string: hours, days, count, percentage)
calculation_method (string, formula or algorithm)
category (string: efficiency, quality, collaboration, sustainability)
6. MetricValue
A measured value of a metric for a specific entity and time period.
id (string, PK)
value (float)
timestamp (datetime, when measured or period end)
period_start (datetime, optional)
period_end (datetime, optional)
period (string: daily, weekly, per_task, monthly)
7. Experiment
A controlled test of an intervention.
id (string, PK)
name (string)
description (string)
start_date (date)
end_date (date)
status (string: planned, ongoing, completed, cancelled)
hypothesis (string)
result_summary (string, optional)
8. Intervention
An action applied to improve productivity.
id (string, PK)
name (string)
description (string)
type (string: training, tooling, process, policy, coaching)
9. Goal
A target for a metric over a time frame.
id (string, PK)
name (string)
description (string)
target_value (float)
operator (string: >, <, >=, <=, ==)
start_date (date)
end_date (date)
status (string: active, achieved, missed, abandoned)
10. CoachingSession
A meeting focused on development.
id (string, PK)
date (datetime)
duration (integer, minutes)
notes (string)
11. Insight
An observation derived from data or human analysis.
id (string, PK)
description (string)
generated_at (datetime)
source (string: algorithm, human)
confidence (float, 0–1)
Relationship Types
Structural Relationships
(Developer)-[:MEMBER_OF]->(Team)
(Team)-[:WORKS_ON]->(Project)
(Developer)-[:ASSIGNED_TO]->(Task)
(Task)-[:BELONGS_TO]->(Project)
(Task)-[:IN_EXPERIMENT]->(Experiment) (optional, if experiment applies to specific tasks)
Metric Relationships
(Entity)-[:HAS_METRIC_VALUE]->(MetricValue)
Where Entity ∈ {Developer, Team, Project, Task}
(MetricValue)-[:OF_METRIC]->(Metric)
Experiment Relationships
(Experiment)-[:TARGETS_METRIC]->(Metric)
(Experiment)-[:HAS_INTERVENTION]->(Intervention)
(Developer)-[:PARTICIPATES_IN {group: 'treatment'}]->(Experiment)
(Developer)-[:PARTICIPATES_IN {group: 'control'}]->(Experiment)
(Team)-[:PARTICIPATES_IN {group: 'treatment'}]->(Experiment)
(Team)-[:PARTICIPATES_IN {group: 'control'}]->(Experiment)
Goal Relationships
(Entity)-[:HAS_GOAL]->(Goal)
Where Entity ∈ {Developer, Team, Project}
(Goal)-[:ABOUT_METRIC]->(Metric)
Coaching Relationships
(CoachingSession)-[:INVOLVES]->(Developer) (coachee)
(CoachingSession)-[:FACILITATED_BY]->(Developer) (coach, optional)
(CoachingSession)-[:DISCUSSES_METRIC]->(Metric)
(CoachingSession)-[:DISCUSSES_TASK]->(Task)
(CoachingSession)-[:LEADS_TO_GOAL]->(Goal)
(CoachingSession)-[:RECOMMENDS_INTERVENTION]->(Intervention)
Insight Relationships
(Insight)-[:ABOUT_DEVELOPER]->(Developer)
(Insight)-[:ABOUT_TEAM]->(Team)
(Insight)-[:ABOUT_METRIC]->(Metric)
(Insight)-[:TRIGGERS_EXPERIMENT]->(Experiment)
(Insight)-[:TRIGGERS_COACHING_SESSION]->(CoachingSession)
(Insight)-[:RECOMMENDS_INTERVENTION]->(Intervention)
Key Design Notes
- Temporal Tracking:
MetricValue nodes capture metric observations over time, enabling trend analysis and pre/post comparisons.
- Flexible Granularity: Metrics can be attached to any entity (Developer, Team, Project, Task), supporting different aggregation levels.
- Experiment Rigor: Participants (developers/teams) are linked with a
group property (treatment/control), enabling causal inference.
- Intervention Provenance: Interventions originate from coaching sessions, insights, or experiment design, creating traceability.
- Goal Alignment: Goals are explicitly tied to metrics and accountable entities, enabling dashboard progress tracking.
- Coaching-Insight Loop: Coaching sessions generate insights, which trigger experiments or new interventions, forming a learning cycle.
Example Use Cases Enabled
1. Coaching Insights
“Show Alice’s cycle time trend, her current goals, and recent coaching sessions discussing cycle time.”
MATCH (d:Developer {name: 'Alice'})
OPTIONAL MATCH (d)-[:HAS_METRIC_VALUE]->(mv)-[:OF_METRIC]->(m:Metric {name: 'Cycle Time'})
RETURN mv.timestamp, mv.value ORDER BY mv.timestamp
OPTIONAL MATCH (d)-[:HAS_GOAL]->(g)-[:ABOUT_METRIC]->(m)
OPTIONAL MATCH (cs:CoachingSession)-[:INVOLVES]->(d),
(cs)-[:DISCUSSES_METRIC]->(m)
RETURN *
2. Experiment Design
“Find developers with similar pre-experiment cycle times to assign to treatment/control groups.”
MATCH (exp:Experiment {id: 'exp123'})-[:TARGETS_METRIC]->(m:Metric)
MATCH (d:Developer)-[:HAS_METRIC_VALUE]->(mv)-[:OF_METRIC]->(m)
WHERE mv.timestamp < exp.start_date
WITH d, avg(mv.value) as pre_avg
ORDER BY pre_avg
RETURN d.id, d.name, pre_avg
// Then manual or algorithmic assignment to groups.
3. Accountability Dashboard
“Show all active goals, current metric values, and status (on track/at risk).”
MATCH (g:Goal {status: 'active'})
MATCH (g)-[:ABOUT_METRIC]->(m:Metric)
MATCH (entity)-[:HAS_GOAL]->(g)
MATCH (entity)-[:HAS_METRIC_VALUE]->(mv)-[:OF_METRIC]->(m)
WHERE mv.timestamp >= g.start_date AND mv.timestamp <= g.end_date
WITH g, entity, g.target_value as target, mv.value as current, g.operator as op
RETURN entity.name, g.name, current, target,
CASE
WHEN op = '<' AND current < target THEN 'achieved'
WHEN op = '>' AND current > target THEN 'achieved'
WHEN op = '==' AND current = target THEN 'achieved'
ELSE 'at_risk'
END AS status
Extensibility
- New Metrics: Add
Metric nodes without schema changes.
- New Interventions: Add
Intervention nodes with any type.
- Additional Entities: Extend
HAS_METRIC_VALUE to new node types (e.g., Sprint, Codebase).
- Data Freshness: Add
last_updated properties to nodes or a separate DataSync node to track ingestion.
Implementation Considerations
- Indexes: Create indexes on
Developer.id, Team.id, Project.id, Task.id, Metric.id, and relationship properties like PARTICIPATES_IN.group.
- Constraints: Enforce that
MetricValue has exactly one OF_METRIC and one incoming HAS_METRIC_VALUE.
- Partitioning: For large volumes, partition
MetricValue by timestamp (e.g., monthly).
- Access Control: Add
visibility properties or integrate with external auth to restrict sensitive coaching notes.
This schema balances richness with query efficiency, supporting both exploratory analysis and production dashboards.