Skip to main content

Pydantic models for the scraped data storage for the Vezilka Project

Project description

Vezilka Models

Pydantic models for managing structured scraped data in the Vezilka project.

Features

  • Type-safe models using Pydantic v2
  • Built-in validation for data integrity
  • Easy serialization to JSON and dictionary
  • Designed for MongoDB, APIs, and RAG pipelines

Package Structure

vezilka-schemas/
├── __init__.py              # Package exports
├── models.py                # Core Pydantic models

Installation

pip install vezilka-schemas

For development installation and running tests, see QUICKSTART.md

Models

Record

Represents a single scraped item.

Fields:

  • id: Unique identifier
  • text: Full content text
  • type: Content type (RecordType)
  • last_modified_at: Last modification timestamp
  • meta: Metadata object (RecordMeta)

RecordMeta

Metadata associated with a record.

Fields:

  • source: Source identifier (domain, filename, etc.)
  • url: Original URL (optional)
  • tags: List of tags (optional)
  • labels: Additional labels (optional)n
  • scraped_at: Scraping timestamp (optional)

RecordType

Enum defining record types:

  • NARRATIVE: Articles, stories, documentation
  • HUMAN: Speeches, transcripts, interviews

Usage

Creating a Record

from vezilka_schemas import Record, RecordMeta, RecordType
from datetime import datetime

# Create metadata
meta = RecordMeta(
    source="mk.wikipedia.org",
    url="https://mk.wikipedia.org/wiki/Ѓаваткол",
    tags=["Историско-географски области", "Битола"],
    labels=[],
    scraped_at=datetime.now(),
)

# Create record
record = Record(
    id="wiki_1068030",
    text="Ѓаваткол е историско-географска област...",
    type=RecordType.NARRATIVE,
    last_modified_at=datetime.now(),
    meta=meta
)

# Serialize to JSON
json_str = record.to_json()

# Convert to dictionary
data_dict = record.to_dict()

Creating from Dictionary

from vezilka_schemas import Record

data = {
    "id": "speech_9f8e7d6c5b4a",
    "text": "Говорник Африм Гаши: Почитувани пратеници...",
    "type": "human",
    "last_modified_at": "2026-02-11",
    "meta": {
        "source": "stenogram_session_12.pdf",
        "url": "",
        "tags": [],
        "labels": [],
        "scraped_at": "2026-01-17T01:40:11"
    }
}

record = Record.from_dict(data)

Validation

The models include built-in validation. For example, empty id or text will raise ValidationError.

License

MIT License

Contributing

Contributions are welcome! Please feel free to submit a pull request.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vezilka_schemas-0.1.1.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vezilka_schemas-0.1.1-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file vezilka_schemas-0.1.1.tar.gz.

File metadata

  • Download URL: vezilka_schemas-0.1.1.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.10

File hashes

Hashes for vezilka_schemas-0.1.1.tar.gz
Algorithm Hash digest
SHA256 5a2ac923df831839f443530f0137092d9e044673b7cbef644c9251c3ed163f5f
MD5 c48b20401c9984860febdfbbdea11322
BLAKE2b-256 c78e71a393efdd3a557d78d3169b59c64306dcd47ebace8838c8bb0c1924b7ff

See more details on using hashes here.

File details

Details for the file vezilka_schemas-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for vezilka_schemas-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9fad0d87c93747d970d09a559997f1c26a624fb8297328304001579b5e3a58aa
MD5 a122a6cedad3ffd030b90a03782846ed
BLAKE2b-256 f9b1b302b2c6fb4d3a973bd2f29d921bc0518ce44f08aa05e77e901b664a222f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page