core

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2026 License: MIT Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ForestPlotSVG

func ForestPlotSVG(run AnalysisRun) string

func FunnelPlotSVG

func FunnelPlotSVG(run AnalysisRun) string

func GenerateMetaforScript

func GenerateMetaforScript(run AnalysisRun) string

func ValidateAnalysisRows

func ValidateAnalysisRows(rows []InputRow) error

Types

type AnalysisResult

type AnalysisResult struct {
	Versions            map[string]string
	ScriptChecksum      string
	OutputChecksum      string
	Warnings            []string
	ForestPlot          Artifact
	FunnelPlot          Artifact
	Metrics             HeterogeneityMetrics
	MetaRegression      Scaffold
	SubgroupAnalysis    Scaffold
	PublicationBias     Scaffold
	SensitivityAnalysis Scaffold
}

func RunMetafor

func RunMetafor(dir string, run AnalysisRun, runner Runner) (AnalysisResult, error)

type AnalysisRun

type AnalysisRun struct {
	SchemaVersion string
	ID            string
	InputRows     []InputRow
}

func ExcludeByViSource

func ExcludeByViSource(run AnalysisRun, viSource string) AnalysisRun

ExcludeByViSource returns a copy of run omitting rows whose ViSource equals the given tag.

func Prepare

func Prepare(id string, items []evidence.EvidenceItem) (AnalysisRun, error)

func PrepareRawContinuous

func PrepareRawContinuous(id string, items []evidence.EvidenceItem, varianceFloor float64, moderatorFields []string) (AnalysisRun, error)

PrepareRawContinuous builds an AnalysisRun for scientific benchmarking meta-analysis. It records ViSource provenance per row and copies moderatorFields from evidence values.

func PrepareWithCalculator

func PrepareWithCalculator(id string, items []evidence.EvidenceItem, calc EffectSizeCalculator) (AnalysisRun, error)

type Artifact

type Artifact struct {
	Path     string
	Checksum string
}

type EffectSizeCalculator

type EffectSizeCalculator interface {
	Calculate(map[string]string) (float64, float64, error)
}

type FakeRunner

type FakeRunner struct {
	Stdout   string
	Stderr   string
	Versions map[string]string
}

func (FakeRunner) Run

func (f FakeRunner) Run(script string) (RunOutput, error)

func (FakeRunner) ToolVersions

func (f FakeRunner) ToolVersions() map[string]string

type FisherZCorrelation

type FisherZCorrelation struct{}

func (FisherZCorrelation) Calculate

func (FisherZCorrelation) Calculate(values map[string]string) (float64, float64, error)

type HeterogeneityMetrics

type HeterogeneityMetrics struct {
	I2   float64
	Tau2 float64
	Q    float64
}

func ParseHeterogeneity

func ParseHeterogeneity(output string) (HeterogeneityMetrics, error)

type InputRow

type InputRow struct {
	PaperID    string
	EffectSize float64
	Variance   float64
	ViSource   string            // "ci", "se", "floor", or "" for arm-pair calculators
	Moderators map[string]string // benchmarking moderator fields keyed by field name
}

type LogOddsRatio

type LogOddsRatio struct{}

func (LogOddsRatio) Calculate

func (LogOddsRatio) Calculate(values map[string]string) (float64, float64, error)

type MeanDifference

type MeanDifference struct{}

func (MeanDifference) Calculate

func (MeanDifference) Calculate(values map[string]string) (float64, float64, error)

type RawContinuousOutcome

type RawContinuousOutcome struct {
	VarianceFloor float64 // floor vi when no CI or SE is reported; defaults to 0.0025
}

RawContinuousOutcome pools a single continuous metric per study (e.g., STH efficiency %). It implements EffectSizeCalculator for use with PrepareWithCalculator and also exposes CalculateRaw for PrepareRawContinuous, which also records ViSource and Moderators.

func (RawContinuousOutcome) Calculate

func (r RawContinuousOutcome) Calculate(values map[string]string) (float64, float64, error)

Calculate implements EffectSizeCalculator.

func (RawContinuousOutcome) CalculateRaw

func (r RawContinuousOutcome) CalculateRaw(values map[string]string) (RawContinuousResult, error)

CalculateRaw returns the full result including ViSource provenance tag.

type RawContinuousResult

type RawContinuousResult struct {
	Yi       float64
	Vi       float64
	ViSource string // "ci", "se", or "floor"
}

RawContinuousResult holds the output of a single raw-continuous effect calculation.

type ReadinessIssue

type ReadinessIssue struct {
	PaperID      string `json:"paperId"`
	MissingField string `json:"missingField"`
}

ReadinessIssue records a missing required field for one accepted evidence item.

type ReadinessReport

type ReadinessReport struct {
	RunID      string           `json:"runId"`
	Ready      bool             `json:"ready"`
	TotalItems int              `json:"totalItems"`
	ReadyItems int              `json:"readyItems"`
	Issues     []ReadinessIssue `json:"issues"`
}

ReadinessReport summarises whether all accepted evidence items carry the required fields.

func BenchmarkingReadiness

func BenchmarkingReadiness(runID string, items []evidence.EvidenceItem, requiredFields []string) ReadinessReport

BenchmarkingReadiness checks that every accepted evidence item has all requiredFields populated. Pass nil requiredFields to use the default STH% set.

type RiskDifference

type RiskDifference struct{}

func (RiskDifference) Calculate

func (RiskDifference) Calculate(values map[string]string) (float64, float64, error)

type RiskRatio

type RiskRatio struct{}

func (RiskRatio) Calculate

func (RiskRatio) Calculate(values map[string]string) (float64, float64, error)

type RscriptRunner

type RscriptRunner struct {
	// Path is the Rscript binary to invoke; it defaults to "Rscript" (resolved
	// from PATH) when empty.
	Path string
	// Timeout bounds a single Rscript execution; it defaults to 5 minutes.
	Timeout time.Duration
}

RscriptRunner executes generated metafor scripts with a real Rscript binary. It implements Runner for opt-in R/metafor integration runs; the deterministic FakeRunner remains the default for normal, network-free tests.

func (RscriptRunner) Run

func (r RscriptRunner) Run(script string) (RunOutput, error)

Run writes the metafor script to a temporary file and executes it with Rscript, capturing stdout and stderr. Arguments are passed directly (no shell), so the script content cannot inject extra commands.

func (RscriptRunner) ToolVersions

func (r RscriptRunner) ToolVersions() map[string]string

ToolVersions reports the detected R version on a best-effort basis; it returns an empty map when the Rscript binary is unavailable.

type RunOutput

type RunOutput struct {
	Stdout string
	Stderr string
}

type Runner

type Runner interface {
	Run(script string) (RunOutput, error)
	ToolVersions() map[string]string
}

type Scaffold

type Scaffold struct{ Available bool }

type StandardizedMeanDifference

type StandardizedMeanDifference struct{}

func (StandardizedMeanDifference) Calculate

func (StandardizedMeanDifference) Calculate(values map[string]string) (float64, float64, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL