Skip to content

Django command to move elements to their geographic parent

After creating single pages from double pages, we need to be able to move all the children elements from double pages to their new parent single page.

The command move_lines_to_parent will take as inputs:

  • a corpus ID, required
  • a --single-page-type, optional, default to single_page
  • a --double-page-type, optional, default to double_page

Workflow is:

  1. list all double pages
  2. iterate on each double page
    1. list all children that are not single page
    2. list all single pages
    3. for each single page
      1. find all children that are inside that page polygon (intersection over 50%)
      2. update their path that contains the double page to also include the single page

Required for NAN