(cls, case_property_mapping, app_id, app_version)
return schema
Generates the schema for the Case History tab on the export page
Generates the schema for the Case History tab on the export page
Generates the schema for the Case History tab on the export page
def _generate_schema_for_case_history(cls, case_property_mapping, app_id, app_version):
        """Generates the schema for the Case History tab on the export page"""
        assert len(list(case_property_mapping)) == 1
        schema = cls()

        group_schema = ExportGroupSchema(
            path=CASE_HISTORY_TABLE,
            last_occurrences={app_id: app_version},
        )
        unknown_case_properties = set(case_property_mapping[list(case_property_mapping)[0]])
        unknown_case_properties -= set(KNOWN_CASE_PROPERTIES)

        def _add_to_group_schema(group_schema, path_start, prop, app_id, app_version):
            group_schema.items.append(ScalarItem(
                path=CASE_HISTORY_TABLE + [path_start, PathNode(name=prop)],
                label=prop,
                tag=PROPERTY_TAG_UPDATE,
                last_occurrences={app_id: app_version},
            ))

        for prop in KNOWN_CASE_PROPERTIES:
            path_start = PathNode(name="updated_known_properties")
            _add_to_group_schema(group_schema, path_start, prop, app_id, app_version)

        for prop in unknown_case_properties:
            path_start = PathNode(name="updated_unknown_properties")
            _add_to_group_schema(group_schema, path_start, prop, app_id, app_version)

        schema.group_schemas.append(group_schema)
        return schema
def _generate_schema_for_case_history ( cls , case_property_mapping , app_id , app_version ) : assert len ( list ( case_property_mapping ) ) == 1 schema = cls ( ) group_schema = ExportGroupSchema ( path = CASE_HISTORY_TABLE , last_occurrences = { app_id : app_version } , ) unknown_case_properties = set ( case_property_mapping [ list ( case_property_mapping ) [ 0 ] ] ) unknown_case_properties -= set ( KNOWN_CASE_PROPERTIES ) def _add_to_group_schema ( group_schema , path_start , prop , app_id , app_version ) : group_schema . items . append ( ScalarItem ( path = CASE_HISTORY_TABLE + [ path_start , PathNode ( name = prop ) ] , label = prop , tag = PROPERTY_TAG_UPDATE , last_occurrences = { app_id : app_version } , ) ) for prop in KNOWN_CASE_PROPERTIES : path_start = PathNode ( name = "updated_known_properties" ) _add_to_group_schema ( group_schema , path_start , prop , app_id , app_version ) for prop in unknown_case_properties : path_start = PathNode ( name = "updated_unknown_properties" ) _add_to_group_schema ( group_schema , path_start , prop , app_id , app_version ) schema . group_schemas . append ( group_schema ) return schema