def get_edge_overrides_data(
    environment: "Environment", feature_ids: None | list[int] = None
) -> OverridesData:
    """
    Get the number of identity / segment overrides in a given environment for each feature in the
    project.
    Retrieve identity override data from DynamoDB.

    :param environment: the environment to get the overrides data for
    :return OverridesData: dictionary of {feature_id: EnvironmentFeatureOverridesData}
    """

    assert feature_ids is not None

    with ThreadPoolExecutor() as executor:
        get_environment_flags_list_future = executor.submit(
            get_environment_flags_list,
            environment,
        )
        get_overrides_data_future = executor.submit(
            get_edge_identity_overrides_for_feature_ids,
            environment_id=environment.id,
            feature_ids=feature_ids,
        )
    all_overrides_data: OverridesData = {}

    for feature_state in get_environment_flags_list_future.result():
        env_feature_overrides_data = all_overrides_data.setdefault(
            feature_state.feature_id, EnvironmentFeatureOverridesData()
        )
        if feature_state.feature_segment_id:
            env_feature_overrides_data.num_segment_overrides += 1
    for identity_overrides_v2_list in get_overrides_data_future.result():
        for identity_override in identity_overrides_v2_list.identity_overrides:
            # Only override features that exists in core
            if identity_override.feature_state.feature.id in all_overrides_data:
                all_overrides_data[  # type: ignore[no-untyped-call]
                    identity_override.feature_state.feature.id
                ].add_identity_override()
                all_overrides_data[
                    identity_override.feature_state.feature.id
                ].is_num_identity_overrides_complete = (
                    identity_overrides_v2_list.is_num_identity_overrides_complete
                )

    return all_overrides_data

    Get the number of identity / segment overrides in a given environment for each feature in the
    project.
    Retrieve identity override data from DynamoDB.

    :param environment: the environment to get the overrides data for
    :return OverridesData: dictionary of {feature_id: EnvironmentFeatureOverridesData}
    
api/features/features_service.py