akvo.rsr.usecases.fix_inconsistent_results module

akvo.rsr.usecases.fix_inconsistent_results.fix_inconsistent_result(result: Result)[source]

Fix inconsisten result between parent result project and parent project.

This function fixes the parent of a result that have inconsistency between the project of the parent result and the parent project of the result. It also fixes the parent of all the indicators and indicator periods under the result. It resolve the correct parents by traversing from the false parent result project up to the project hierarchy to find the nearest common ancestor than creates a binary lineage tree connecting the false parent result project to to correct result’s parent project using the nearest common ancestor as root. Then, it uses the lineage tree path to resolve the correct parent of the result, indicators, and periods respectively.

akvo.rsr.usecases.fix_inconsistent_results.fix_inconsistent_results(results: Iterable[Result])[source]
akvo.rsr.usecases.fix_inconsistent_results.get_change_candidates(result: Result, target_project: Project | None) Dict[str, Dict[int, int | None]][source]