Skip to content

feat: text detail view #570

@TenzDelek

Description

@TenzDelek

current endpoint we are hitting
POST : /api/v1/texts/e159959d-2c0c-4f48-b02c-fbdc8c4a98e3/details
response:

{
  "text_detail": {
    "id": "e159959d-2c0c-4f48-b02c-fbdc8c4a98e3",
    "pecha_text_id": "XVqq55pnANEKri9536Wa4",
    "title": "The Way of the Bodhisattva",
    "language": "en",
    "group_id": "76060053-0121-40d0-ba34-9c55ea7df2f3",
    "type": "version",
    "summary": "",
    "is_published": false,
    "created_date": "2025-11-27 16:22:29",
    "updated_date": "2025-11-27 16:22:29",
    "published_date": "2025-11-27 16:22:29",
    "published_by": "",
    "categories": [
      "692876ab70bf66f003b07d6a"
    ],
    "views": 0,
    "likes": [],
    "source_link": "openpecha.org",
    "ranking": null,
    "license": "unknown"
  },
  "content": {
    "id": "13830c91-57ef-4456-bcdc-58ede76c043a",
    "text_id": "e159959d-2c0c-4f48-b02c-fbdc8c4a98e3",
    "sections": [
      {
        "id": "5b23c7c5-d3e5-4f53-bf04-f5f378489b40",
        "title": "1",
        "section_number": 1,
        "parent_id": null,
        "segments": [
          {
            "segment_id": "60a84de5-c085-454c-aabc-3743a1aaab42",
            "segment_number": 5,
            "content": "With deep respect, I bow to the Buddhas who possess the dharmakaya, to their spiritual heirs, and to all who are worthy of reverence. I will now briefly explain how to enter the discipline of the Bodhisattvas, the heirs of the Buddhas, in accordance with the scriptures.",
            "translation": null
          },
          {
            "segment_id": "9bcd6831-9de5-4718-9c92-7ae5e558265c",
            "segment_number": 20,
            "content": "Just as we understand the difference between wanting to go somewhere and actually going there, in the same way, the wise should understand the distinction between these two states.",
            "translation": null
          }
        ],
        "sections": [],
        "created_date": null,
        "updated_date": null,
        "published_date": null
      }
    ]
  },
  "size": 20,
  "pagination_direction": "next",
  "current_segment_position": 1,
  "total_segments": 929
}

what endpoint we have to hit from the openpecha api:
GET: /v2/texts/HzHOvKlqbiwTZ6iK1I1cF

{
  "bdrc": null,
  "wiki": null,
  "date": "2026-04-28",
  "title": {
    "it": "Tashi Translation English"
  },
  "alt_titles": null,
  "language": "it",
  "commentary_of": null,
  "translation_of": "00LKybawwbmsd29fQwPfA",
  "category_id": "sINrgvK11RMzQ9Egls8Ni",
  "license": "unknown",
  "id": "HzHOvKlqbiwTZ6iK1I1cF",
  "contributions": [
    {
      "person_id": "00X8OpJDvQYno9lX37kOO",
      "person_bdrc_id": "P2MS9536",
      "role": "translator",
      "person_name": {
        "bo": "བསོད་ནམས་ལྡེའུ་བསྟན།"
      }
    }
  ],
  "commentaries": [],
  "translations": [],
  "editions": [
    "O9qpyJlEF0jLDUc7yt1jk"
  ],
  "tag_ids": []
}
  1. get the edition and filter it out based on the type: for us it is always critical
    GET: v2/texts/HzHOvKlqbiwTZ6iK1I1cF/editions?edition_type=critical
[
  {
    "bdrc": null,
    "wiki": null,
    "type": "critical",
    "source": null,
    "colophon": null,
    "incipit_title": null,
    "alt_incipit_titles": null,
    "id": "O9qpyJlEF0jLDUc7yt1jk",
    "text_id": "HzHOvKlqbiwTZ6iK1I1cF"
  }
]
  1. GET SEGMENTATION v2/editions/O9qpyJlEF0jLDUc7yt1jk/segmentations
[
  {
    "segments": [
      {
        "lines": [
          {
            "start": 0,
            "end": 20
          }
        ],
        "id": "BVWzHIgBrbfIlSmNbdDqK",
        "segmentation_id": "0l4SNkqBbw8HFsTBcYgvD",
        "edition_id": "O9qpyJlEF0jLDUc7yt1jk",
        "text_id": "HzHOvKlqbiwTZ6iK1I1cF"
      }
    ],
    "id": "0l4SNkqBbw8HFsTBcYgvD",
    "edition_id": "O9qpyJlEF0jLDUc7yt1jk",
    "text_id": "HzHOvKlqbiwTZ6iK1I1cF"
  }
]
  1. with start and end hit this GET v2/editions/O9qpyJlEF0jLDUc7yt1jk/content?span_start=0&span_end=20
"kunsang is the best."
Image

subtasks

  • get text metadata

  • get critical edition for text

  • get span and segments contents

  • test case

  • reviewer

  • @tenkus47

Metadata

Metadata

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

Status

IN PROGRESS

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions