Export Utilities Module

The export utilities module provides functions for generating markdown documents and ZIP archives from paper collections.

Features

  • Natural sorting of strings with embedded numbers

  • Markdown generation for paper lists and search results

  • ZIP archive creation with organized folder structures

  • Conference information fetching

Quick Start

from abstracts_explorer.export_utils import (
    export_papers_to_zip,
    generate_all_papers_markdown,
)

# Generate a markdown document listing all papers
markdown = generate_all_papers_markdown(papers, title="Conference Papers")

# Export papers and search results to a ZIP archive
zip_buffer = export_papers_to_zip(
    papers=papers,
    search_results=search_results,
    title="Conference Papers"
)

# Save the ZIP file
with open("papers.zip", "wb") as f:
    f.write(zip_buffer.getvalue())

API Reference

Export utilities for generating markdown and zip files from papers.

This module provides functions for: - Natural sorting of strings with numbers - Fetching conference information from websites - Generating markdown files for papers - Creating zip archives with organized paper exports

abstracts_explorer.export_utils.natural_sort_key(s)[source]

Generate a sort key for natural sorting of strings with numbers.

Parameters:

s (str) – String to generate sort key for

Returns:

Sort key that enables natural number sorting

Return type:

list

Examples

>>> sorted(["A10", "A2", "A1"], key=natural_sort_key)
['A1', 'A2', 'A10']
abstracts_explorer.export_utils.fetch_conference_info()[source]

Fetch conference information from NeurIPS website.

Returns:

Conference information dictionary with keys: name, dates, location, description Returns None if fetching fails

Return type:

dict or None

Examples

>>> conf_info = fetch_conference_info()
>>> if conf_info:
...     print(conf_info['name'], conf_info['dates'])
abstracts_explorer.export_utils.get_poster_url(paper)[source]

Get poster image URL from paper object.

Parameters:

paper (dict) – Paper object containing poster_image_url and original_id fields

Returns:

Poster image URL if found, None otherwise

Return type:

str or None

Examples

>>> paper = {"poster_image_url": "https://example.com/poster.png"}
>>> get_poster_url(paper)
'https://example.com/poster.png'
abstracts_explorer.export_utils.generate_all_papers_markdown(papers, title)[source]

Generate markdown for all papers in a single file.

Parameters:
  • papers (list) – List of paper dictionaries

  • title (str) – Title for the markdown file

Returns:

Markdown content

Return type:

str

Examples

>>> papers = [{"title": "My Paper", "session": "Oral"}]
>>> md = generate_all_papers_markdown(papers, "All Papers")
>>> "# All Papers" in md
True
abstracts_explorer.export_utils.generate_search_term_markdown(search_term, papers)[source]

Generate markdown for a single search term with all its papers.

Parameters:
  • search_term (str) – The search term

  • papers (list) – List of papers for this search term

Returns:

Markdown content

Return type:

str

Examples

>>> papers = [{"title": "My Paper", "session": "Oral"}]
>>> md = generate_search_term_markdown("transformers", papers)
>>> "# transformers" in md
True
abstracts_explorer.export_utils.generate_main_readme(papers, search_query, sort_order='search-rating-poster')[source]

Generate main README.md with conference overview and links to search term files.

Parameters:
  • papers (list) – List of paper dictionaries (already sorted)

  • search_query (str) – Search query context

  • sort_order (str) – Sort order used (‘search-rating-poster’, ‘rating-poster-search’, ‘poster-search-rating’)

Returns:

Markdown content for main README

Return type:

str

Examples

>>> papers = [{"title": "Paper", "searchTerm": "AI", "priority": 3}]
>>> readme = generate_main_readme(papers, "AI search", "search-rating-poster")
>>> "NeurIPS 2025" in readme
True
abstracts_explorer.export_utils.generate_folder_structure_export(papers, search_query, sort_order='search-rating-poster')[source]

Generate a zip file with folder structure respecting the sort order.

File organization based on first sort priority: - search-rating-poster: Separate files per search term - rating-poster-search: Separate files per rating level - poster-search-rating: Single file with all papers (poster # is first)

Parameters:
  • papers (list) – List of paper dictionaries (already sorted)

  • search_query (str) – Search query context

  • sort_order (str) – Sort order used (‘search-rating-poster’, ‘rating-poster-search’, ‘poster-search-rating’)

Returns:

Buffer containing zip file

Return type:

BytesIO

Examples

>>> papers = [{"title": "Paper", "searchTerm": "AI", "priority": 3}]
>>> zip_buffer = generate_folder_structure_export(papers, "AI", "search-rating-poster")
>>> zip_buffer.tell() > 0
True
abstracts_explorer.export_utils.export_papers_to_zip(papers, search_query, sort_order='search-rating-poster')[source]

Export papers with priorities to a ZIP file, handling sorting and formatting.

This is a convenience function that handles the complete export workflow: - Sorts papers based on the specified sort order - Generates the ZIP file structure - Returns the buffer ready for sending

Parameters:
  • papers (list) – List of paper dictionaries with priority and searchTerm fields

  • search_query (str) – Search query context for the export

  • sort_order (str, optional) – Sort order: ‘search-rating-poster’, ‘rating-poster-search’, or ‘poster-search-rating’

Returns:

Buffer containing the generated ZIP file

Return type:

BytesIO

Examples

>>> papers = [{"title": "Paper 1", "priority": 5, "searchTerm": "AI"}]
>>> zip_buffer = export_papers_to_zip(papers, "AI research", "search-rating-poster")