Skip to content Search Apps Documentation Source Content Run Reset Eval Playground File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.

v0 source realm

Package dokimi is a public registry of pre-registered experiments.

Overview

Package dokimi is a public registry of pre-registered experiments.

Before a test starts, its owner locks a plan here: the hypothesis, the one metric that decides it, the size of change that counts as a win and the number of people each arm must reach. The block height and a fingerprint of the plan are stored with it. From then on the plan cannot be edited.

While the test runs the owner reports running totals. Every report is kept, totals can only go up, and closing the experiment judges the last report against the plan with the rules in gno.land/p/g1v9mz7rtgkvwkw90ey6496h5fk6pj6cgyawkvft/dokimi/v0.

An owner is whoever called Register: a person's account, or another realm that wants its own experiments on the public record.

Constants 1

const MaxReports, MaxNotes

1const (
2	// MaxReports bounds how many reports one experiment can hold.
3	MaxReports = 100
4	// MaxNotes bounds how many notes one experiment can hold.
5	MaxNotes = 50
6)
source

Functions 10

func AddNote

crossing Action
1func AddNote(cur realm, id uint64, text string)
source

AddNote attaches a public remark to an experiment. Only the owner can add one, at any time, including after the experiment is closed.

func AddReport

crossing Action
1func AddReport(cur realm, id uint64, controlExposures, controlConversions, variantExposures, variantConversions int64, source string)
source

AddReport records the running totals for both arms. Only the owner can report, only while the experiment is open, and no total may go down. source says where the numbers came from, for example a dashboard link.

func Close

crossing Action
1func Close(cur realm, id uint64) string
source

Close ends an experiment and stores the verdict of its last report judged against the locked plan. Only the owner can close, once, and only after at least one report. It returns the outcome: "met", "missed" or "inconclusive".

func Count

Action
1func Count() int
source

Count returns how many experiments have been registered.

func DigestOf

Action
1func DigestOf(id uint64) string
source

DigestOf returns the fingerprint of the locked plan.

func LiftOf

Action
1func LiftOf(id uint64) (liftBps int64, ok bool)
source

LiftOf returns the lift of the latest report in basis points. ok is false when there is no report yet or the lift is undefined.

func Matches

Action
1func Matches(id uint64, title, hypothesis, metric, control, variant, direction, target string, minSample int64) bool
source

Matches reports whether the given plan text is exactly what was locked under id. It recomputes the fingerprint from the arguments, so anyone can check a plan they were shown against the public record.

func Register

crossing Action
1func Register(cur realm, title, hypothesis, metric, control, variant, direction, target string, minSample int64) uint64
source

Register locks a new plan and returns its id. The caller becomes the owner.

direction is "increase" or "decrease". target is the smallest relative change that counts as a win, as a percentage such as "15" or "12.5". minSample is the number of exposures each arm must reach before the result can count.

func Render

1func Render(path string) string
source

Render draws the registry for gnoweb.

Example
1""      the home page: the list and the form to lock a new plan
2"<id>"  one experiment: its plan, reports, notes and verdict

func Status

Action
1func Status(id uint64) string
source

Status returns "open" while an experiment is running, and afterwards its outcome: "met", "missed" or "inconclusive". Other realms can call it to act on a result, for example to release a reward only when a target was met.

Types 3

type Experiment

struct
 1type Experiment struct {
 2	id           uint64
 3	owner        address
 4	plan         core.Plan
 5	digest       string
 6	lockedAt     time.Time
 7	lockedHeight int64
 8	reports      []Report
 9	notes        []Note
10	closed       bool
11	closedAt     time.Time
12	closedHeight int64
13	verdict      core.Verdict
14}
source

Experiment is one locked plan and everything recorded against it.

type Note

struct
1type Note struct {
2	Height int64
3	Time   time.Time
4	Text   string
5}
source

Note is a public remark by the owner, for example a change of plan that readers should know about. Notes are added, never edited or removed.

type Report

struct
1type Report struct {
2	Height  int64
3	Time    time.Time
4	Control core.Tally
5	Variant core.Tally
6	Source  string // where the numbers came from, in the owner's words
7}
source

Report is one snapshot of the running totals, kept forever.

Dependencies

Source Files 4