Documentation for uploading Pecha in webuddhist web-app

Introduction

This documentation is a guideline for uploading any Pecha to the webuddist web application. Here we will be covering mainly 5 things

  1. Group
  2. Text Metadata
  3. Segment
  4. Table of Content
  5. Segment Mapping

API endpoint link : Link

Creating of Group

In our new Pecha web application, Webuddhist, we have removed the concept of a root text. This change simplifies the architecture but also introduces a challenge: without a root text, it’s no longer straightforward to group multiple versions of the same text (e.g., Choejug), since earlier these versions were linked via their shared root text.

To address this, we now use a Group ID to associate all versions of a particular text. Each group acts as a container for multiple versions belonging to the same collection.

Endpoint: Link

Payload

{
    type: "text" or "commentary"
}

So if you’re uploading a text or version you should select text and if you’re uploading a commentary you need to select commentary.

After that you’ll get a ID which you will be using when uploading text meta-data.

Creating of Text Meta-Data

Here you just need to upload text meta data.

Endpoint: Link

Payload

{
  "title": "text title",
  "language": "bo" or "en" or "zh",
  "isPublished": true, // keep it true for uploading any text or commentary
  "group_id": "group_id", // group_id which you got from the first step
  "published_by": "pecha", // who have published this work
  "type": "commentary" or "version", // even if it's root text keep it as version
  "categories": [
    "collection_id" // it's just the collection if ex: Choejug collection id
  ],
  "views": 0 // Keep it as 0
}

After that you will be getting the text ID.

Upload Text Segment

In our webuddhist web-page we keep all the segments/verse independent in our database.

Example:

"this is verse 1",
"this is verse 2"
we keep both of these verse or segment separate in our database.

So when uploading such segment we generate the following payload

Endpoint: Link

payload:

{
  "text_id": "the text id of which this segment/verse belong to",
  "segments": [
    {
      "content": "segment 1 or verse 1",
      "type": "source", // keep this type as source for uploading any text's segment
      "mapping": [] // we will update mapping later on
    },
    {
      "content": "segment 2 or verse 2",
      "type": "source", // keep this type as source for uploading any text's segment
      "mapping": [] // we will update mapping later on
    }
  ]
}

Uploading of table of content

Table of content defines how the text structure looks like. As we have content section in every book we read on what is the chapter name, chapter sequence and chapter page. Such information of text we keep it in our table of content document.

Endpoint: Link

Payload:

{
  "id": "string", // remove this id since it will be auto generated
  "text_id": "include text id of which this table of content belongs to",
  "sections": [
    {
      "id": "generate a str uuid",
      "title": "keep title name else if you don't have title keep number",
      "section_number": 0,
      "parent_id": "you only need to include the id of the section if it's a nested section",
      "segments": [
         {
            segment_id: "segment id",
            segment_number:"segment number integer datatype"
         }
      ],
      "sections": [
        "here if the chapter has a nested chapter, create a same section structure as above same inside here"
      ],
      "created_date": "string", //FORMAT '%Y-%m-%d %H:%M:%S'
      "updated_date": "string", //FORMAT '%Y-%m-%d %H:%M:%S'
      "published_date": "string" //FORMAT '%Y-%m-%d %H:%M:%S'
    }
  ]
}

If you want to read more about table of content you can refer to following link
documentation of table of content: Link

Uploading of Mapping between texts

Suppose you have a text A and text B and you want to upload mapping between the two text’s segments. The following is the payload of how you can upload the mapping of segment.

Endpoint: Link

Payload:

Following payload is if you are mapping from text A segment to text B segment.
{
  "text_mappings": [
    {
      "text_id": "text A id",
      "segment_id": "text A particular segment ID of which you want to define it's mapping to text B segment",
      "mappings": [
        {
          "parent_text_id": "text B id",
          "segments": [
            "include all the list of segment id with comma separated string to which the text A segments is mapped to"
          ]
        }
      ]
    }
  ]
}

If you want to know more about mapping you can read at the following link

Documentation of Mapping: Link

NOTE: If you are doing it for first time I suggest you upload first in your local machine, then you can follow the same procedure to upload in the deployment database.

If you have any doubt you can first refer to this documentation LINK

For further clarification, you can reach out to @10zin7457 in discord.