Advanced
200 mins
Teacher/Student led
+100 XP
Teacher-led from the board. Pupils do not need a device, but can follow on one.

Building Your Interactive Website

In this lesson you build the website at the centre of your project, covering BR3, AR1 and AR2 of the 2027 brief. You will set up a Flask site that reads your CSV file directly, add a search or filter, build a form for new records that checks a range of data types (string, integer, float, boolean and date), store each new record, give clear feedback after every action, and show your charts on a well-designed site.

Teacher Class Feed

Load previous activity

    1 - Objectives

    These lessons guide you through the Coursework Project. They are a guide only: the SEC's Coursework Project Brief 2027 is the authority, so always check what you do against it. Open the 2027 brief.

    By the end of this lesson you will have:

    • A Flask website that reads your CSV file and shows the data
    • A search or filter that works
    • A form that adds new records, checks every field and saves them
    • Clear success and error messages
    • Your charts on a clean, consistent site

    This is a long lesson in five stages. Work through them in order and save evidence at each stage.

    2 - Exact Requirements You Must Meet

    BR3 Interactive website

    • A functional website that displays information about your problem or need in school life.
    • Good web design principles.
    • Your data visualisations displayed on the website.

    AR1 Dataset website integration

    • The website reads and displays the data directly.
    • Users can search or filter the dataset in at least one way.

    AR2 Additional data

    • Users create new records through a form, with appropriate input validation, and the data is stored.
    • A range of data types in the form (for example string, integer, float, boolean and date), with suitable input fields and validation.
    • Clear feedback after each operation: a success message, an error message or a validation prompt.

    3 - Project Folder and Flask Set-up

    Organise your Artefact folder like this, with your main program clearly named:

    Artefact/
        app.py              <- main program: run this
        make_data.py        (only if you simulate data)
        clean_data.py
        charts.py
        data/wellbeing.csv
        templates/          index.html, data.html, add.html, analysis.html
        static/             style.css and the chart images

    Start app.py with the code that reads your data:

    import csv
    from datetime import date
    from statistics import mean, median, mode
    
    from flask import Flask, render_template, request
    
    app = Flask(__name__)
    DATA = "data/wellbeing.csv"
    FIELDS = ["id", "year_group", "survey_date", "sleep_hours",
              "study_hours", "exercise_mins", "plays_sport", "mood"]
    
    
    def load_records():
        with open(DATA, newline="") as f:
            return list(csv.DictReader(f))
    
    
    @app.route("/")
    def home():
        return render_template("index.html")

    Run it with python app.py and open http://127.0.0.1:5000 in a browser. The site runs on your own computer; it does not need the internet.

    The brief does not name a framework. Flask is used here because you learned it earlier in the course, and it lets your search and analysis run in Python.

    4 - Reading and Displaying Your Data

    load_records() opens the CSV and returns a list of records. Each record is a dictionary, so r["sleep_hours"] is that record's sleep. Every page that needs data calls it, so the website always reads the file directly (AR1).

    A template turns the records into a table. This is templates/data.html:

    <h1>Survey records</h1>
    <form method="get" action="/data">
      <label for="year">Year group (1 to 6):</label>
      <input type="number" id="year" name="year" min="1" max="6" value="{{ year }}">
      <button type="submit">Filter</button>
    </form>
    <p>{{ records|length }} records shown.</p>
    <table>
      <tr><th>ID</th><th>Year</th><th>Date</th><th>Sleep</th><th>Mood</th></tr>
      {% for r in records %}
      <tr><td>{{ r.id }}</td><td>{{ r.year_group }}</td><td>{{ r.survey_date }}</td>
          <td>{{ r.sleep_hours }}</td><td>{{ r.mood }}</td></tr>
      {% endfor %}
    </table>

    {% for r in records %} repeats the table row once for every record. {{ records|length }} shows how many there are.

    123learn · Online learning platform

    Unlock the full learning experience

    You're previewing this lesson. Get full access to this lesson and hundreds more — each one ready to teach, with interactive activities, printable resources and pupil progress tracking built in.

    Hundreds of curriculum-aligned lessons
    Interactive activities in every lesson
    Printable resources & progress tracking
    Copyright Notice
    This lesson is copyright of Coding Ireland 2017 - 2026. Unauthorised use, copying or distribution is not allowed.
    🍪 Our website uses cookies to make your browsing experience better. By using our website you agree to our use of cookies. Learn more