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

bramp / build-along / 19774768684

28 Nov 2025 10:13PM UTC coverage: 90.483% (+0.1%) from 90.334%
19774768684

push

github

bramp
Add pdf_page_number to Page and replace InstructionBook with Manual

- Add pdf_page_number field to Page class (required, 1-indexed PDF page number)
- Add manual property to BatchClassificationResult to create Manual from results
- Add model_validator to Manual to sort pages by pdf_page_number
- Remove InstructionBook from openapi.yaml and generated_models.py
- Update save_pages_json to accept Manual instead of list[ClassificationResult]
- Update PageClassifier to set pdf_page_number from page_data.page_number
- Add TYPE_CHECKING import for ClassificationResult in block_filter.py
- Update all test files to include pdf_page_number in Page constructors
- Regenerate golden files with new pdf_page_number field

150 of 157 new or added lines in 6 files covered. (95.54%)

82 existing lines in 3 files now uncovered.

8775 of 9698 relevant lines covered (90.48%)

0.9 hits per line

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

95.24
/src/build_a_long/pdf_extract/classifier/batch_classification_result.py
1
"""Batch classification result class."""
2

3
from __future__ import annotations
1✔
4

5
import logging
1✔
6

7
from pydantic import BaseModel
1✔
8

9
from build_a_long.pdf_extract.classifier.classification_result import (
1✔
10
    ClassificationResult,
11
)
12
from build_a_long.pdf_extract.classifier.text import TextHistogram
1✔
13
from build_a_long.pdf_extract.extractor.lego_page_elements import Manual
1✔
14

15
logger = logging.getLogger(__name__)
1✔
16

17

18
class BatchClassificationResult(BaseModel):
1✔
19
    """Results from classifying multiple pages together.
20

21
    This class holds both the per-page classification results and the
22
    global text histogram computed across all pages.
23
    """
24

25
    results: list[ClassificationResult]
1✔
26
    """Per-page classification results, one for each input page"""
1✔
27

28
    histogram: TextHistogram
1✔
29
    """Global text histogram computed across all pages"""
1✔
30

31
    @property
1✔
32
    def manual(self) -> Manual:
1✔
33
        """Construct a Manual from the classification results.
34

35
        Returns:
36
            Manual containing all successfully classified pages, sorted by PDF page
37
        """
38
        pages = []
1✔
39
        for result in self.results:
1✔
40
            page = result.page
1✔
41
            if page:
1✔
42
                pages.append(page)
1✔
43
            else:
NEW
44
                logger.warning(
×
45
                    "No valid page for page %s", result.page_data.page_number
46
                )
47
        return Manual(pages=pages)
1✔
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