groupedCouncilorsMainPartyRegion = filtered_results.reduce((acc, curr) => {
const key = curr.region + curr.main_party;
const yearDiff = curr.year - (acc[key]?.year || 0);
acc[key] = {
region: curr.region,
main_party: curr.main_party,
year: curr.year,
councilor_diff: yearDiff === 4 ? curr.councilors - acc[key].councilors : null,
councilors: curr.councilors,
};
return acc;
}, {});