vibe.review.models¶
Data models for VIBE Review.
This module defines both: - SQLAlchemy models for database persistence - Dataclasses for in-memory representation and API boundaries
The design separates concerns: - SQLAlchemy models handle persistence and querying - Dataclasses provide clean interfaces for business logic
Base ¶
SQLAlchemy declarative base for all models.
PartType ¶
Type of document part.
Unified enum covering both structural types (heading, paragraph, etc.) and semantic/contract-specific types (clause, section, article, etc.).
ClassificationResult ¶
Possible classification outcomes for a requirement review.
DocumentStatus ¶
Document processing status.
Requirement ¶
A single compliance requirement to be checked against a document.
| Attributes: |
|
|---|
Note: Requirement applicability is determined by template probing, not by conditions in config. The template's Jinja conditionals (e.g., {% if critical_service %}) control which requirements apply - "template is truth".
build_query_text ¶
build_query_text() -> str
Build query text for search and reranking.
Concatenates label, description, reference (with source if available), and help text. Used by both hybrid search and cross-encoder reranking.
from_dict ¶
from_dict(data: dict[str, Any]) -> Requirement
Reconstruct requirement from dictionary; embedding will be None.
RequirementGroup ¶
A logical grouping of related requirements.
Groups are used for: - Organizing the review UI - Generating section-based reports - Conditional applicability (e.g., "critical services" group)
ReviewClassification ¶
A classification decision for a requirement against a document.
Captures both AI-suggested and human-verified classifications.
ReviewProgress ¶
Progress tracking for a review session.
ClassificationStats ¶
Classification statistics for a review session.
RequirementAccuracyStats ¶
Accuracy statistics for a single requirement.
AccuracyStats ¶
AI classification accuracy statistics.
TemplateInfo ¶
Basic template metadata.
AssessmentNavigation ¶
Navigation state for the assessment stream.
MatchedPart ¶
A document part matched to a requirement.
QuestionReview ¶
Review decision for a template question (parallel to ReviewClassification).
SessionListRow ¶
Row data for the review session list (index.html).
TemplateSessionRow ¶
Row data for template-specific session list (template_sessions.html).
RequirementCacheModel ¶
Cached requirement with pre-computed embedding.
Requirements are loaded from template config.yml but cached in DB with embeddings to avoid recomputation.
to_dataclass ¶
to_dataclass() -> Requirement
Convert to Requirement dataclass, including embedding vector.
DocumentModel ¶
A document submitted for compliance review.
DocumentPartModel ¶
A segment of a document with embedding for retrieval.
This is the canonical persistence model for document parts. SemanticUnit instances are converted to this model via to_db_fields() for storage.
ReviewSessionModel ¶
A review session tracking progress through requirement checks.
RequirementReviewModel ¶
Individual requirement classification within a review session.
to_dataclass ¶
to_dataclass() -> ReviewClassification
Convert to ReviewClassification dataclass with all fields.
QuestionReviewModel ¶
Individual question review within a review session.
Tracks AI suggestions vs human answers for template questions, parallel to RequirementReviewModel for requirements.
effective_answer ¶
effective_answer: object
Return human override if verified, otherwise AI-suggested answer.
to_dataclass ¶
to_dataclass() -> QuestionReview
Convert to QuestionReview dataclass with all fields.
ExampleModel ¶
Few-shot examples for requirement classification.
Examples are used to guide LLM classification with known-good cases. Can optionally track provenance back to the source review and document.
ReferenceSourceModel ¶
A regulatory source document (e.g., DORA, EBA Guidelines).
Stores metadata about the source and links to its parts.
ReferencePartModel ¶
A searchable part of a reference source document.
Parts are individual articles, recitals, or guideline paragraphs that can be retrieved and cited in compliance reviews.