Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
tadghh committed Dec 20, 2023
1 parent e4b598a commit 0e6a0a9
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 239 deletions.
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,9 @@ __pycache__/

.vscode/
/build
/Weather Processing/dist
/*/dist
/dist
/.venv
.obsidian
/Weather Processing/weather_data.sqlite
Weather Processing/weather_data.sqlite
72 changes: 0 additions & 72 deletions CommonQueries.sql

This file was deleted.

Binary file removed Project - Rev9.pdf
Binary file not shown.
187 changes: 40 additions & 147 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,160 +1,53 @@
# Weather Scraper Apprentice

![Application Icon](./Build%20Files/icons/icon.png)

# Setup

## Building
- Install Python 3.12

- Start a venv with the Activate.ps1 in /.env/Scripts/Activate.ps1

- This creates an enviroment that will prevent errors or conflits

- Create a virtual environment
- Run BuildMe.ps1
- Temporarily bypass the execution policy
### Download and Build
```
git clone [email protected]:tadghh/PythonWeatherApp.git
cd .\PythonWeatherApp\
python -m venv venv
venv\Scripts\activate
pip install -r '.\Weather Processing\requirements.txt'
powershell -ExecutionPolicy Bypass -File .\BuildMe.ps1
```

- Use Inno Setup with the spec file if you want to create an installer
After running *BuildMe.ps1* a dist folder will be created that contains the built CLI program.

# Features
Optional
> To create an installer use the spec file with Inno Setup
## Features
- PEP8 Compliant
- Multithreading
- Can scrape weather data from 1996 to 2023 in under 30 seconds
- Can scrape weather data from 1996 to 2023 in 30 seconds
- Uses SQLite to store weather info
- Added an index to quickly update data with distinct data
- Error handling
- Data Visualization
- Logging
-

### Mark: 104

### Weather Scraper

- [x] **Name / 6**

- WeatherScraper class has been created inside a scrape_weather module.

- [x] **Parse / 6**

- Code uses the Python HTMLParser class to parse the website html.

- [x] **Collect Data / 6**

- Code successfully scrapes the min, max & mean temperature and date, and stores them in a dictionary of dictionaries.

- [x] **Detect End / 6**

- Code successfully scrapes weather data from the current date, as far back in time as is available.
- Last available weather date should be automatically detected in some way, not hard coded.

- [x] **I/O / 6**
- Code receives a url to scrape as input, and outputs the scraped data for use in other parts of the program.

### Database Operations

- [x] **Name / 4**

- A class named DBOperations has been created inside a db_operations module.

- [x] **Context Manager / 4**

- Code uses a database context manager named DBCM correctly.
- DBCM returns a cursor object in **enter**.
- DBCM commits changes and closes all connection objects in **exit**.

- [x] **Initialise / 4**

- Code successfully initializes the database and creates the necessary tables/fields if they don't already exist, every time the program starts.

- [x] **Store / 4**

- Code receives & processes date, min, max & mean temperature as input, checks for duplicates in some way, and successfully stores it in the database.

- [x] **I/O / 4**
- DBOperations outputs the data required for plotting.

### Plotting

- [x] **Name / 3**

- A class named PlotOperations has been created inside a plot_operations module.

- [x] **Box Plot / 3**

- Code successfully uses Python matplotlib to create a basic boxplot of mean temperature data with the same labels/design given in the example.

- [x] **Line Plot / 3**

- Code successfully uses Python matplotlib to create a line plot of mean temperature data for a particular month.

- [x] **Process / 3**

- PlotOperations receives & processes the data to be used in the plots. Data is processed in PlotOperations not DBOperations.

- [x] **Format / 3**
- Plots are formatted nicely and include axis labels and title.
- Title includes the correct year or month/day.
- No axis items are overlapping.

### User Interaction

- [x] **Name / 5**

- A class named WeatherProcessor has been created in a module named weather_processor.

- [x] **Fetch Data / 5**

- On startup, code successfully prompts the user to download a full set of weather data, or update their existing data.

- [x] **Plot / 5**

- Code successfully prompts the user for a date range of interest to display.
- From year, to year for box plot.
- Year and month for line plot.
- User prompt shows date format example.

- [x] **Manage / 5**
- Code successfully launches and manages all the other tasks.

### Packaging

- [x] **Create / 5**

- Successfully create a Windows package installer using Inno Setup, which includes a logo and license agreement.

- [ ] **Install & Run / 5**
- Package can be installed successfully on Windows.
- Program runs successfully after installation.

### Additional Requirements

- [x] **PEP8 Compliance / 1**

- Code adheres to PEP8 standard by achieving a score of 8 or higher using pylint.

- [x] **Docstrings / 1**

- Code blocks include comments.
- Code documentation includes module, class & function/method level docstrings.

- [x] **Participation / 1**

- Each module/class/function documentation contains the names of the people who worked on it.

- [x] **Error Handling & Logging / 1**

- Every function/method implements error handling that logs errors to a file using the python logging module.

- [ ] **Q&A / 1**

### Bonus 1 - Optional

- [ ] **UI / 10**
- Create a user interface for all user interaction. All the widgets are labelled and aligned properly. The UI is polished and presentable, ready for sale.

### Bonus 2 - Optional

- [x] **Thread / 5**
- Implement threading in your scraping class to speed up scraping operations.

## Status
- UX focused menu
- Data visualization
- Box plot that can show average temperatures for each month across a range of years
- Line graph, this allows you to see the temperature of a specific month and year
- Error logging

## Libraries
- pylint
- contourpy
- kiwisolver
- lxml
- matplotlib
- numpy
- Pillow
- pyinstaller
- pyinstaller-hooks-contrib
- Menu
- tqdm
## Code quality

Our code quality is currently...

Expand Down
24 changes: 5 additions & 19 deletions Weather Processing/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,26 +1,12 @@
# requirements.txt
pylint
altgraph==0.17.4
colorama==0.4.6
pylint==3.0.3
contourpy==1.2.0
cycler==0.12.1
fonttools==4.46.0
html5lib==1.1
kiwisolver==1.4.5
lxml==4.9.3
lxml==4.9.4
matplotlib==3.8.2
Menu==3.2.2
numpy==1.26.2
packaging==23.2
pefile==2023.2.7
Pillow==10.1.0
pyinstaller==6.2.0
pyinstaller-hooks-contrib==2023.10
pyparsing==3.1.1
python-dateutil==2.8.2
pywin32-ctypes==0.2.2
setuptools==69.0.2
six==1.16.0
pyinstaller==6.3.0
pyinstaller-hooks-contrib==2023.11
Menu==3.2.2
tqdm==4.66.1
webencodings==0.5.1

Binary file removed Weather Processing/weather_data.sqlite
Binary file not shown.

0 comments on commit 0e6a0a9

Please sign in to comment.