National Council elections

Nationalratswahlen 2023: Kandidat:in Suche

📂 Demo

The website is used to search for candidates who have stood for the 2023 National Council elections in Switzerland. Users can search for a specific candidate using their first name or surname as well as carry out more detailed searches based on various criteria such as canton, list and place of residence. This app was created because the developer wanted to find out how many votes a candidate had received. So far, she has not found an easy way to do this.


Die Webseite dient zur Suche von Kandidat:innen, die für die Nationalratswahlen 2023 in der Schweiz kandidiert haben. Nutzer:innen können sowohl gezielt nach einem Kandidaten mithilfe seines Vor- oder Nachnamens suchen als auch detailliertere Suchen basierend auf verschiedenen Kriterien wie Kanton, Liste und Wohnort durchführen. Diese App entstand, weil die Entwicklerin herausfinden wollte, wie viele Stimmen ein Kandidat erhalten hat. Bisher hat sie keine einfache Möglichkeit dafür gefunden.


Le site web sert à la recherche de candidats qui se sont présentés aux élections du Conseil national 2023 en Suisse. Les utilisateurs peuvent rechercher un candidat de manière ciblée à l'aide de son prénom ou de son nom, mais aussi effectuer des recherches plus détaillées sur la base de différents critères tels que le canton, la liste et le lieu de résidence. Cette application a été créée parce que la développeuse voulait savoir combien de voix un candidat avait obtenu. Jusqu'à présent, elle n'avait pas trouvé de moyen simple de le faire.

Data

NRW23 Candidate Search App

Status Python Version

Table of Contents

Introduction

This repository contains a Flask application designed for users to search for candidates who participated in the 2023 Nationalrat elections (Switzerland). It primarily showcases detailed information about a candidate, emphasizing the number of votes they received.

Repository Structure

NRW23/
│
├── files/
│   └── NRW2023-kandidierende.zip  # Data containing candidate information
│
├── static/
│   ├── JS/
│   │   └── script.js             # JavaScript file for interactive features
│   │
│   └── styles.css                # CSS file for the web application styling
│
├── templates/
│   ├── detail.html               # Detail page template for a specific candidate
│   ├── index.html                # Main page template for search feature
│   ├── privacy-policy.html       # Privacy policy template
│   └── results.html              # Results page displaying candidates
│
├── .gitignore                    # Patterns of files/directories to ignore in git
│
├── app.py                        # Main Flask app script
│
├── LICENSE                       # License file
│
├── main_routes.py                # Routes for the Flask app
│
├── README.md                     # README documentation
│
├── requirements.txt              # List of required Python packages for the app
│
└── utils.py                      # Utility functions for the app

Getting Started

Local Deployment

  1. Clone the Repository bash git clone https://github.com/devobern/NRW23/tree/main

  2. Navigate to Directory bash cd NRW23

  3. Create & Activate Virtual Environment
    Ensure you have python3 and virtualenv installed. bash virtualenv env source env/bin/activate

  4. Install Dependencies bash pip install -r requirements.txt

  5. Run the App bash python run.py

  6. Access Locally
    The application will be accessible at http://127.0.0.1:5000/.

    Note: Due to the Content Security Policy (CSP), the app cannot be run locally without dev certificates. To address this, you can use mkcert to generate your own certificate. For a guide on how to use mkcert, please refer to this tutorial.

Online Access

Access the hosted application here.

Disclaimer

This application is an ongoing project and serves as a bit of a playground for me. It was developed with the primary motivation to provide a simple platform to view the votes received by individual candidates. There might be occasional issues or aspects that need refinement. Feedback and suggestions are always welcome.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Dataset Information

The data used in this repository is sourced from the Bundesamt für Statistik BFS and relates to the Nationalratswahlen 2023.

  • Dataset Name: NR - Kandidierende
  • Publication Date: 8. August 2023
  • Format: JSON
  • Access URL: Link to Dataset

License for Dataset

The dataset is available under the "Freie Nutzung. Quellenangabe ist Pflicht" terms. Users can use this dataset for both non-commercial and commercial purposes, but proper attribution is required.

Attribution:
Autor:in: Bundesamt für Statistik BFS
Titel: NR - Kandidierende
Link zum Datensatz

Contact

For inquiries or suggestions, please reach out via email.

This content is a preview from an external site.
 

Repository updated

03.07.2024 11:29 ~ loleg

Event finish

Fix: Add new text

Adds new text that better match the functions. (@devobern)

Revert changes (@devobern)

fix: problem with back link. (@devobern)

Fix: Inline JS (@devobern)

Add files to .gitignore (@devobern)

Updates to new project structure etc. (@devobern)

Add new requirements (@devobern)

Removes dev run cofnig (@devobern)

minor change in text (@devobern)

Improved code quality and error handling (@devobern)

Split code into mutiple modules (@devobern)

Feat: Add logging

Adds logging to the app (@devobern)

Feat: New search

One can now start typing for a canidates name and a dropdown will be filled with matching candidates. (@devobern)

Fix: Simpler search

The search is now more inclusiv. (@devobern)

Fix: Fix slow loading

Fixes slow loading by first search. Now the dataset is loaded to memory when the app starts. (@devobern)

Style: Style for new features

Adds style for the tooltip (@devobern)

Feat: Add simpler search

Adds the feature to search for a canidate with dropdown (@devobern)

Feat: Remove inline js

Removes inline javascript (@devobern)

Feat: Outsource JavaScript

Outsoruces the java script code. Also there are some new functions. (@devobern)

Feat: Add security headers

Adds security headers like csp, hsts etc. (@devobern)

fixes bug where spinner was still spinning after getting back via browser back button. (@devobern)

Adds some basic privacy policy (@devobern)

Adds a spinner to indicate that the data is loading (@devobern)

Some text changes (@devobern)

Adds support for mobile devices (@devobern)

minor change in path (@devobern)

Adds some optimisations (@devobern)

Adds new results page (@devobern)

removes html file (@devobern)

Adds new filet and changed some text (@devobern)

Adds new details page (@devobern)

Adds some more styling (@devobern)

Minor changes to the readme (@devobern)

Adds more filters (@devobern)

Adds back JSON_FILENAME (@devobern)

Adds absolut path detetion (@devobern)

updates faulty url (@devobern)

Adds github badge (@devobern)

Minor updates to readme (@devobern)

Adds README and LICENSE (@devobern)

Initial commit with all the needed files. (@devobern)

Adds the requirements.txt file (@devobern)

Start