def migrate_app(self, app_doc):
        modules = [m for m in app_doc['modules'] if m.get('module_type', '') == 'advanced']
        should_save = False
        for module in modules:
            forms = module['forms']
            for form in forms:
                load_actions = form.get('actions', {}).get('load_update_cases', [])
                for action in load_actions:
                    preload = action['preload']
                    if preload and preload.values()[0].startswith('/'):
                        action['preload'] = {v: k for k, v in preload.items()}
                        should_save = True

        return Application.wrap(app_doc) if should_save else None
dataset/ETHPy150Open dimagi/commcare-hq/corehq/apps/app_manager/management/commands/migrate_advanced_form_preload.py/Command.migrate_app/original