Design, implementation, and querying of relational databases applied to a real-world UK Elections dataset. This module covers ERD modelling, SQL development, and a full-stack Flask web application for data visualisation and electoral calculations.
This module focused on the full lifecycle of database development — from conceptual entity-relationship design through to a deployed web application. Using a UK Elections dataset, an ERD was constructed and annotated, SQL dumps were engineered to populate a relational database, and a Python Flask application was built to expose electoral data and calculations through a web interface. Key deliverables include annotated ERD diagrams, SQL implementation files, a Flask web app with templating, and a full academic report documenting the process.
2:1 / Merit
Python, Flask, SQL, SQLite/MySQL, HTML Templates
Database Design, ERD Modelling, Web Application Development
Full academic documentation covering database design rationale, ERD construction, SQL implementation, Flask app architecture, and evaluation.
Download Academic Report (Word) →The ERD was designed to model the UK Elections dataset, defining entities, attributes, and relationships across the relational schema.
Combined ERD diagram exported as PDF, showing the full relational structure.
Download ERD PDF →Detailed written annotations explaining design decisions for each entity and relationship in the ERD.
Download Annotations (Word) →Key SQL queries and electoral calculation logic developed as part of the database implementation and analysis phase.
Download the key SQL and calculation snippet files used throughout the module.
Download SQL Snippets (ZIP) →
A full-stack web application built with Python Flask, connected to the elections database.
The app exposes electoral data through dynamic routes, uses Jinja2 HTML templates for rendering,
and includes the UK2019ElectionCalc.py script for complex electoral seat calculations.
Main Flask application — defines routes, database queries, and view logic for the UK Elections web interface.
Download app.py →Database models defining the schema used by the Flask app, mapping Python objects to relational tables.
Download models.py →A 41KB calculation script implementing complex UK 2019 General Election seat and vote share logic.
Download Calc Script →Download the full Flask project as a ZIP — includes app source, models, templates, and election calculation scripts.
Download Full Flask Project (ZIP) →1. Importing Data from Excel to Database
2. Selecting Presidential Election Data
3. Set Destination of Copy Excel to Database
4. Selecting Source Table and Views
5. Run and Save as SSIS Package & Encrypt Sensitive Data
6. Saving SSIS Package using Windows Authentication
7. Success — Table and Data Implemented
8. Generating SQL Creation Scripts and Insert Scripts
8.5. Script Generated
9. Connecting Database to VSCode
9.4. Database Connection Progress
9.5. Second Attempt to Connect to VSCode
9.6. SQL Integrate Setting
10. Had to Redownload SQL Server Dev as Express
11. Connected SQL Server to VSCode
12. Installing XAMPP for Apache and phpMyAdmin
12. Setting Random Cookie String for phpMyAdmin
13. Running Apache and phpMyAdmin through XAMPP
14.1. Reconfiguring Excel Sheet
14.2. Pivot Table Made to Fit Database Format with Full Sum
14.3. Made Regions Work on Database to Use Each Field
15. Adding Pivot Table to SQL Database
16. Imported to PHP Admin
17. Installing Node.js and Python
1. Creating Web Application Project
2. Enabling CORS in Startup.cs
3. Installing NuGet Package for JSON Serialisation
3.5. Installing Version 3.1.0
3.6. Newton Package Installed
4. Connecting Database with Election Data to Web Application
5. Testing C# Web App Template Compiles and Loads
6. Setting Up Class to Import Data from Database
6.1. Setting Default Connection to SQL Database
6.2. Installing Entity Framework
6.3. Installing Database Reverse Engineering Tool
6.4. Installing All Necessary Entity Frameworks
6.5. Tool Framework
6.6. All Entity Frameworks Installed — Running Script
6.7. Instance Failure
6.8. Using Server Explorer to Connect SQL Database
6.9. SQL Connection Success
6.10. All Entity Frameworks Installed — Running Script
6.11. Adding Database File for SQL Express
6.12. Restarted Server to Add Database File
6.13. Error Message — Downgrade Required
6.14. Selected Other Database and Manually Entered Details
6.15. Connection Successful
6.16. Database Loaded into Visual Studio
6.17. All Entity Frameworks Installed — Run Script
6.18. Database Models All Set Up in VS Web App
6.19. Setting Up Connection to Database in VS Startup File
7. Creating 2000–2020 Class Interface to Test Data Display
7.1. Adding Both Normal and SQL Class Interfaces
8. Need to Redo All Steps and Move Forward
8.1. GUI Not Showing .NET Core Web
8.2. Installing InMemory Entity Framework
8.3. Website Up and Running
8.4. Throwing Null Error
8.5. Created Dynamic Table Headings