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

Uploaded Python 3

File details

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

File metadata

  • Download URL: vezilka_schemas-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 5f6c0d2bfd469b8da9affd4fa0d75fc1154d2f00ba9f4836e315f24643bbb2ec
MD5 9a728d47438585e50cf6c96efea439c2
BLAKE2b-256 731f7f988d58c4319fe465ce0f739f4d047dd96d847d9c5867b503dcfc7f6738

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vezilka_schemas-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 bdfe1303b6dde6cdb6b1e436caa0559ce15132b5b0ccd608f38bce6e810ab364
MD5 2696a57501c54a6ec283b02e35ac550c
BLAKE2b-256 813971aa419b9c7f61695d2865faf5f7064e29a515877383e5e9f2298f793a5b

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