sanskrit_data.schema

Intro

schema package contains modules which define various modules describing various classes for storing Sanskrit data, and their corresponding JSON schema.

Usage tips:

  • Picking or defining the data container class.
    • At the base of every such data container class is the common.JsonObject class.
    • You can define such a class yourself, in your own package (Example here.).
  • Enabling (de)serialization (if one has defined a data container class in a new module file)

Data design

General principles

  • We want data to be stored and communicated between programs in a popular, extensible format - we want to take advantage of existing technologies to the maximum possible extant and not waste time reinventing associated (de)serialization, validation and other libraries.
  • But this does not prevent the data from being presented in a different format for human consumption.

While designing the JSON data-model:

  • Type-hint in JSON should be jsonClass (a language-independent name we’ve picked).
  • Try to avoid field-names which conflict with programming language keywords. (Eg. Prefer “source_type” to “type”).
  • In general, use camelCase or underscore_case for field names - both are fine. Where romanized (potentially mixed case) sanskrit words are used, the latter is the superior convention.
  • Where field names and values are to be automatically rendered into various scripts, as in case of sanskrit vyAkarana jargon (eg: vibhakti, lakAra), we prefer SLP1 transliteration (“viBakti”, “lakAra”).
    • PS: Convenient transliteration modules are available in various languages: please see them listed here.
    • A transliteration map for reference.
  • When in doubt, keep fields optional.

Python data containers and utilities

  • For each JSON schema, we have a python class, at the root of which there is the generic JsonObject class with a lot of utilities. We define a hierarchy of classes so as to share validation and other code specific to certain data classes.
  • Separate Database-specific elements through an interface. We should be able to easily switch to a different database.
  • The schema class field contains the corresponding JSON schema. An introductory video describing how such schema are to be read.

Books and annotations

Please refer to books and ullekhanam .

Class diagram

Open the below image in a new tab and zoom in for clarity.

_images/classes_sanskrit_data_schema.png

Module diagram

Open the below image in a new tab and zoom in for clarity.

_images/packages_sanskrit_data_schema.png