src.geometor.euclid.ingest.organization

Module for organizing extracted files into a structured directory hierarchy.

Functions

ensure_dir(path) → None

Ensures a directory exists.

get_max_page(pages) → int

Returns the maximum page number from a list of page dictionaries.

assign_ranges(toc_entries, start_page, end_page, ...) → None

Recursive function to assign page ranges to paths.

run_organization() → None

Organizes extracted content into folders based on page assignments.

Module Contents

src.geometor.euclid.ingest.organization.ensure_dir(path: pathlib.Path) → None

Ensures a directory exists.

src.geometor.euclid.ingest.organization.get_max_page(pages: List[Dict[str, Any]]) → int

Returns the maximum page number from a list of page dictionaries.

src.geometor.euclid.ingest.organization.assign_ranges(toc_entries: List[Dict[str, Any]], start_page: int, end_page: int, parent_path: pathlib.Path, assignments: Dict[int, pathlib.Path]) → None

Recursive function to assign page ranges to paths.

Parameters:
  • toc_entries – The table of contents entries.

  • start_page – The starting page number.

  • end_page – The ending page number (exclusive).

  • parent_path – The parent path for the current entry.

  • assignments – Dictionary mapping page_num -> path to be updated.

src.geometor.euclid.ingest.organization.run_organization() → None

Organizes extracted content into folders based on page assignments.