Blog 10 – Milestone Three

As I had hoped the front-loading I did for this project payed off. I connected my app to a remote MongoDB database and switching the app form using local data storage to using the database was a breeze thanks to the fact that I have been using Mongo already in one of my other courses this semester.

The hardest part hear was actually getting a multi-thread solution running for my chat so that I could simultaneously update the chat and have the window checking for events from the user.

Unfortunately due to the nature of PySimpleGUI the only way to update the chat was to constantly query the database in the background. This is because the windows that PySimpleGUI creates are not dynamic, the code stops every time a window is rendered and waits for a user to trigger an event.
This ultimately makes this app very resource intensive and very inefficient but there isn’t much I can do about that considering the requirements of the assessment.
I tried to mitigate this problem somewhat by having the chat be retrieve only once every five seconds but this is far from an ideal solution for a chat system.

Blog 09 – Just working on our Project

This week we didn’t have any large topics to cover in class, so we just kept going on developing our Data Explorer Applications. The work was split up using a milestone format and we were currently in milestone two (2) of three (3).

In milestone one our aim was to simply get a prototype design going for our app’s Data Explorer Screens (DES).
For milestone two the aim is to get the app running with graphs and the necessary data management to use those graphs.
Milestone three will be where we add a functioning chat system, login and registration, and have our app communicate with a remote database.

I had already made all of the necessary screens (or windows) for the app in milestone one, and now for milestone two I have decided to implement the chat and login + registration components as a locally working prototype.
This means that when I get to milestone three I will just need to connect these components up to my remote database and work out any kinks that may occur.

Blog 08 – Appending Data

This week we looked at using Python to append data from a csv file to another ( compatible ) csv file.

This would allow us to add data to an existing set already being used in our applications which can then be shown on our graphs. As long as the data is compatible ( the same columns are used ) we could theoretically keep adding on more a more data, though eventually the graphs would become unreadable from trying to display the copious amount of data.

Blog 07 – Python Modules

This week we looked at using modules in Python and how they are useful.
Rather than having one massive file full of all the code necessary for a Python project to run, modules allow you to spread out the code into multiple files. This makes the code much easier to work with and easier to read.

Doing this is what is known as modular programming and is described in ‘Modular Programming’ (2021) as a “technique that emphasizes separating the functionality of a program into independent, interchangeable modules, such that each contains everything necessary to execute only one aspect of the desired functionality.”

Modular programming. (2021). In Wikipedia.

Blog 06 – Python, Working with Files

This week we started to use Python to work with local files, greatly expanding what we can do with Python e.g. persistent memory, data analysis, files management automation, etc.

We however, as part of our course, focused on using Python to read and analyse files, specifically csv files which contain tabular data. Later on we will use this data to display graphs in our Data Explorer App that can be used for data analysis.

We looked at using the “open” method to access files which has the following format:

file = open("file path", "operation")

The operation parameter can be one of the following:
r’ is read mode , open for reading only
‘w’ is for writing
‘a’ is for appending
‘r+’ is for reading and writing

Blog 05 – Lock-down Season 2

With Covid once again shutting everyone indoors, we moved our classes online again. However the tutor of the SDV502 class had also decided that this week would be their “Research week”, which meant that we had no classes for SDV502 this week.

This gave me time to put work into our Project, and I ended up building a prototype for the whole application. This included making functional prototypes for the login/registration and the chat system, which should allow for an easier time when I go to hook up those functionalities to a database.

Blog 04 – Programming and our Project

Why do we program:
* Storing and distributing of data
* To solve problems
* To automate tasks

What is programming?
* A creative process in which a programmer creates instructions for a machine

How do we program?
* Using an SDLC (System Development Life-Cycle)
* Using a programming language that fits the specifications of what we need the program to do

Milestone one is to contain 3 prototype DES (Data Explorer Screens) and a storyboard showing the DES’s along with the rest of the application. As the 3 DES’s are only prototypes, we can use placeholders to represent the graphs that we will implement in the following milestones.

COVID-19 was found in the community resulting in another national level-4 lockdown, NMIT canceled all classes ( including virtual ) until next week.

Blog 03 – Python GUI

This week were introduced to making GUI’s with Python and displaying charts that can be used for data analysis.

There are multiple options available when making a GUI through Python, e.g. PySimpleGUI or Kivy.
They can be more or less complex with a varying amount of features but I have generally found that they are all static, meaning that you cannot dynamically update the displayed windows. The code stops and waits at the point where the window is rendered and waits for a return from it before it can continue.

Blog 02 – Global Variables

Today we spent the first half of the class doing an exercise with our laptop screens down and writing code snippets on paper.
The idea was to display our knowledge of Python data structures and therefore the methods they utilize. Why it was intended to do this without our laptops or the internet, I don’t know. It would have been much more effective to provide us with code problems that required us to use this knowledge in order to solve them.

Global variables:
Global variables are variables that can be accessed anywhere in the program allowing them to be used across multiple functions ( in any scope ). I now know that to access a global variable you need to use the keyword global before the variable name e.g.

global globalVariable = localScopeValue

I learnt about global variables earlier during some other research I was doing for Python programming, the interesting part is that Python’s global variables do not automatically get passed down into local scopes ( e.g. functions etc ).
I already new that global variables were a thing ( having already used two other programming languages ) so what I learnt from this was how to use them specifically in Python.
I will be filling any remaining gaps in my knowledge through experimentation and researching on the internet.

The work I’ve done as part of the class exercises ( as well as my own tinkering ) can be found in the following repository in the “Playground” folder:

Blog 01 – Python Exercise and Project

Today we went over methods of flow control available to Python e.g. if, while, for.
For the second half of the lesson we worked on a “FizzBuzz exercise” where we had to create a counter that would count up to a given number and print the following:
If a number was divisible by 3 and 5, print “FizzBuzz”
If a number was divisible by 5, print “Buzz”
If a number was divisible by 3, print “Fizz”
If non of the above are true print the number.
We also did a few different variations of this script.

Today we had an exercise in data manipulation using Python to access .csv files.
I had to start by reviewing the code that we were giving in order to understand how the existing code worked. Then I was able to start figuring out how I would be able to complete the exercises.

Project Proposal:
I’m going to build an app that allows for easy viewing and analysis of the data contained in the data-source ( which contains data on agricultural and horticultural land-use in New Zealand between 2002-2016 ) that I have selected for the project.