Skip to content

Commit

Permalink
REST API - Allow updating in-progress conversion, attribution model, …
Browse files Browse the repository at this point in the history
…and stats engine for experiment settings (#2435)
  • Loading branch information
bttf committed Apr 30, 2024
1 parent 6ed4d50 commit 3f97efb
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 4 deletions.
30 changes: 30 additions & 0 deletions packages/back-end/generated/spec.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,21 @@ properties:
type: string
excludeFromPayload:
type: boolean
inProgressConversions:
type: string
enum:
- loose
- strict
attributionModel:
type: string
enum:
- firstExposure
- experimentDuration
statsEngine:
type: string
enum:
- bayesian
- frequentist
variations:
type: array
minItems: 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,21 @@ properties:
type: string
excludeFromPayload:
type: boolean
inProgressConversions:
type: string
enum:
- loose
- strict
attributionModel:
type: string
enum:
- firstExposure
- experimentDuration
statsEngine:
type: string
enum:
- bayesian
- frequentist
variations:
type: array
minItems: 2
Expand Down
13 changes: 11 additions & 2 deletions packages/back-end/src/services/experiments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1800,8 +1800,9 @@ export function postExperimentApiPayloadToInterface(
activationMetric: "",
segment: "",
queryFilter: "",
skipPartialData: false,
attributionModel: "firstExposure",
skipPartialData: payload.inProgressConversions === "strict",
attributionModel: payload.attributionModel || "firstExposure",
...(payload.statsEngine ? { statsEngine: payload.statsEngine } : {}),
variations:
payload.variations.map((v) => ({
...v,
Expand Down Expand Up @@ -1854,6 +1855,9 @@ export function updateExperimentApiPayloadToInterface(
variations,
releasedVariationId,
excludeFromPayload,
inProgressConversions,
attributionModel,
statsEngine,
} = payload;
return {
...(trackingKey ? { trackingKey } : {}),
Expand All @@ -1872,6 +1876,11 @@ export function updateExperimentApiPayloadToInterface(
...(status ? { status } : {}),
...(releasedVariationId !== undefined ? { releasedVariationId } : {}),
...(excludeFromPayload !== undefined ? { excludeFromPayload } : {}),
...(inProgressConversions !== undefined
? { skipPartialData: inProgressConversions === "strict" }
: {}),
...(attributionModel !== undefined ? { attributionModel } : {}),
...(statsEngine !== undefined ? { statsEngine } : {}),
...(variations
? {
variations: variations?.map((v) => ({
Expand Down
4 changes: 2 additions & 2 deletions packages/back-end/src/validators/openapi.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions packages/back-end/types/openapi.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 comment on commit 3f97efb

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy preview for docs ready!

✅ Preview
https://docs-6gqn9neat-growthbook.vercel.app

Built with commit 3f97efb.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.