forked from longtao.wu/droboticflow
80 lines
2.9 KiB
Go
80 lines
2.9 KiB
Go
// Package productionstats derives read-only source-level reporting from production facts.
|
|
// It never changes task state, claims work, or materializes customer records.
|
|
package productionstats
|
|
|
|
import "droboticflow/internal/domain"
|
|
|
|
type Scope struct {
|
|
ProjectIDs []string `json:"projectIds" bson:"projectIds"`
|
|
Revision int `json:"revision" bson:"revision"`
|
|
UpdatedAt string `json:"updatedAt,omitempty" bson:"updatedAt,omitempty"`
|
|
UpdatedBy string `json:"updatedBy,omitempty" bson:"updatedBy,omitempty"`
|
|
}
|
|
type Snapshot struct {
|
|
// AsOf is retained with cached facts, rather than replaced by response time.
|
|
AsOf string `json:"asOf,omitempty"`
|
|
Captures []domain.CaptureRecord
|
|
Runs []domain.RunRecord
|
|
Items []domain.HumanItemRecord
|
|
Batches []domain.HumanBatchRecord
|
|
Tasks []domain.AnnotationTaskRecord
|
|
Worklogs []domain.AnnotationWorklogEventRecord
|
|
Events []domain.HumanEventRecord
|
|
Packages []domain.DeliveryPackageRecord
|
|
}
|
|
type Task struct {
|
|
ID string `json:"id"`
|
|
Stage string `json:"stage"`
|
|
Status string `json:"status"`
|
|
}
|
|
type Source struct {
|
|
ID string `json:"id"`
|
|
ProjectID string `json:"projectId"`
|
|
Name string `json:"name"`
|
|
WorkflowID string `json:"workflowId,omitempty"`
|
|
RunID string `json:"runId,omitempty"`
|
|
SupplierID string `json:"supplierId"`
|
|
Stage string `json:"stage"`
|
|
Detail string `json:"detail"`
|
|
Exception bool `json:"exception"`
|
|
ExceptionCategory string `json:"exceptionCategory,omitempty"`
|
|
DiscoveredAt string `json:"discoveredAt"`
|
|
Tasks []Task `json:"tasks"`
|
|
Runs []RunReference `json:"runs"`
|
|
Evidence []Evidence `json:"evidence,omitempty"`
|
|
}
|
|
type Event struct {
|
|
ID, SourceID, SupplierID, Metric, At string
|
|
RunID, WorkflowID, TaskID string
|
|
EvidenceAt string
|
|
AttemptID string
|
|
InvalidateFrom string
|
|
ProductionUnits []string
|
|
}
|
|
type RunReference struct {
|
|
ID string `json:"id"`
|
|
WorkflowID string `json:"workflowId"`
|
|
Part string `json:"part"`
|
|
}
|
|
type Evidence struct {
|
|
EvidenceAt string `json:"evidenceAt,omitempty"`
|
|
ID string `json:"id"`
|
|
Metric string `json:"metric"`
|
|
SupplierID string `json:"supplierId"`
|
|
At string `json:"at"`
|
|
RunID string `json:"runId,omitempty"`
|
|
WorkflowID string `json:"workflowId,omitempty"`
|
|
TaskID string `json:"taskId,omitempty"`
|
|
}
|
|
type Report struct {
|
|
Sources []Source
|
|
Events []Event
|
|
Incomplete bool
|
|
}
|
|
|
|
var Stages = []string{"intake", "annotation", "quality", "acceptance", "delivery", "delivered", "ended", "unknown"}
|
|
var Metrics = []string{"new", "submitted", "quality", "acceptance", "delivered", "rejected"}
|
|
|
|
const Unassigned = "__unassigned__"
|
|
const Unknown = "__unknown__"
|