File size: 806 Bytes
6f5156a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from abc import ABC, abstractmethod
from datetime import date

from legex.models.base import Case


class BaseScraper(ABC):
    country: str

    @abstractmethod
    def scrape(
        self,
        start_date: date | None = None,
        end_date: date | None = None,
    ) -> list[Case]:
        pass

    @staticmethod
    def civil_filter(cases: list[Case]) -> list[Case]:
        return list(cases)

    @staticmethod
    def enrich(cases: list[Case]) -> list[Case]:
        """Post-sampling enrichment hook — runs on the 130 sampled cases only.

        Default is a no-op. Scrapers that need expensive per-case work
        (e.g. downloading PDFs and extracting text) override this so the cost is
        paid only for the sampled set, not the full corpus.
        """
        return list(cases)