CPSC/DATA 350 - Applications of Databases - Fall 2024
Possible experience: +40XP (or even more)
Due: Sunday, Oct. 27, midnight
Your mission in the final four assignments of the semester is to design a functioning Web application that allows a user from anywhere in the world to browse and contribute to a repository of data on a topic of your choice. Your repository will pull from four different database backends to deliver various facets of your subject matter: MariaDB SQLite, Redis, Mongo, and Neo4j.
In this first installment, you'll put together the infrastructure for your Flask app, install the supporting tools, and configure your server so that it can be accessed by end users. You'll also add the first fourth of your website, powered by the relational database MariaDB SQLite.
Choose a personal hobby or interest that you find engaging enough to not get bored with in the next six weeks. (It should be considerably more interesting to you than commercial airline flights are, for example.) It should also be complex enough that there are several different interesting aspects about which you can collect data. (This is probably true of just about any hobby, but in case you have a very "simple" interest, you might want to choose something else.)
From this overarching theme, identify one facet of it that you think would lend itself well to the table structure of the relational model. Don't use up all your ideas on this first stop of the tour: you'll need three other aspects of your hobby to collect data about for the other three stops! Pick something interesting and non-trivial, but not exhaustive.
You should begin a new Flask app for this project:
$ python -m venv venv $ source venv/bin/activate $ pip install flask ipython
$ git init .If you'd like to create a .gitignore file at this point, to keep your git status messages clean, you can give it these contents:
venv __pycache__ .gitignore
from flask import Flask dbtour_app = Flask(__name__) from dbtour import routes
from dbtour import dbtour_app
from dbtour import dbtour_app import sqlite3 @dbtour_app.route("/") def does_this_work(): conn = sqlite3.connect("whateverYouWantToCallYourSqliteDatabase.db") cursor = conn.execute("select msg from message") msg = cursor.fetchall() return f"<HTML><BODY><H1>{msg[0][0]}</H1></BODY></HTML>"
$ sqlite whateverYouWantToCallYourSqliteDatabase.db sqlite> create table message (msg text); sqlite> insert into message values ('READY TO GO ON TOUR, BABY!!'); sqlite> (press CTRL-D to quit)
$ export FLASK_APP=dbtour_app $ flask run -h 0.0.0.0 -p yourSECONDPortNumber
Now that you've sanity check this all works end-to-end, add and commit your files to git (yes, you should add the .db file too, even though it's not plain text). Also, feel free to make whatever aliases in your .bash_profile you may want in order to automate stuff.
Don't forget the instructions from assignment #5 about keeping your website up and running 24/7, even when you're not logged in. For the present, you'll keep your assignment #5 (Filbert) site up and running on your first port number, while you develop your assignment #6 site on your second port number.
Your assignment #6 should fulfill the following requirements:
My database has two tables, called SHOWS and LOCATIONS:
SHOWS +------------------------------+------------------+-------------+-----------+-----------+---------+-------------+ | name | creator | network | genre | startYear | endYear | city | +------------------------------+------------------+-------------+-----------+-----------+---------+-------------+ | A Touch of Frost | R.D. Wingfield | BBC | cop show | 1992 | 2010 | Denton | | Bang | Roger Williams | S4C | cop show | 2017 | 2020 | Port Talbot | | Columbo | Richard Levinson | NBC | detective | 1968 | 1978 | L.A. | | Goliath | David Kelley | Amazon | courtroom | 2015 | 2021 | L.A. | | Injustice | Anthony Horowitz | Acorn | courtroom | 2011 | 2011 | London | | Line of Duty | Jed Mercurio | BBC | cop show | 2012 | 2021 | London | | Mare of Easttown | Brad Ingelsby | S4C | cop show | 2017 | 2020 | Easttown | | No.1 Ladies Detective Agency | Richard Curtis | BBC | detective | 2008 | 2008 | Gaborone | | Second Sight | Paula Milne | BBC | cop show | 2000 | 2001 | London | | The Closer | James Duff | Fox | cop show | 2005 | 2012 | L.A. | | Thou Shalt Not Kill | Claudio Carbucci | PBS | cop show | 2015 | 2016 | Turin | | Wallander | Henning Mankel | Yellow Bird | detective | 2005 | 2006 | Ystad | | Anatomy of a Scandal | Melissa Gibson | Netflix | courtroom | 2022 | 2022 | London | | The Tower | Pat Harbinson | BBC | detective | 2022 | 2024 | London | | Blue Lights | Declan Lawn | BBC | cop show | 2023 | 2024 | Belfast | +------------------------------+------------------+-------------+-----------+-----------+---------+-------------+ LOCATIONS +-------------+------------+---------------+ | city | country | main_language | +-------------+------------+---------------+ | Denton | UK | English | | Easttown | USA | English | | Gaborone | Botswana | English | | L.A. | USA | English | | London | UK | English | | Port Talbot | UK | Welsh | | Turin | Italy | Italian | | Ystad | Sweden | Swedish | | Belfast | N. Ireland | English | +-------------+------------+---------------+
Here's what the landing page looks like:
And here's my "add data" page:
The basic requirements above will get you +40XP if implemented flawlessly. If you're looking for a greater challenge, or simply some more XP, add either or both of the following features as well:
Send me an email with subject line "CPSC/DATA 350 Assignment #6 turn-in". In the body of the email, simply In the body of the email, simply paste the link to the landing page of your website.
Come to office hours, or send me email with subject line "CPSC/DATA 350 Assignment #6 help!!"