This repository contains a comprehensive analysis of Malaysian General Election data. It includes web scraping scripts to extract election results from Wikipedia, data preparation scripts to clean and organize the extracted data, and data analysis scripts to calculate alliance performance, seat distribution, and margin-of-votes classification.
The current code scrapes election data based on Wikipedia links following the format: https://en.wikipedia.org/wiki/[constituency]. However, I encounter an issue when there are changes in seat names due to parliament redistribution. This results in discrepancies between the Wikipedia links for different election periods, causing the code to fail to scrape data for certain constituencies.
Expected Behavior:
The code should handle cases where seat names change due to parliament redistribution and adapt to the updated Wikipedia links accordingly. This will ensure accurate and consistent scraping of election results for all constituencies, regardless of changes in seat names.
Steps to Reproduce:
Obtain a list of constituencies with seat name changes due to parliament redistribution.
Attempt to scrape election data for each constituency using the provided Wikipedia link.
Observe that the code fails to retrieve data for constituencies with changed seat names.
It is crucial to handle these changes programmatically to ensure the code remains robust and adaptable to future seat name modifications.
We may need to implement a mechanism to automatically detect and update the Wikipedia links based on the correct seat names for each election period.
This issue affects the accuracy and reliability of our election data scraping process, leading to incomplete or incorrect results for certain constituencies.