Skip to content

Implement comprehensive QUL API endpoints for core Quran data#374

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/fix-237
Draft

Implement comprehensive QUL API endpoints for core Quran data#374
Copilot wants to merge 3 commits intomainfrom
copilot/fix-237

Conversation

Copy link
Contributor

Copilot AI commented Aug 20, 2025

This PR implements a complete set of API endpoints for the Quranic Universal Library (QUL) to provide programmatic access to core Quran data including verses, translations, tafsirs, topics, themes, and morphological analysis.

What's Added

New API Endpoints:

  • /api/v1/translations - Access verse translations with filtering by verse, chapter, resource, and language
  • /api/v1/tafsirs - Browse Quranic commentary with intelligent range-based verse filtering
  • /api/v1/topics - Explore thematic categorization with verse/chapter associations
  • /api/v1/ayah_themes - Access ayah themes with verse range filtering
  • /api/v1/resources - Browse all resource metadata with comprehensive filtering options
  • /api/v1/morphology/roots - Access morphological root analysis
  • /api/v1/morphology/stems - Browse word stems with contextual filtering
  • /api/v1/morphology/lemmas - Access lemmatized word forms

Enhanced Existing Endpoints:

  • Completed implementation of /api/v1/chapters and /api/v1/verses controllers
  • Added proper JSON response handling to existing endpoints

Architecture

The implementation follows the established project patterns:

  • Controllers handle HTTP requests and delegate to presenters
  • Presenters manage data presentation logic and parameter validation
  • Finders encapsulate database queries with filtering and pagination
  • Models remain unchanged, leveraging existing relationships

Key Features

  • Flexible Filtering: Each endpoint supports multiple filter parameters (verse_id, chapter_id, language_id, etc.)
  • Intelligent Associations: Tafsirs support range-based verse filtering, topics show verse associations
  • Performance Optimized: Eager loading prevents N+1 queries
  • Consistent Pagination: Using Pagy with configurable limits
  • Error Handling: Proper 404/400 responses with descriptive messages
  • Text Search: Where appropriate (resources, themes, morphology)

Example Usage

# Get translations for a specific verse
GET /api/v1/translations?verse_id=1

# Find topics associated with a chapter
GET /api/v1/topics?chapter_id=2

# Search morphological roots used in a verse
GET /api/v1/morphology/roots?verse_id=1

# Get tafsirs covering a verse range
GET /api/v1/tafsirs?verse_id=262

Technical Details

  • 30 new files created following project conventions
  • Enhanced BaseFinder to support context-aware parameter access
  • All syntax validated and documented
  • Comprehensive API documentation included

This enables frontend tools, external applications, and community developers to programmatically access rich Quranic data through a consistent, well-documented API.

Fixes #237.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@zeet-co
Copy link

zeet-co bot commented Aug 20, 2025

We're building your pull request over on Zeet.
Click me for more info about your build and deployment.
Once built, this branch can be tested at: https://quranic-universal-library-my2s-co-b8696b.tarteel-v3.tarteel.io before merging 😉

Co-authored-by: naveed-ahmad <701567+naveed-ahmad@users.noreply.github.com>
Co-authored-by: naveed-ahmad <701567+naveed-ahmad@users.noreply.github.com>
Copilot AI changed the title [WIP] QUL API Implement comprehensive QUL API endpoints for core Quran data Aug 20, 2025
Copilot AI requested a review from naveed-ahmad August 20, 2025 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

QUL API

2 participants