Skip to main content

Pydantic models for the scraped data storage for the Vezilka Project

Project description

Vezilka Schemas

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)
  • scraped_at: Scraping timestamp

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.5.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.5-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: vezilka_schemas-0.1.5.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.5.tar.gz
Algorithm Hash digest
SHA256 9a123d032a190c1cb36833184bff5c610f86a4caba0cc4f07810e5c3889d698b
MD5 57a262dff95cc42bdf098c9a04e40e9f
BLAKE2b-256 35cdd61f9aecb97be83eb0ddb7a9a5d7554c11a0757d87dd695fcb2159516ad1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vezilka_schemas-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 d071c4f212ab71e9b4aa681aa2acc532dc2060c3ee8a195e0e0769a07870308e
MD5 222880e4354b02cf6397d006184ab4f0
BLAKE2b-256 8b2d299fe9efd193386c41b997effafba79fbef2bb4bf6bf92b08030a1d48988

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