Akvo RSR
  • Components
  • Reference documentation
    • Database Schema
    • Module Index
      • akvo package
        • Subpackages
        • Submodules
  • RSR Docker Development Environment
  • Deploying
Akvo RSR
  • Reference documentation
  • akvo package
  • akvo.rsr package
  • akvo.rsr.management package
  • akvo.rsr.management.commands package
  • akvo.rsr.management.commands.migrate_related_project_hierarchies module
  • View page source

akvo.rsr.management.commands.migrate_related_project_hierarchies module

class akvo.rsr.management.commands.migrate_related_project_hierarchies.Command(stdout=None, stderr=None, no_color=False, force_color=False)[source]

Bases: BaseCommand

add_arguments(parser: ArgumentParser)[source]

Entry point for subclassed commands to add custom arguments.

handle(*args, **options)[source]

The actual logic of the command. Subclasses must implement this method.

help = 'Create a tree structure of Projects from RelatedProjects'
class akvo.rsr.management.commands.migrate_related_project_hierarchies.Migrator(stdout: TextIO, stderr: TextIO, apply: bool)[source]

Bases: object

aggregate_sibling_parents(sibling_groups: List[Set[Project]]) → Dict[Project, Set[Project]][source]

Aggregates sibling groups that one parent in a dict

err(msg: str)[source]
get_group_parents(sibling_group: Set[Project]) → Dict[UUID, Set[Project]][source]

The parents of the sibling group

group_siblings(related_projects: List[RelatedProject]) → List[Set[UUID]][source]

Make groups of sibling projects as sets of project IDs

migrate()[source]
migrate_siblings()[source]

Migrate RelatedProjects with sibling relation

Siblings have to be migrated once the parent+child RelatedProjects have been treated. :return:

out(msg: str)[source]
resolve_sibling_groups(related_siblings: List[RelatedProject], sibling_uuid_groups: List[Set[UUID]]) → List[Set[Project]][source]

Use cache to resolve project UUIDs in the groups to projects

run()[source]
set_group_parents(parent_sibling_dict: Dict[Project, Set[Project]]) → List[Project][source]

Attempts to sets the parent of each group of sibling projects

Not all groups will have the same parent (or a parent at all), which is of course a problem.

Returns:

All the projects that now have a parent

Previous Next

© Copyright 2023, Akvo Foundation.

Built with Sphinx using a theme provided by Read the Docs.