materialize

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package materialize writes a compiled, reviewed assessment.ReportDataset's ranking back onto each cited OpportunityAssessment row's rank projection columns, and marks the dataset "final" — the last step in the compile → review → materialize workflow (prism-roadmap PRD FR14 / RMI-OMNIROADMAP-006).

This is the promised follow-up to RMI-OMNIROADMAP-001, which deliberately left opportunity_rank_calculated/final unset on OpportunityAssessment: ranking is inherently cross-opportunity and could not be derived when a single assessment was saved. Now that a full-corpus compile (compile.Compile) has produced a dataset and it has been reviewed (review.Apply, then a fresh compile), this writes the result back so a query against one assessment can find its current rank directly, without needing the whole dataset.

Index

Constants

View Source
const StatusFinal = "final"

StatusFinal marks a dataset as reviewed and rank-materialized.

Variables

This section is empty.

Functions

func Materialize

func Materialize(ctx context.Context, s Store, datasetID string, dataset assessment.ReportDataset) error

Materialize writes dataset's ranking back onto each cited OpportunityAssessment row, then marks datasetID StatusFinal.

Excluded opportunities (RankedOpportunity.Excluded != "") are skipped — they have no CalculatedRank/FinalRank to write. Each assessment's rank is set independently (not wrapped in one cross-call transaction, since Store is an interface over persistence this package doesn't own the transaction boundary for); a failure partway through leaves some assessments updated and some not, but SetOpportunityRank is idempotent, so re-running Materialize after fixing the cause is always safe.

Types

type Store

type Store interface {
	SetOpportunityRank(ctx context.Context, assessmentID string, calculated, final int) error
	SetReportDatasetStatus(ctx context.Context, id, status string) error
}

Store is the persistence surface Materialize needs.

Jump to

Keyboard shortcuts

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