data

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventAgeMonthsDefault int = 6

	EventTypePR           string = "pr"
	EventTypePRReview     string = "pr_review"
	EventTypeIssue        string = "issue"
	EventTypeIssueComment string = "issue_comment"
	EventTypeFork         string = "fork"
)
View Source
const (
	DefaultInsightsModel = "claude-haiku-4-5-20251001"
)

Variables

View Source
var ErrDBNotInitialized = errors.New("database not initialized")

ErrDBNotInitialized is returned when the database has not been opened.

View Source
var UpdatableProperties = []string{
	"entity",
}

UpdatableProperties lists developer fields that can be substituted.

Functions

func Contains

func Contains[T comparable](list []T, val T) bool

Contains checks for val in list

Types

type AgingPRsSeries added in v0.15.0

type AgingPRsSeries struct {
	TotalOpen  int     `json:"total_open"`
	Over30Days int     `json:"over_30_days"`
	Over90Days int     `json:"over_90_days"`
	AgingPct   float64 `json:"aging_pct"`
}

AgingPRsSeries holds counts of open PRs by age bucket.

type ChangeFailureRateSeries

type ChangeFailureRateSeries struct {
	Months      []string  `json:"months" yaml:"months"`
	Failures    []int     `json:"failures" yaml:"failures"`
	Deployments []int     `json:"deployments" yaml:"deployments"`
	Rate        []float64 `json:"rate" yaml:"rate"`
}

type ContainerActivitySeries

type ContainerActivitySeries struct {
	Months   []string `json:"months" yaml:"months"`
	Versions []int    `json:"versions" yaml:"versions"`
}

ContainerActivitySeries is the chart data for container version publishes per month.

type ContainerStore

type ContainerStore interface {
	ImportContainerVersions(ctx context.Context, token, org, repo string) error
	ImportAllContainerVersions(ctx context.Context, token string) error
	GetContainerActivity(ctx context.Context, org, repo *string, months int) (*ContainerActivitySeries, error)
}

ContainerStore manages container version imports and queries.

type ContributorFunnelSeries

type ContributorFunnelSeries struct {
	Months       []string `json:"months" yaml:"months"`
	FirstComment []int    `json:"first_comment" yaml:"firstComment"`
	FirstPR      []int    `json:"first_pr" yaml:"firstPR"`
	FirstMerge   []int    `json:"first_merge" yaml:"firstMerge"`
}

type ContributorProfileSeries

type ContributorProfileSeries struct {
	Metrics    []string  `json:"metrics"`
	Values     []int     `json:"values"`
	Averages   []float64 `json:"averages"`
	Reputation *float64  `json:"reputation,omitempty"`
}

type CountedItem

type CountedItem struct {
	Name  string `json:"name,omitempty" yaml:"name,omitempty"`
	Count int    `json:"count,omitempty" yaml:"count,omitempty"`
}

type DailyActivitySeries

type DailyActivitySeries struct {
	Dates  []string `json:"dates"`
	Counts []int    `json:"counts"`
}

type DeepReputationResult

type DeepReputationResult struct {
	Scored  int `json:"scored" yaml:"scored"`
	Skipped int `json:"skipped" yaml:"skipped"`
	Errors  int `json:"errors" yaml:"errors"`
}

DeepReputationResult is returned by the bulk deep scoring step.

type DeleteResult

type DeleteResult struct {
	Org           string `json:"org" yaml:"org"`
	Repo          string `json:"repo" yaml:"repo"`
	Events        int64  `json:"events" yaml:"events"`
	RepoMeta      int64  `json:"repo_meta" yaml:"repo_meta"`
	Releases      int64  `json:"releases" yaml:"releases"`
	ReleaseAssets int64  `json:"release_assets" yaml:"release_assets"`
	State         int64  `json:"state" yaml:"state"`
}

type DeleteStore

type DeleteStore interface {
	DeleteRepoData(ctx context.Context, org, repo string) (*DeleteResult, error)
}

DeleteStore manages data deletion.

type Developer

type Developer struct {
	Username      string `json:"username,omitempty" yaml:"username,omitempty"`
	FullName      string `json:"full_name,omitempty" yaml:"fullName,omitempty"`
	Email         string `json:"email,omitempty" yaml:"email,omitempty"`
	AvatarURL     string `json:"avatar,omitempty" yaml:"avatar,omitempty"`
	ProfileURL    string `json:"url,omitempty" yaml:"url,omitempty"`
	Entity        string `json:"entity,omitempty" yaml:"entity,omitempty"`
	Organizations []*Org `json:"organizations,omitempty" yaml:"organizations,omitempty"`
}

type DeveloperListItem

type DeveloperListItem struct {
	Username string `json:"username,omitempty" yaml:"username,omitempty"`
	Entity   string `json:"entity,omitempty" yaml:"entity,omitempty"`
}

type DeveloperStore

type DeveloperStore interface {
	GetDeveloperUsernames(ctx context.Context) ([]string, error)
	GetNoFullnameDeveloperUsernames(ctx context.Context) ([]string, error)
	GetUnenrichedDeveloperUsernames(ctx context.Context) ([]string, error)
	SaveDevelopers(ctx context.Context, devs []*Developer) error
	GetDeveloper(ctx context.Context, username string) (*Developer, error)
	SearchDevelopers(ctx context.Context, val string, limit int) ([]*DeveloperListItem, error)
	UpdateDeveloperNames(ctx context.Context, devs map[string]string) error
	EnrichDeveloperEntities(ctx context.Context, token string) error
}

DeveloperStore manages developer records.

type EntityResult

type EntityResult struct {
	Entity         string               `json:"entity,omitempty" yaml:"entity,omitempty"`
	DeveloperCount int                  `json:"developer_count,omitempty" yaml:"developerCount,omitempty"`
	Developers     []*DeveloperListItem `json:"developers,omitempty" yaml:"developers,omitempty"`
}

type EntityStore

type EntityStore interface {
	GetEntityLike(ctx context.Context, query string, limit int) ([]*ListItem, error)
	GetEntity(ctx context.Context, val string) (*EntityResult, error)
	QueryEntities(ctx context.Context, val string, limit int) ([]*CountedItem, error)
	CleanEntities(ctx context.Context) error
}

EntityStore manages entity lookups and queries.

type Event

type Event struct {
	Org          string  `json:"org,omitempty" yaml:"org,omitempty"`
	Repo         string  `json:"repo,omitempty" yaml:"repo,omitempty"`
	Username     string  `json:"username,omitempty" yaml:"username,omitempty"`
	Type         string  `json:"type,omitempty" yaml:"type,omitempty"`
	Date         string  `json:"date,omitempty" yaml:"date,omitempty"`
	URL          string  `json:"url,omitempty" yaml:"url,omitempty"`
	Mentions     string  `json:"mentions,omitempty" yaml:"mentions,omitempty"`
	Labels       string  `json:"labels,omitempty" yaml:"labels,omitempty"`
	State        *string `json:"state,omitempty" yaml:"state,omitempty"`
	Number       *int    `json:"number,omitempty" yaml:"number,omitempty"`
	CreatedAt    *string `json:"created_at,omitempty" yaml:"createdAt,omitempty"`
	ClosedAt     *string `json:"closed_at,omitempty" yaml:"closedAt,omitempty"`
	MergedAt     *string `json:"merged_at,omitempty" yaml:"mergedAt,omitempty"`
	Additions    *int    `json:"additions,omitempty" yaml:"additions,omitempty"`
	Deletions    *int    `json:"deletions,omitempty" yaml:"deletions,omitempty"`
	ChangedFiles *int    `json:"changed_files,omitempty" yaml:"changed_files,omitempty"`
	Commits      *int    `json:"commits,omitempty" yaml:"commits,omitempty"`
	Title        string  `json:"title,omitempty" yaml:"title,omitempty"`
}

type EventDetails

type EventDetails struct {
	Event     *Event     `json:"event,omitempty" yaml:"event,omitempty"`
	Developer *Developer `json:"developer,omitempty" yaml:"developer,omitempty"`
}

type EventSearchCriteria

type EventSearchCriteria struct {
	FromDate *string `json:"from,omitempty" yaml:"from,omitempty"`
	ToDate   *string `json:"to,omitempty" yaml:"to,omitempty"`
	Type     *string `json:"type,omitempty" yaml:"type,omitempty"`
	Org      *string `json:"org,omitempty" yaml:"org,omitempty"`
	Repo     *string `json:"repo,omitempty" yaml:"repo,omitempty"`
	Username *string `json:"user,omitempty" yaml:"user,omitempty"`
	Entity   *string `json:"entity,omitempty" yaml:"entity,omitempty"`
	Mention  *string `json:"mention,omitempty" yaml:"mention,omitempty"`
	Label    *string `json:"label,omitempty" yaml:"label,omitempty"`
	Page     int     `json:"page,omitempty" yaml:"page,omitempty"`
	PageSize int     `json:"page_size,omitempty" yaml:"pageSize,omitempty"`
}

func (EventSearchCriteria) String

func (c EventSearchCriteria) String() string

type EventStore

type EventStore interface {
	ImportEvents(ctx context.Context, token, owner, repo string, months int) (map[string]int, *ImportSummary, error)
	UpdateEvents(ctx context.Context, token string, concurrency int) (map[string]int, error)
}

EventStore manages event imports.

type EventTypeSeries

type EventTypeSeries struct {
	Dates         []string  `json:"dates" yaml:"dates"`
	PRs           []int     `json:"pr" yaml:"pr"`
	PRReviews     []int     `json:"pr_review" yaml:"prReview"`
	Issues        []int     `json:"issue" yaml:"issue"`
	IssueComments []int     `json:"issue_comment" yaml:"issueComment"`
	Forks         []int     `json:"fork" yaml:"fork"`
	Total         []int     `json:"total" yaml:"total"`
	Trend         []float32 `json:"trend" yaml:"trend"`
}

type FirstResponseSeries

type FirstResponseSeries struct {
	Months   []string  `json:"months" yaml:"months"`
	IssueAvg []float64 `json:"issue_avg" yaml:"issueAvg"`
	PRAvg    []float64 `json:"pr_avg" yaml:"prAvg"`
}

type ForksAndActivitySeries

type ForksAndActivitySeries struct {
	Months []string `json:"months" yaml:"months"`
	Forks  []int    `json:"forks" yaml:"forks"`
	Events []int    `json:"events" yaml:"events"`
}

type GeneratedInsights

type GeneratedInsights struct {
	Observations []InsightBullet `json:"observations" yaml:"observations"`
	Actions      []InsightBullet `json:"actions" yaml:"actions"`
}

func GenerateInsights

func GenerateInsights(ctx context.Context, cfg *LLMConfig, metrics *InsightsMetrics, months int) (*GeneratedInsights, string, error)

GenerateInsights calls the Claude Messages API to generate insights from the provided metrics. Returns the parsed insights, the model used, and any error.

type HealthCategory added in v0.15.0

type HealthCategory struct {
	Name    string         `json:"name"`
	Grade   string         `json:"grade"`
	Score   float64        `json:"score"`
	Metrics map[string]any `json:"metrics"`
}

HealthCategory is a single scored category in the health scorecard.

type HealthScorecard added in v0.15.0

type HealthScorecard struct {
	Overall        string         `json:"overall"`
	OverallScore   float64        `json:"overall_score"`
	Demand         HealthCategory `json:"demand"`
	Throughput     HealthCategory `json:"throughput"`
	Responsiveness HealthCategory `json:"responsiveness"`
}

HealthScorecard is the composite health assessment.

type ImportSummary

type ImportSummary struct {
	Repo       string `json:"repo" yaml:"repo"`
	Since      string `json:"since" yaml:"since"`
	Events     int    `json:"events" yaml:"events"`
	Developers int    `json:"developers" yaml:"developers"`
}

ImportSummary contains per-repo import metadata.

type InsightBullet

type InsightBullet struct {
	Headline string `json:"headline" yaml:"headline"`
	Detail   string `json:"detail" yaml:"detail"`
}

type InsightsGenerationStore

type InsightsGenerationStore interface {
	GetRepoInsights(ctx context.Context, org, repo *string) ([]*RepoInsights, error)
	SaveRepoInsights(ctx context.Context, org, repo string, insights *RepoInsights) error
	GetRepoInsightsGeneratedAt(ctx context.Context, org, repo string) (string, error)
	GetRepoInsightsEventCount(ctx context.Context, org, repo string) (int, error)
}

InsightsGenerationStore manages LLM-generated repo insights.

type InsightsMetrics

type InsightsMetrics struct {
	Summary          *InsightsSummary         `json:"summary"`
	Momentum         *MomentumSeries          `json:"momentum"`
	PRRatio          *PRReviewRatioSeries     `json:"pr_ratio"`
	TimeToMerge      *VelocitySeries          `json:"time_to_merge"`
	Retention        *RetentionSeries         `json:"retention"`
	Funnel           *ContributorFunnelSeries `json:"funnel"`
	ChangeFailure    *ChangeFailureRateSeries `json:"change_failure"`
	ReviewLatency    *ReviewLatencySeries     `json:"review_latency"`
	PRSize           *PRSizeSeries            `json:"pr_size"`
	ForksAndActivity *ForksAndActivitySeries  `json:"forks_and_activity"`
	RepoMeta         []*RepoMeta              `json:"repo_meta"`
	IssueRatio       *IssueRatioSeries        `json:"issue_ratio"`
	FirstResponse    *FirstResponseSeries     `json:"first_response"`
	ReleaseCadence   *ReleaseCadenceSeries    `json:"release_cadence"`
	ReleaseDownloads *ReleaseDownloadsSeries  `json:"release_downloads"`
	AgingPRs         *AgingPRsSeries          `json:"aging_prs"`
	Unanswered       *UnansweredSeries        `json:"unanswered"`
	ResponseSLO      *ResponseSLOSeries       `json:"response_slo"`
}

InsightsMetrics holds all metrics gathered for a repo to feed into the LLM.

func GatherInsightsMetrics

func GatherInsightsMetrics(ctx context.Context, store Store, org, repo string, months int) *InsightsMetrics

GatherInsightsMetrics calls Store methods to collect all metrics for a repo. Individual metric failures are logged as warnings; the function always returns whatever metrics were successfully gathered.

type InsightsStore

type InsightsStore interface {
	GetInsightsSummary(ctx context.Context, org, repo, entity *string, months int) (*InsightsSummary, error)
	GetDailyActivity(ctx context.Context, org, repo, entity *string, months int) (*DailyActivitySeries, error)
	GetContributorRetention(ctx context.Context, org, repo, entity *string, months int) (*RetentionSeries, error)
	GetPRReviewRatio(ctx context.Context, org, repo, entity *string, months int) (*PRReviewRatioSeries, error)
	GetChangeFailureRate(ctx context.Context, org, repo, entity *string, months int) (*ChangeFailureRateSeries, error)
	GetReviewLatency(ctx context.Context, org, repo, entity *string, months int) (*ReviewLatencySeries, error)
	GetTimeToMerge(ctx context.Context, org, repo, entity *string, months int) (*VelocitySeries, error)
	GetTimeToClose(ctx context.Context, org, repo, entity *string, months int) (*VelocitySeries, error)
	GetTimeToRestoreBugs(ctx context.Context, org, repo, entity *string, months int) (*VelocitySeries, error)
	GetPRSizeDistribution(ctx context.Context, org, repo, entity *string, months int) (*PRSizeSeries, error)
	GetForksAndActivity(ctx context.Context, org, repo, entity *string, months int) (*ForksAndActivitySeries, error)
	GetContributorFunnel(ctx context.Context, org, repo, entity *string, months int) (*ContributorFunnelSeries, error)
	GetContributorMomentum(ctx context.Context, org, repo, entity *string, months int) (*MomentumSeries, error)
	GetContributorProfile(ctx context.Context, username string, org, repo, entity *string, months int) (*ContributorProfileSeries, error)
	GetIssueOpenCloseRatio(ctx context.Context, org, repo, entity *string, months int) (*IssueRatioSeries, error)
	GetTimeToFirstResponse(ctx context.Context, org, repo, entity *string, months int) (*FirstResponseSeries, error)
	GetAgingPRs(ctx context.Context, org, repo, entity *string, months int) (*AgingPRsSeries, error)
	GetUnansweredRate(ctx context.Context, org, repo, entity *string, months int) (*UnansweredSeries, error)
	GetResponseSLO(ctx context.Context, org, repo, entity *string, months int) (*ResponseSLOSeries, error)
	GetPortfolioSummary(ctx context.Context, org, repo *string, months int) (*PortfolioSummary, error)
	GetSignals(ctx context.Context, org *string, limit int) ([]*Signal, error)
}

InsightsStore provides analytics and insights queries.

type InsightsSummary

type InsightsSummary struct {
	BusFactor    int    `json:"bus_factor" yaml:"busFactor"`
	PonyFactor   int    `json:"pony_factor" yaml:"ponyFactor"`
	Orgs         int    `json:"orgs" yaml:"orgs"`
	Repos        int    `json:"repos" yaml:"repos"`
	Events       int    `json:"events" yaml:"events"`
	Contributors int    `json:"contributors" yaml:"contributors"`
	LastImport   string `json:"last_import" yaml:"lastImport"`
}

type IssueRatioSeries

type IssueRatioSeries struct {
	Months []string `json:"months" yaml:"months"`
	Opened []int    `json:"opened" yaml:"opened"`
	Closed []int    `json:"closed" yaml:"closed"`
}

type LLMConfig

type LLMConfig struct {
	Token   string
	BaseURL string
	Model   string
}

LLMConfig holds configuration for the Claude API.

func NewLLMConfigFromEnv

func NewLLMConfigFromEnv() *LLMConfig

NewLLMConfigFromEnv creates an LLMConfig from environment variables. Returns nil if ANTHROPIC_API_KEY is not set.

type ListItem

type ListItem struct {
	Value string `json:"value,omitempty" yaml:"value,omitempty"`
	Text  string `json:"text,omitempty" yaml:"text,omitempty"`
	Type  string `json:"type,omitempty" yaml:"type,omitempty"`
}

type MetricHistoryStore

type MetricHistoryStore interface {
	ImportRepoMetricHistory(ctx context.Context, token, owner, repo string) error
	ImportAllRepoMetricHistory(ctx context.Context, token string) error
	GetRepoMetricHistory(ctx context.Context, org, repo *string, months int) ([]*RepoMetricHistory, error)
}

MetricHistoryStore manages repository metric history imports and queries.

type MomentumSeries

type MomentumSeries struct {
	Months []string `json:"months" yaml:"months"`
	Active []int    `json:"active" yaml:"active"`
	Delta  []int    `json:"delta" yaml:"delta"`
}

type Org

type Org struct {
	URL         string `json:"url,omitempty" yaml:"url,omitempty"`
	Name        string `json:"name,omitempty" yaml:"name,omitempty"`
	Company     string `json:"company,omitempty" yaml:"company,omitempty"`
	Description string `json:"description,omitempty" yaml:"description,omitempty"`
}

type OrgRepoItem

type OrgRepoItem struct {
	Org  string `json:"org,omitempty" yaml:"org,omitempty"`
	Repo string `json:"repo,omitempty" yaml:"repo,omitempty"`
}

type OrgStore

type OrgStore interface {
	GetAllOrgRepos(ctx context.Context) ([]*OrgRepoItem, error)
	GetDeveloperPercentages(ctx context.Context, entity, org, repo *string, ex []string, months int) ([]*CountedItem, error)
	GetEntityPercentages(ctx context.Context, entity, org, repo *string, ex []string, months int) ([]*CountedItem, error)
	SearchDeveloperUsernames(ctx context.Context, query string, org, repo *string, months, limit int) ([]string, error)
	GetOrgLike(ctx context.Context, query string, limit int) ([]*ListItem, error)
}

OrgStore manages organization-level queries.

type PRReviewRatioSeries

type PRReviewRatioSeries struct {
	Months  []string  `json:"months" yaml:"months"`
	PRs     []int     `json:"prs" yaml:"prs"`
	Reviews []int     `json:"reviews" yaml:"reviews"`
	Ratio   []float64 `json:"ratio" yaml:"ratio"`
}

type PRSizeSeries

type PRSizeSeries struct {
	Months []string `json:"months" yaml:"months"`
	Small  []int    `json:"small" yaml:"small"`
	Medium []int    `json:"medium" yaml:"medium"`
	Large  []int    `json:"large" yaml:"large"`
	XLarge []int    `json:"xlarge" yaml:"xlarge"`
}

type PortfolioSummary added in v0.15.0

type PortfolioSummary struct {
	TotalStars        int     `json:"total_stars"`
	TotalForks        int     `json:"total_forks"`
	TotalOpenIssues   int     `json:"total_open_issues"`
	TotalClosedPRs    int     `json:"total_closed_prs"`
	TotalContributors int     `json:"total_contributors"`
	StarsDelta        int     `json:"stars_delta"`
	StarsDeltaPct     float64 `json:"stars_delta_pct"`
	ForksDelta        int     `json:"forks_delta"`
	ForksDeltaPct     float64 `json:"forks_delta_pct"`
	AvgMergeHours     float64 `json:"avg_merge_hours"`
	MedianMergeHours  float64 `json:"median_merge_hours"`
}

PortfolioSummary holds aggregated KPIs across all repos.

type QueryStore

type QueryStore interface {
	SearchEvents(ctx context.Context, q *EventSearchCriteria) ([]*EventDetails, error)
	GetMinEventDate(ctx context.Context, org, repo *string) (string, error)
	GetEventTypeSeries(ctx context.Context, org, repo, entity *string, months int) (*EventTypeSeries, error)
}

QueryStore manages event search and aggregation queries.

type ReleaseCadenceSeries

type ReleaseCadenceSeries struct {
	Months      []string `json:"months" yaml:"months"`
	Total       []int    `json:"total" yaml:"total"`
	Stable      []int    `json:"stable" yaml:"stable"`
	Deployments []int    `json:"deployments" yaml:"deployments"`
}

type ReleaseDownloadsByTagSeries

type ReleaseDownloadsByTagSeries struct {
	Tags      []string `json:"tags" yaml:"tags"`
	Downloads []int    `json:"downloads" yaml:"downloads"`
}

type ReleaseDownloadsSeries

type ReleaseDownloadsSeries struct {
	Months    []string `json:"months" yaml:"months"`
	Downloads []int    `json:"downloads" yaml:"downloads"`
}

type ReleaseStore

type ReleaseStore interface {
	ImportReleases(ctx context.Context, token, owner, repo string) error
	ImportAllReleases(ctx context.Context, token string) error
	GetReleaseCadence(ctx context.Context, org, repo, entity *string, months int) (*ReleaseCadenceSeries, error)
	GetReleaseDownloads(ctx context.Context, org, repo *string, months int) (*ReleaseDownloadsSeries, error)
	GetReleaseDownloadsByTag(ctx context.Context, org, repo *string, months int) (*ReleaseDownloadsByTagSeries, error)
}

ReleaseStore manages release imports and queries.

type RepoInsights

type RepoInsights struct {
	Org          string             `json:"org" yaml:"org"`
	Repo         string             `json:"repo" yaml:"repo"`
	Insights     *GeneratedInsights `json:"insights" yaml:"insights"`
	PeriodMonths int                `json:"period_months" yaml:"periodMonths"`
	Model        string             `json:"model" yaml:"model"`
	GeneratedAt  string             `json:"generated_at" yaml:"generatedAt"`
	EventCount   int                `json:"event_count" yaml:"eventCount"`
}

type RepoMeta

type RepoMeta struct {
	Org                string `json:"org" yaml:"org"`
	Repo               string `json:"repo" yaml:"repo"`
	Stars              int    `json:"stars" yaml:"stars"`
	Forks              int    `json:"forks" yaml:"forks"`
	OpenIssues         int    `json:"open_issues" yaml:"openIssues"`
	Language           string `json:"language" yaml:"language"`
	License            string `json:"license" yaml:"license"`
	Archived           bool   `json:"archived" yaml:"archived"`
	HasCoC             bool   `json:"has_coc" yaml:"hasCoc"`
	HasContributing    bool   `json:"has_contributing" yaml:"hasContributing"`
	HasReadme          bool   `json:"has_readme" yaml:"hasReadme"`
	HasIssueTemplate   bool   `json:"has_issue_template" yaml:"hasIssueTemplate"`
	HasPRTemplate      bool   `json:"has_pr_template" yaml:"hasPrTemplate"`
	CommunityHealthPct int    `json:"community_health_pct" yaml:"communityHealthPct"`
	UpdatedAt          string `json:"updated_at" yaml:"updatedAt"`
}

type RepoMetaStore

type RepoMetaStore interface {
	ImportRepoMeta(ctx context.Context, token, owner, repo string) error
	ImportAllRepoMeta(ctx context.Context, token string) error
	GetRepoMetas(ctx context.Context, org, repo *string) ([]*RepoMeta, error)
	GetRepoOverview(ctx context.Context, org *string, months int) ([]*RepoOverview, error)
}

RepoMetaStore manages repository metadata imports and queries.

type RepoMetricHistory

type RepoMetricHistory struct {
	Org   string `json:"org"`
	Repo  string `json:"repo"`
	Date  string `json:"date"`
	Stars int    `json:"stars"`
	Forks int    `json:"forks"`
}

type RepoOverview

type RepoOverview struct {
	Org          string `json:"org"`
	Repo         string `json:"repo"`
	Stars        int    `json:"stars"`
	Forks        int    `json:"forks"`
	OpenIssues   int    `json:"open_issues"`
	Events       int    `json:"events"`
	Contributors int    `json:"contributors"`
	Scored       int    `json:"scored"`
	Language     string `json:"language"`
	License      string `json:"license"`
	Archived     bool   `json:"archived"`
	LastImport   string `json:"last_import"`
}

type RepoStore

type RepoStore interface {
	GetRepoLike(ctx context.Context, query string, limit int) ([]*ListItem, error)
}

RepoStore manages repository lookups.

type ReputationDistribution

type ReputationDistribution struct {
	Labels []string  `json:"labels" yaml:"labels"`
	Data   []float64 `json:"data" yaml:"data"`
	Scored int       `json:"scored" yaml:"scored"`
	Total  int       `json:"total" yaml:"total"`
}

ReputationDistribution is the dashboard chart data.

type ReputationResult

type ReputationResult struct {
	Updated int `json:"updated" yaml:"updated"`
	Skipped int `json:"skipped" yaml:"skipped"`
	Errors  int `json:"errors" yaml:"errors"`
}

ReputationResult is returned by the shallow bulk import.

type ReputationStore

type ReputationStore interface {
	ImportReputation(ctx context.Context, org, repo *string) (*ReputationResult, error)
	ImportDeepReputation(ctx context.Context, tokenFn TokenFunc, limit, staleHours int, org, repo *string) (*DeepReputationResult, error)
	GetOrComputeDeepReputation(ctx context.Context, token, username string) (*UserReputation, error)
	ComputeDeepReputation(ctx context.Context, token, username string) (*UserReputation, error)
	GetReputationDistribution(ctx context.Context, org, repo, entity *string, months int) (*ReputationDistribution, error)
}

ReputationStore manages reputation scoring.

type ResponseSLOSeries added in v0.15.0

type ResponseSLOSeries struct {
	TotalItems    int     `json:"total_items"`
	WithinSLO     int     `json:"within_slo"`
	WithinSLOPct  float64 `json:"within_slo_pct"`
	SLOThresholdH int     `json:"slo_threshold_hours"`
}

ResponseSLOSeries tracks percentage of issues/PRs responded to within a threshold.

type RetentionSeries

type RetentionSeries struct {
	Months    []string `json:"months" yaml:"months"`
	New       []int    `json:"new" yaml:"new"`
	Returning []int    `json:"returning" yaml:"returning"`
}

type ReviewLatencySeries

type ReviewLatencySeries struct {
	Months   []string  `json:"months" yaml:"months"`
	Count    []int     `json:"count" yaml:"count"`
	AvgHours []float64 `json:"avg_hours" yaml:"avgHours"`
}

type Signal added in v0.15.0

type Signal struct {
	Org      string  `json:"org"`
	Repo     string  `json:"repo"`
	Metric   string  `json:"metric"`
	Message  string  `json:"message"`
	Delta    int     `json:"delta"`
	DeltaPct float64 `json:"delta_pct"`
	Severity string  `json:"severity"`
}

Signal represents a notable week-over-week change detected in the data.

type SignalSummary

type SignalSummary struct {
	AgeDays           int64  `json:"age_days" yaml:"ageDays"`
	Followers         int64  `json:"followers" yaml:"followers"`
	Following         int64  `json:"following" yaml:"following"`
	PublicRepos       int64  `json:"public_repos" yaml:"publicRepos"`
	Suspended         bool   `json:"suspended" yaml:"suspended"`
	OrgMember         bool   `json:"org_member" yaml:"orgMember"`
	Commits           int64  `json:"commits" yaml:"commits"`
	TotalCommits      int64  `json:"total_commits" yaml:"totalCommits"`
	TotalContributors int    `json:"total_contributors" yaml:"totalContributors"`
	LastCommitDays    int64  `json:"last_commit_days" yaml:"lastCommitDays"`
	AuthorAssociation string `json:"author_association" yaml:"authorAssociation"`
	HasBio            bool   `json:"has_bio" yaml:"hasBio"`
	HasCompany        bool   `json:"has_company" yaml:"hasCompany"`
	HasLocation       bool   `json:"has_location" yaml:"hasLocation"`
	HasWebsite        bool   `json:"has_website" yaml:"hasWebsite"`
	PRsMerged         int64  `json:"prs_merged" yaml:"prsMerged"`
	PRsClosed         int64  `json:"prs_closed" yaml:"prsClosed"`
	RecentPRRepoCount int64  `json:"recent_pr_repo_count" yaml:"recentPRRepoCount"`
	ForkedRepos       int64  `json:"forked_repos" yaml:"forkedRepos"`
	TrustedOrgMember  bool   `json:"trusted_org_member" yaml:"trustedOrgMember"`
}

SignalSummary exposes gathered signals to the UI.

type State

type State struct {
	Since time.Time `json:"since" yaml:"since"`
	Page  int       `json:"page" yaml:"page"`
}

type StateStore

type StateStore interface {
	GetState(ctx context.Context, query, org, repo string, min time.Time) (*State, error)
	SaveState(ctx context.Context, query, org, repo string, state *State) error
	ClearState(ctx context.Context, org, repo string) error
	GetDataState(ctx context.Context) (map[string]int64, error)
}

StateStore manages import state tracking.

type Substitution

type Substitution struct {
	Prop    string `json:"prop" yaml:"prop"`
	Old     string `json:"old" yaml:"old"`
	New     string `json:"new" yaml:"new"`
	Records int64  `json:"records" yaml:"records"`
}

type SubstitutionStore

type SubstitutionStore interface {
	SaveAndApplyDeveloperSub(ctx context.Context, prop, old, new string) (*Substitution, error)
	ApplySubstitutions(ctx context.Context) ([]*Substitution, error)
}

SubstitutionStore manages developer substitutions.

type TokenFunc

type TokenFunc func() string

TokenFunc returns a GitHub API token. Used by methods that make many API calls in a loop so they can rotate tokens from a pool on each iteration.

type UnansweredSeries added in v0.15.0

type UnansweredSeries struct {
	TotalItems    int     `json:"total_items"`
	Unanswered    int     `json:"unanswered"`
	UnansweredPct float64 `json:"unanswered_pct"`
}

UnansweredSeries holds counts of unanswered issues and PRs.

type UserReputation

type UserReputation struct {
	Username   string         `json:"username" yaml:"username"`
	Reputation float64        `json:"reputation" yaml:"reputation"`
	Deep       bool           `json:"deep" yaml:"deep"`
	Signals    *SignalSummary `json:"signals,omitempty" yaml:"signals,omitempty"`
}

UserReputation is returned by the on-demand deep score endpoint.

type VelocitySeries

type VelocitySeries struct {
	Months  []string  `json:"months" yaml:"months"`
	Count   []int     `json:"count" yaml:"count"`
	AvgDays []float64 `json:"avg_days" yaml:"avgDays"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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