• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

liqd / roots / 22072536647

16 Feb 2026 05:41PM UTC coverage: 42.093%. First build
22072536647

Pull #59

github

Pull Request #59: apps/summerization: Integrate Document Summary into Workflow

51 of 314 new or added lines in 7 files covered. (16.24%)

3564 of 8467 relevant lines covered (42.09%)

0.42 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

88.46
/apps/summarization/pydantic_models.py
1
"""Pydantic models for summarization responses."""
2

3
from typing import Optional
1✔
4

5
from pydantic import BaseModel
1✔
6
from pydantic import Field
1✔
7

8

9
class SummaryItem(BaseModel):
1✔
10
    """Response model for summarization."""
11

12
    title: str = Field(description="Title of the summary")
1✔
13
    summary: str = Field(description="The summary of the text or document")
1✔
14
    key_points: list[str] = Field(
1✔
15
        default_factory=list,
16
        description="Important points or keywords extracted from the text or document",
17
    )
18

19

20
class ModuleItem(BaseModel):
1✔
21
    """Response model for module summarization."""
22

23
    module_name: str = Field(description="Name of the module")
1✔
24
    summary: str = Field(description="Summary of the module")
1✔
25
    key_points: list[str] = Field(
1✔
26
        default_factory=list, description="Key points of the module"
27
    )
28
    phase_status: str = Field(
1✔
29
        description="Phase status: 'past' (in the past), 'active' (currently running), 'upcoming' (in the future)"
30
    )
31
    link: str = Field(description="Link to the module")
1✔
32

33

34
class SummaryResponse(BaseModel):
1✔
35
    """Response model for summarization."""
36

37
    summary_items: list[SummaryItem] = Field(
1✔
38
        default_factory=list,
39
        description=(
40
            "List of summary items. Each item contains: "
41
            "title, summary, key_points (list of important points)"
42
        ),
43
    )
44
    module_items: list[ModuleItem] = Field(
1✔
45
        default_factory=list,
46
        description=(
47
            "List of module items. Each item contains: "
48
            "module_name, summary, key_points (list of important points), "
49
            "phase_status (past/active/upcoming), link (URL to the module)"
50
        ),
51
    )
52

53

54
"""Pydantic models for summarization responses."""
1✔
55

56

57
class Stats(BaseModel):
1✔
58
    """Statistics for the project summary header."""
59

60
    participants: int = Field(description="Number of participants")
1✔
61
    contributions: int = Field(description="Total number of contributions")
1✔
62
    modules: int = Field(description="Number of modules in the project")
1✔
63

64

65
class ModuleSummary(BaseModel):
1✔
66
    """Response model for module summarization."""
67

68
    id: int = Field(description="ID")
1✔
69
    module_id: int = Field(description="ID of the module")
1✔
70
    module_name: str = Field(description="Name of the module")
1✔
71
    purpose: str = Field(description="Goal/purpose of the module")
72
    main_sentiments: Optional[list[str]] = Field(
73
        default_factory=list,
74
        description="Main sentiments or key points from user contributions (for past modules)",
1✔
75
    )
76
    phase_status: str = Field(
77
        description="Phase status: 'past', 'active', or 'upcoming'"
1✔
78
    )
1✔
79
    link: str = Field(description="Link to the module")
80
    first_content: Optional[list[str]] = Field(
81
        None, description="First content/early signs (for active modules)"
82
    )
83

1✔
84

85
class ProjectSummaryResponse(BaseModel):
86
    """Response model for complete project summarization."""
87

1✔
88
    # Header
89
    title: str = Field(default="Summary of participation")
90

1✔
91
    # Stats box
92
    stats: Stats = Field(description="Participation statistics")
1✔
93

1✔
94
    general_summary: str = Field(description="General summary of the entire project")
95
    general_goals: list[str] = Field(description="Overall goals of the project")
1✔
96
    # Timeline sections
97
    past_modules: list[ModuleSummary] = Field(
98
        default_factory=list,
99
        description="Modules that are completed (phase_status='past')",
100
    )
1✔
101

102
    current_modules: list[ModuleSummary] = Field(
103
        default_factory=list,
104
        description="Modules that are active (phase_status='active')",
105
    )
1✔
106

107
    upcoming_modules: list[ModuleSummary] = Field(
108
        default_factory=list,
109
        description="Modules that are upcoming (phase_status='upcoming')",
110
    )
111

1✔
112

113
class DocumentInputItem(BaseModel):
114
    """Single document input item with handle and URL."""
1✔
115

1✔
116
    handle: str = Field(description="Unique identifier/handle for the document")
117
    url: str = Field(description="URL of the document")
1✔
118

NEW
119
    def is_image(self) -> bool:
×
120
        """Check if the URL points to an image file."""
121
        image_extensions = (
122
            ".jpg",
123
            ".jpeg",
124
            ".png",
125
            ".gif",
126
            ".webp",
127
            ".mpo",
128
            ".heif",
129
            ".avif",
130
            ".bmp",
131
            ".tiff",
NEW
132
            ".tif",
×
NEW
133
        )
×
134
        url_lower = self.url.lower()
135
        return any(url_lower.endswith(ext) for ext in image_extensions)
1✔
136

NEW
137
    def is_document(self) -> bool:
×
NEW
138
        """Check if the URL points to a document file (non-image)."""
×
NEW
139
        document_extensions = (".pdf", ".doc", ".docx", ".txt", ".rtf", ".odt")
×
140
        url_lower = self.url.lower()
141
        return any(url_lower.endswith(ext) for ext in document_extensions)
142

1✔
143

144
class DocumentSummaryItem(BaseModel):
145
    """Response model for a single document summary with handle."""
1✔
146

1✔
147
    handle: str = Field(description="Unique identifier/handle for the document")
148
    summary: str = Field(description="Summary of the document content")
149

1✔
150

151
class DocumentSummaryResponse(BaseModel):
152
    """Response model for multiple document summaries."""
1✔
153

154
    documents: list[DocumentSummaryItem] = Field(
155
        default_factory=list,
156
        description="List of document summaries, each with handle and summary",
157
    )
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc