Skip to content

Feature/bibliography export - #178

Open
lpi-tn wants to merge 7 commits into
mainfrom
Feature/bibliography-export
Open

Feature/bibliography export#178
lpi-tn wants to merge 7 commits into
mainfrom
Feature/bibliography-export

Conversation

@lpi-tn

@lpi-tn lpi-tn commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

This pull request introduces a new bibliography export feature to the API, allowing users to export document metadata in RIS format. It adds a new /bibliography/export_bibliography endpoint, supporting backend logic for RIS formatting, document retrieval, and comprehensive tests for the new functionality. Several utility functions were added to handle RIS formatting and author/date conversions, and relevant API documentation was updated.

New Bibliography Export Feature:

  • Added a new bibliography API router and /bibliography/export_bibliography endpoint to export bibliographic metadata in RIS format for a list of document IDs. (src/app/api/api_v1/api.py, src/app/api/api_v1/endpoints/bibliography.py, src/app/models/bibliography.py) [1] [2] [3] [4] [5]
  • Implemented document retrieval by IDs with joined corpus loading for bibliography export. (src/app/services/sql_db/queries.py) [1] [2]

RIS Formatting Utilities:

  • Added helper functions for RIS line formatting, document type mapping, publication date formatting, and author list formatting, as well as the main welearn_document_to_ris function. (src/app/services/helpers.py) [1] [2] [3]

Testing:

  • Added unit and integration tests for the bibliography export endpoint and RIS formatting logic, covering success, empty, and invalid payload cases. (src/app/tests/api/api_v1/test_bibliography.py, src/app/tests/services/test_helpers.py) [1] [2] [3]

Other Improvements:

  • Improved logging in stringify_docs_content by using logger.exception for better error reporting. (src/app/services/helpers.py)

These changes collectively provide a robust, tested API feature for exporting bibliographic information in a standard format.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a bibliography export capability to the API by introducing a new /bibliography/export_bibliography endpoint that returns document metadata formatted as RIS.

Changes:

  • Added a new bibliography API router + endpoint to export RIS for a list of document UUIDs.
  • Implemented RIS formatting helpers (doctype mapping, author/date formatting, RIS serialization).
  • Added query helper to load documents by IDs (with corpus eager loading) and introduced tests for both RIS formatting and the endpoint.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/app/api/api_v1/api.py Registers the new bibliography router and tag metadata.
src/app/api/api_v1/endpoints/bibliography.py Implements the /export_bibliography endpoint returning PlainText RIS output.
src/app/models/bibliography.py Adds request model for the list of document UUIDs.
src/app/services/helpers.py Adds RIS formatting utilities and document-to-RIS serialization.
src/app/services/sql_db/queries.py Adds get_documents_by_ids and reuses it in payload assembly.
src/app/tests/api/api_v1/test_bibliography.py Adds endpoint tests (success/empty/invalid payload).
src/app/tests/services/test_helpers.py Adds unit tests for RIS helper functions and RIS serialization.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/app/services/helpers.py
Comment thread src/app/services/helpers.py Outdated
Comment thread src/app/services/helpers.py Outdated
Comment thread src/app/services/sql_db/queries.py
Comment thread src/app/api/api_v1/endpoints/bibliography.py Outdated
Comment thread src/app/api/api_v1/endpoints/bibliography.py Outdated
lpi-tn and others added 3 commits July 29, 2026 18:08
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.

2 participants