-
Notifications
You must be signed in to change notification settings - Fork 35
Split "Experiment Details" out from feature gate info, add more experiment metadata #234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
a538064
b46e752
f2420b2
5e3c9cf
2f464f3
afba85d
2873bc9
b977ff4
f341b6c
cac85a7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,27 @@ | ||
| class Decision | ||
| include ActiveModel::Model | ||
|
|
||
| attr_accessor :split, :variant | ||
| attr_accessor :split, :variant, :takeaways | ||
|
|
||
| validates :split, :variant, presence: true | ||
|
|
||
| def save! | ||
| raise "Variant must be present in the split" unless split.has_variant?(variant) | ||
|
|
||
| split.reconfigure!( | ||
| weighting_registry: { variant => 100 }, | ||
| decided_at: Time.zone.now | ||
| ) | ||
| split.with_lock do | ||
| save_takeaways! if instance_variable_defined?(:@takeaways) | ||
| split.reconfigure!( | ||
| weighting_registry: { variant => 100 }, | ||
| decided_at: Time.zone.now, | ||
| ) | ||
| end | ||
| end | ||
|
|
||
| private | ||
|
|
||
| def save_takeaways! | ||
| split.build_experiment_detail unless split.experiment_detail | ||
| split.experiment_detail.takeaways = @takeaways | ||
| split.experiment_detail.save! | ||
| end | ||
| end | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| class ExperimentDetail < ActiveRecord::Base | ||
| belongs_to :split | ||
|
|
||
| def start_date | ||
| super || split.created_at.to_date | ||
| end | ||
|
|
||
| def end_date | ||
| super || split.decided_at&.to_date | ||
| end | ||
|
|
||
| def control_variant | ||
| super || split.registry.keys.find { |v| v == 'control' } | ||
| end | ||
|
|
||
| def self.available_tests | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. where will we actually enumerate these? (same with
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Over in our internal release there's a Rails initializer that sets up all of the Betterment-specific tests & segments. |
||
| @available_tests ||= {} | ||
| end | ||
|
|
||
| def self.available_segments | ||
| @available_segments ||= {} | ||
| end | ||
| end | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,55 +1,23 @@ | ||
| <article class="InfoCard InfoCard--constrained my-5"> | ||
| <article class="InfoCard fs-SplitOverview my-5"> | ||
| <div class="InfoCard-header"> | ||
| <h4>Split Details</h4> | ||
| <%= link_to "Decide Split", new_admin_split_decision_path(@split), class: 'decide-split-link btn btn-primary btn-large' %> | ||
| <h4>Split Overview</h4> | ||
|
|
||
| <%= link_to "Edit", edit_admin_split_details_path(split), class: 'edit-details-link' %> | ||
| </div> | ||
|
|
||
| <hr class="InfoCard-divider"> | ||
| <div class="InfoCard-description"> | ||
| <table class="BasicTable"> | ||
| <tr class="population-row"> | ||
| <td>Population Size</td> | ||
| <td> | ||
| <span class='population'> | ||
| <%= @split.assignments.count %><% if @split.feature_gate? %>* [<a href="#gate_population">feature gate</a>]<% end %> | ||
| </span> | ||
| </td> | ||
| <td> | ||
| <span><%= link_to "Edit", new_admin_split_bulk_assignment_path(@split), class: 'upload-new-assignments-link' %></span> | ||
| </td> | ||
| </tr> | ||
| <tr> | ||
| <td>Status</td> | ||
| <% if @split.finished? %> | ||
| <td class="u-status--finished">Finished (Retired) | ||
| <% if @split.decided? %> | ||
| (decision: <%= @split.decided_variant %>) | ||
| <% end %> | ||
| <span class="p-3">🏁</span></td> | ||
| <% elsif @split.decided? %> | ||
| <td class="u-status--decided">Decided (decision: <%= @split.decided_variant %>)</td> | ||
| <% else %> | ||
| <td class="u-status--active">Active</td> | ||
| <% end %> | ||
| <td> </td> | ||
| </tr> | ||
| <tr> | ||
| <td>App</td> | ||
| <td><%= @split.owner_app.name.capitalize %></td> | ||
| <td> </td> | ||
| </tr> | ||
| <tr> | ||
| <td>Creation</td> | ||
| <td> | ||
| <span><%= @split.created_at %></span> | ||
| </td> | ||
| <td> </td> | ||
| </tr> | ||
| </table> | ||
| <% if @split.feature_gate? %> | ||
| <p> | ||
| <a id="gate_population"></a> | ||
| * Feature gates no longer track assignment events and population reflects only visitors assigned to specific variants via the chrome extension or admin tool. | ||
| </p> | ||
| <% end %> | ||
| </div> | ||
| <table class="DescriptionTable"> | ||
| <tr> | ||
| <td>Owner</td> | ||
| <td><%= split.owner %></td> | ||
| </tr> | ||
| <tr> | ||
| <td>Platform</td> | ||
| <td><%= split.platform %></td> | ||
| </tr> | ||
| <tr> | ||
| <td>Location</td> | ||
| <td><%= split.location %></td> | ||
| </tr> | ||
| </table> | ||
| </article> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| <article class="InfoCard fs-SplitExperiment my-5"> | ||
| <div class="InfoCard-header"> | ||
| <h4>Experiment<%= " (decision: #{split.decided_variant})" if split.decided?%></h4> | ||
|
|
||
| <% if split.experiment_detail %> | ||
| <%= link_to "Edit", edit_admin_split_details_path(split), class: 'edit-experiment-details-link' %> | ||
| <% else %> | ||
| <%= link_to "Add Details", edit_admin_split_details_path(split), class: 'add-experiment-details-link' %> | ||
| <% end %> | ||
| </div> | ||
|
|
||
| <hr class="InfoCard-divider"> | ||
| <% if split.experiment_detail %> | ||
| <table class="DescriptionTable"> | ||
| <tr> | ||
| <td>Review Period</td> | ||
| <td><%= split.experiment_detail.start_date %> — <%= split.experiment_detail.end_date %></td> | ||
| </tr> | ||
| <tr> | ||
| <td>Control Variant</td> | ||
| <td><%= split.experiment_detail.control_variant %></td> | ||
| </tr> | ||
| <tr> | ||
| <td>Description</td> | ||
| <td><%= split.experiment_detail.description %></td> | ||
| </tr> | ||
| <tr> | ||
| <td>Hypothesis</td> | ||
| <td><%= split.experiment_detail.hypothesis %></td> | ||
| </tr> | ||
| <tr> | ||
| <td>Assignment Criteria</td> | ||
| <td><%= split.experiment_detail.assignment_criteria %></td> | ||
| </tr> | ||
| <tr> | ||
| <td>Takeaways</td> | ||
| <td> | ||
| <% if split.decided? %> | ||
| <%= split.experiment_detail.takeaways %> | ||
| <% else %> | ||
| (split not decided) | ||
| <% end %> | ||
| </td> | ||
| </tr> | ||
| <tr> | ||
| <td>Tests</td> | ||
| <td><%= split.experiment_detail.tests.join(', ') %></td> | ||
| </tr> | ||
| <tr> | ||
| <td>Segments</td> | ||
| <td><%= split.experiment_detail.segments.join(', ') %></td> | ||
| </tr> | ||
| </table> | ||
| <% else %> | ||
| <div class="EmptyTable EmptyTable--centered p-5"> | ||
| <p> | ||
| <strong>Is this split a test? Add metadata about it.</strong> | ||
| <br> | ||
| This information is used to explain the context of what a user is experiencing. | ||
| </p> | ||
| </div> | ||
| <% end %> | ||
| </article> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| <article class="InfoCard InfoCard--constrained my-5"> | ||
| <div class="InfoCard-header"> | ||
| <h4>Split Details</h4> | ||
| <%= link_to "Decide Split", new_admin_split_decision_path(@split), class: 'decide-split-link btn btn-primary btn-large' %> | ||
| </div> | ||
| <hr class="InfoCard-divider"> | ||
| <div class="InfoCard-description"> | ||
| <table class="BasicTable"> | ||
| <tr class="population-row"> | ||
| <td>Population Size</td> | ||
| <td> | ||
| <span class='population'> | ||
| <%= @split.assignments.count %><% if @split.feature_gate? %>* [<a href="#gate_population">feature gate</a>]<% end %> | ||
| </span> | ||
| </td> | ||
| <td> | ||
| <span><%= link_to "Edit", new_admin_split_bulk_assignment_path(@split), class: 'upload-new-assignments-link' %></span> | ||
| </td> | ||
| </tr> | ||
| <tr> | ||
| <td>Status</td> | ||
| <% if @split.finished? %> | ||
| <td class="u-status--finished">Finished (Retired) | ||
| <% if @split.decided? %> | ||
| (decision: <%= @split.decided_variant %>) | ||
| <% end %> | ||
| <span class="p-3">🏁</span></td> | ||
| <% elsif @split.decided? %> | ||
| <td class="u-status--decided">Decided (decision: <%= @split.decided_variant %>)</td> | ||
| <% else %> | ||
| <td class="u-status--active">Active</td> | ||
| <% end %> | ||
| <td> </td> | ||
| </tr> | ||
| <tr> | ||
| <td>App</td> | ||
| <td><%= @split.owner_app.name.capitalize %></td> | ||
| <td> </td> | ||
| </tr> | ||
| <tr> | ||
| <td>Creation</td> | ||
| <td> | ||
| <span><%= @split.created_at %></span> | ||
| </td> | ||
| <td> </td> | ||
| </tr> | ||
| </table> | ||
| <% if @split.feature_gate? %> | ||
| <p> | ||
| <a id="gate_population"></a> | ||
| * Feature gates no longer track assignment events and population reflects only visitors assigned to specific variants via the chrome extension or admin tool. | ||
| </p> | ||
| <% end %> | ||
| </div> | ||
| </article> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah I totally forgot to include
implementedas a required input for completed splits (being the variant name that was chose; typically justcontrolortreatement, but sometimes something else for multivariant tests). Can we add that to the view?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is existing logic for determining an implemented variant by looking at the split's variant registry -- if decided_at is true, then whichever is at 100% was the implemented variant (and this shows up in the UI too).
I can find a way to surface that variant through to our internal systems too, using identical logic.