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)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.4.tar.gz (6.1 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.4-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: vezilka_schemas-0.1.4.tar.gz
  • Upload date:
  • Size: 6.1 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.4.tar.gz
Algorithm Hash digest
SHA256 38b292de9bc789ca022bccf72f3a9ba333ec67f0d941dbb85b5639c94d86d77e
MD5 bff4d8ee784da70816a57709222a5081
BLAKE2b-256 7bbd3b232d96f2545dd9740822f95b03064a168c514b171b6f9d54ffe9faa5b9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vezilka_schemas-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 fc75bebc1b96ec153ef2618359eaea554f9070f6084191ae5e7f5b196d629e7e
MD5 8b29795c1ec644a4e4757461deb84668
BLAKE2b-256 4b9f40bdd64fcd2f3d98f373b6460c840a02e682aca0860390b90d135cb94e64

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